- Pythonプラグイン(PyRuntimeBox/PyObjectBox)を追加 - eval, import, getattr, call, callKw, strメソッド実装 - math.sqrtデモ等のサンプルコード追加 - AOTビルドサポート追加 - libnyrtランタイムライブラリ - build_aot.shビルドスクリプト - .gitignore改善 - JSONLとDOTファイル除外 - プラグインのビルド成果物除外 - 不要ファイル削除 - nekocode-temp, zenn_articles - 一時的なログファイル類 Phase 10.1の新計画に基づいて、プラグインBox統一化を推進
23 lines
512 B
Plaintext
23 lines
512 B
Plaintext
// Python plugin demo: import math, getattr sqrt, call(9), str()
|
|
// Build plugin:
|
|
// (cd plugins/nyash-python-plugin && cargo build --release)
|
|
// Run:
|
|
// NYASH_CLI_VERBOSE=1 ./target/release/nyash --backend vm examples/py_math_sqrt_demo.nyash
|
|
|
|
static box Main {
|
|
init { console }
|
|
|
|
main() {
|
|
me.console = new ConsoleBox()
|
|
|
|
local py, m, f, r
|
|
py = new PyRuntimeBox()
|
|
m = py.import("math")
|
|
f = m.getattr("sqrt")
|
|
r = f.call(9)
|
|
print("sqrt(9) = " + r.str())
|
|
return 0
|
|
}
|
|
}
|
|
|