BuildBox: env alias/require minimal bundling; selfhost tool: add --mir and docs

- BuildBox.emit_program_json_v0: use BundleResolver via env (HAKO_BUNDLE_ALIAS_TABLE, HAKO_REQUIRE_MODS)
- selfhost_build.sh: add --mir to emit MIR(JSON); document HAKO_USE_BUILDBOX for emit-only path
This commit is contained in:
nyash-codex
2025-11-02 18:48:34 +09:00
parent 0eeae54434
commit cd67911dae
2 changed files with 13 additions and 3 deletions

View File

@ -8,14 +8,17 @@ Script
- tools/selfhost/selfhost_build.sh
- --in <file.hako>: input Hako source
- --json <out.json>: write Program(JSON v0); default: /tmp/hako_stageb_$$.json
- --mir <out.json>: emit MIR(JSON) from source (runner path)
- --exe <out>: build native executable via ny-llvmc (llvmlite harness)
- --run: run via GateC/Core Direct (inproc). Exit code mirrors program return.
- Env:
- NYASH_BIN: path to hakorune/nyash binary (auto-detected)
- NYASH_ROOT: repo root (auto-detected)
- HAKO_USE_BUILDBOX=1: use BuildBox for emit-only (no run/exe)
Examples
```bash
# Emit JSON only
# Emit JSON only (StageB)
tools/selfhost/selfhost_build.sh --in apps/demo/main.hako --json /tmp/demo.json
# Run and use exit code
@ -23,7 +26,6 @@ tools/selfhost/selfhost_build.sh --in apps/demo/return7.hako --run; echo $?
```
Notes
- The script uses StageB entry (lang/src/compiler/entry/compiler_stageb.hako).
- StageB emit uses either the StageB entry or BuildBoxHAKO_USE_BUILDBOX=1 for emit-only
- Runner executes CoreDirect in-proc under HAKO_CORE_DIRECT_INPROC=1.
- For heavier cases (bundles/alias/require), keep StageB canaries optin in quick profile.