Files
hakorune/tools/pyc/README.md

25 lines
985 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Nyash Python Compiler (Phase 10.7 Workbench)
目的: Parser(プラグイン) → Nyash側コンパイラ → Nyashソース → 既存AOT までの最短ルートを、Nyashだけで段階実装する作業場。
## 構成
- `pyc.hako` — エントリ(最小パイプライン実行)
- `PyCompiler.hako` — Nyash側コンパイラ本体C2で拡張
- `PyIR.hako` — IR生成/整形のヘルパ(最小)
## 使い方(最小)
```bash
# 1) NYASH_PY_CODE に Python コードを入れるParserプラグインが拾う
NYASH_PY_CODE=$'def main():\n return 0' \
./target/release/nyash --backend vm tools/pyc/pyc.hako
```
出力
- Parser JSONdump/counts/unsupported
- 生成された Nyash ソース(現状は最小: return 0
## 次の拡張
- Parser JSON → IR(JSON) への変換def/return最小
- IR → Nyash 生成If/Return/Assign へ拡張)
- All-or-Nothing 運用unsupported_nodes を見て Strict に弾くスイッチ)