Phase 20.33: migrate docs to lang compiler entry; add Bridge canonicalize canary skeletons (opt-in); dep_tree.sh fail-fast legacy path; Gate-C OOB strict already present

This commit is contained in:
nyash-codex
2025-11-01 19:01:55 +09:00
parent f1a35be9f2
commit 756af0da6c
6 changed files with 125 additions and 30 deletions

View File

@ -2,16 +2,17 @@
This note shows how to run the Nyash selfhost compiler MVP to emit MIR(JSON v0) and execute it with the current VM line. The flow keeps defaults unchanged and uses small, optin flags for development.
## Layout
- Compiler MVP: `apps/selfhost-compiler/compiler.nyash`
- Runtime helpers (dev): `apps/selfhost-runtime/`
- MiniVM samples (dev): `apps/selfhost/vm/`
## Layout (migrated)
- Compiler entry (StageB): `lang/src/compiler/entry/compiler_stageb.hako`
- Compiler entry (compat, StageA/AOT): `lang/src/compiler/entry/compiler.hako`
- Shared helpers live under `lang/src/shared/`
- VM/Core live under `lang/src/vm/`
## Run the selfhost compiler
Compile a minimal program (string embedded in the compiler) and print JSON:
Compile a minimal program (string embedded in the compiler) and print JSON v0:
```
./target/release/nyash apps/selfhost-compiler/compiler.nyash -- --stage3
./target/release/nyash lang/src/compiler/entry/compiler_stageb.hako -- --stage3 --source 'box Main { static method main() { return 7 } }'
```
ENV → child args (透過):
@ -22,8 +23,8 @@ ENV → child args (透過):
Examples:
```
NYASH_NY_COMPILER_MIN_JSON=1 ./target/release/nyash apps/selfhost-compiler/compiler.nyash -- --stage3 > /tmp/out.json
NYASH_SELFHOST_READ_TMP=1 ./target/release/nyash apps/selfhost-compiler/compiler.nyash -- --min-json --stage3
NYASH_NY_COMPILER_MIN_JSON=1 ./target/release/nyash lang/src/compiler/entry/compiler_stageb.hako -- --stage3 --source 'box Main { static method main() { return 1+2 } }' > /tmp/out.json
NYASH_SELFHOST_READ_TMP=1 ./target/release/nyash lang/src/compiler/entry/compiler_stageb.hako -- --min-json --stage3
```
## Execute MIR(JSON v0)