Files
hakorune/apps/selfhost-compiler
Selfhosting Dev 2720884a20 bridge/json_v0: split expr lowering; add Ternary/Peek lowering + AST; selfhost Peek JSON emit; add selfhost Peek smoke; warning cleanup in lowering/optimizer/verification
- Split expr lowering into ; route calls from stmt lowering
- Implement ternary/peek lowering (MIR13 PHI-off=Copy, PHI-on=Phi)
- Extend JSON v0 AST (ExprV0::{Ternary,Peek}, PeekArmV0)
- Selfhost parser_box: emit Peek JSON; add Stage-2 'Peek basic' smoke
- Reduce warnings: remove unused imports/vars in several modules
- current_task: update plan for legacy VM/Interpreter offboarding
2025-09-17 11:45:57 +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.