## 主な変更点 ### 🎯 戦略の転換と明確化 - PyVMを開発ツールとして位置づけ(本番経路ではない) - EXE-first戦略を明確に優先(build_compiler_exe.sh実装済み) - Phase順序の整理: 15.2(LLVM)→15.3(コンパイラ)→15.4(VM) ### 🚀 セルフホスティング基盤の実装 - apps/selfhost-compiler/にNyashコンパイラMVP実装 - compiler.nyash: メインエントリー(位置引数対応) - boxes/: parser_box, emitter_box, debug_box分離 - tools/build_compiler_exe.sh: ネイティブEXEビルド+dist配布 - Python MVPパーサーStage-2完成(local/if/loop/call/method/new) ### 📝 ドキュメント整備 - Phase 15 README/ROADMAP更新(Self-Hosting優先明記) - docs/guides/exe-first-wsl.md: WSLクイックスタート追加 - docs/private/papers/: 論文G~L、爆速事件簿41事例収録 ### 🔧 技術的改善 - JSON v0 Bridge: If/Loop PHI生成実装(ChatGPT協力) - PyVM/llvmliteパリティ検証スイート追加 - using/namespace機能(gated実装、Phase 15では非解決) ## 次のステップ 1. パーサー無限ループ修正(未実装関数の実装) 2. EXEビルドとセルフホスティング実証 3. c0→c1→c1'ブートストラップループ確立 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
2.0 KiB
2.0 KiB
Parser/Bridge: Unary and ASI Alignment (Stage‑2)
Context
- Rust parser already parses unary minus with higher precedence (parse_unary → factor → term) but PyVM pipe path did not reflect unary when emitting MIR JSON for the PyVM harness.
- Bridge(JSON v0 path)is correct for unary by transforming to
0 - exprin the Python MVP, but Rust→PyVM path usesemit_mir_json_for_harnesswhich skippedUnaryOp. - ASI in arguments split over newlines is not yet supported in Rust (e.g., newline inside
(..., ...)after a comma in a chained call), while Bridge/Selfhost cover ASI for statements and operators.
Proposed minimal steps
-
Unary for PyVM harness:
- Option A (preferred later): extend
emit_mir_json_for_harness[_bin]to export aunopinstruction and add PyVM support. Requires schema change. - Option B (quick): legalize unary
NegtoConst(0); BinOp('-', 0, v)before emitting, by inserting a synthetic temporary. This requires value id minting in emitter to remain self‑consistent, which we currently do not have. So Option B is non‑trivial without changing emitter capabilities. - Decision: keep Bridge JSON v0 path authoritative for unary tests; avoid relying on Rust→PyVM for unary until we add a
unopschema.
- Option A (preferred later): extend
-
ASI inside call arguments (multi‑line):
- Keep as NOT SUPPORTED for Rust parser in Phase‑15. Use single‑line args in tests.
- Selfhost/Bridge side already tolerate semicolons optionally after statements; operator‑continuation is supported in Bridge MVP.
Tracking
- If we want to support unary in the PyVM harness emitter:
- Add
unopto tools/pyvm_runner.py and src/llvm_py/pyvm/vm.py (accept{op:"unop", kind:"neg", src: vid, dst: vid}) - Teach emitters to export
UnaryOpaccordingly (emit_mir_json_for_harness[_bin]).
- Add
Status
- Bridge unary: OK(ny_stage2_bridge_smoke includes unary)
- Rust→PyVM unary: not supported in emitter; will stay out of CI until schema update
- ASI in args over newline: not supported by Rust parser; keep tests single‑line for now