Files
hakorune/tools/selfhost/README.md

30 lines
1.1 KiB
Markdown
Raw Normal View History

Hybrid Selfhost Build (80/20)
Purpose
- Provide a minimal, fast path to compile Hako source via Hakorune StageB to Program(JSON v0), and optionally run it via CoreDirect (inproc).
- Future: add MIR emit and ny-llvmc EXE build in small increments.
Script
- tools/selfhost/selfhost_build.sh
- --in <file.hako>: input Hako source
- --json <out.json>: write Program(JSON v0); default: /tmp/hako_stageb_$$.json
- --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)
Examples
```bash
# Emit JSON only
tools/selfhost/selfhost_build.sh --in apps/demo/main.hako --json /tmp/demo.json
# Run and use exit code
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).
- Runner executes CoreDirect in-proc under HAKO_CORE_DIRECT_INPROC=1.
- For heavier cases (bundles/alias/require), keep StageB canaries optin in quick profile.