Files
hakorune/apps/selfhost-compiler
nyash-codex dd65cf7e4c builder+vm: unify method calls via emit_unified_call; add RouterPolicy trace; finalize LocalSSA/BlockSchedule guards; docs + selfhost quickstart
- Unify standard method calls to emit_unified_call; route via RouterPolicy and apply rewrite::{special,known} at a single entry.\n- Stabilize emit-time invariants: LocalSSA finalize + BlockSchedule PHI→Copy→Call ordering; metadata propagation on copies.\n- Known rewrite default ON (userbox only, strict guards) with opt-out flag NYASH_REWRITE_KNOWN_DEFAULT=0.\n- Expand TypeAnnotation whitelist (is_digit_char/is_hex_digit_char/is_alpha_char/Map.has).\n- Docs: unified-method-resolution design note; Quick Reference normalization note; selfhosting/quickstart.\n- Tools: add tools/selfhost_smoke.sh (dev-only).\n- Keep behavior unchanged for Unknown/core/user-instance via BoxCall fallback; all tests green (quick/integration).
2025-09-28 20:38:09 +09:00
..

Nyash Selfhost Compiler (MVP scaffold)

This is the Phase 15.3 work-in-progress Nyash compiler implemented in Ny.

Layout

  • compiler.nyash: entry (CompilerBox). Reads tmp/ny_parser_input.ny, prints JSON v0.
  • parser/: lexer/parser/ast (scaffolds; to be filled as we extend Stage2)
  • mir/: builder/optimizer stubs (future; current target is JSON v0 emit)
  • tests/: Stage1/2 samples (TBD)

Run (behind flag)

  • NYASH_USE_NY_COMPILER=1 target/release/nyash --backend vm <program.nyash>
    • The runner writes the input to tmp/ny_parser_input.ny and invokes this program.
    • It captures a JSON v0 line from stdout and executes it via the JSON bridge.
    • Stage3 syntax gate: set NYASH_NY_COMPILER_STAGE3=1 to pass --stage3 to the parser (accepts Break/Continue/Throw/Try in JSON v0).

Notes

  • Early MVP emits a minimal JSON v0 (currently a placeholder: return 0). We will gradually wire lexer/parser/emitter.
  • Keep JSON v0 spec in docs/reference/ir/json_v0.md.