Files
hakorune/lang/src/compiler
nyash-codex 4120ab65c9 fix(selfhost): StringBox.get() エラー修正でセルフホスト復活!
StageBDriverBox.compile() と main() 内の2箇所に防御チェック追加:
- methods.get(mi) が null の場合スキップ
- methods.get(mi) が StringBox の場合スキップ (MapBox のみ処理)

これにより "Unknown method 'get' on StringBox" エラーが解消され、
.hako セルフホストコンパイラが再び動作するようになった。

テスト確認:
NYASH_USE_NY_COMPILER=1 ./target/release/hakorune test.hako
→ "Hello from selfhost!" RC: 0 

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-25 09:18:43 +09:00
..

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 in vm/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|off to disable.