Files
hakorune/examples/py_kw_round_demo.nyash
Moe Charm d24149d0a1 feat: Phase 10.5 Python統合プラグインとAOTビルド対応
- 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統一化を推進
2025-08-29 10:22:44 +09:00

19 lines
567 B
Plaintext

// Python plugin demo: kwargs call via callKw
// Build plugin:
// (cd plugins/nyash-python-plugin && cargo build --release)
// Run (with auto-decode optional):
// NYASH_PY_AUTODECODE=1 NYASH_CLI_VERBOSE=1 ./target/release/nyash --backend vm examples/py_kw_round_demo.nyash
static box Main {
main() {
local py, bi, roundf, r
py = new PyRuntimeBox()
bi = py.import("builtins")
f = bi.getattr("int")
// int(x="FF", base=16) => 255
r = f.callKw("x", "FF", "base", 16)
me.console.log("int(x='FF', base=16)=", r.str())
return 0
}
}