.hakoコンパイラにExit PHI生成機能を実装(将来の本命実装) 実装ファイル(585行): - break_finder.hako (~250行): break文検出 - phi_injector.hako (~280行): PHI命令生成・挿入 - loopssa.hako (更新): BreakFinder/PhiInjector統合 - README.md: アーキテクチャ説明・使用方法 設計: - 箱化・モジュール化(3Box分離) - JSON文字列→文字列処理 - HAKO_LOOPSSA_EXIT_PHI=1 で有効化 重要な発見: - Exit PHI生成はMIRレベルで行うべき(JSON v0では情報不足) - 現在のTest 2エラーはRust MIRビルダーのバグ - .hako実装は将来のリファレンス・Phase 25.1f用に温存 次のステップ: - Rust側 loopform_builder.rs のphi pred mismatchバグ修正 - .hakoへの完全移行はPhase 25.1e後半〜25.1f 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Hakorune Compiler — Layout and Responsibilities
Structure (target)
- emit/
- mir_emitter_box.hako — high-level MIR emitter entry
- common/ — shared emit helpers (mir_emit/json_emit/call_emit/header_emit/newbox_emit)
- parser/ — lexer/parser (to be moved from apps/* in later steps)
- builder/, ssa/, rewrite/, pipeline_v2/ — existing compiler stages (move gradually)
Policy
- Compiler lives under
lang/src/compiler/. - VM engines live under
lang/src/vm/engines/(Hakorune/Mini), with shared helpers invm/boxes/. - Keep imports across these boundaries minimal and documented.
Grammar Notes (parser parity)
- Semicolons are accepted as optional statement separators (default ON).
- Both newline and
;delimit statements; trailing};is allowed. - Consecutive
;;are treated as empty statements (no-op). - Env toggle (opt-out): set
NYASH_PARSER_ALLOW_SEMICOLON=0|false|offto disable.
- Both newline and