2025-09-18 13:35:38 +09:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
set -euo pipefail
|
|
|
|
|
|
|
|
|
|
ROOT=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)
|
|
|
|
|
cd "$ROOT"
|
|
|
|
|
|
|
|
|
|
echo "[selfhost] Build compiler EXE ..." >&2
|
|
|
|
|
timeout -s KILL 10m bash tools/build_compiler_exe.sh --no-pack -o nyc >/dev/null
|
|
|
|
|
|
|
|
|
|
echo "[selfhost] Parse -> JSON (with comments/escapes) ..." >&2
|
2025-11-06 15:41:52 +09:00
|
|
|
cat > tmp/selfhost_src_smoke.hako << 'SRC'
|
2025-09-18 13:35:38 +09:00
|
|
|
// hello
|
|
|
|
|
return (1 + 2*3) // 7
|
|
|
|
|
SRC
|
|
|
|
|
|
2025-11-06 15:41:52 +09:00
|
|
|
./nyc tmp/selfhost_src_smoke.hako > tmp/selfhost_src_smoke.json
|
2025-09-18 13:35:38 +09:00
|
|
|
head -n1 tmp/selfhost_src_smoke.json | rg -q '"kind":"Program"'
|
|
|
|
|
|
|
|
|
|
echo "[selfhost] Execute JSON via PyVM ..." >&2
|
2025-12-10 00:01:53 +09:00
|
|
|
BIN=${NYASH_BIN:-./target/release/hakorune}
|
|
|
|
|
NYASH_VM_USE_PY=1 "$BIN" --backend vm tmp/selfhost_src_smoke.json --json-file >/dev/null 2>&1 || true
|
2025-09-18 13:35:38 +09:00
|
|
|
|
|
|
|
|
echo "✅ selfhost_local OK" >&2
|