Files
hakorune/tools/ny_roundtrip_smoke.sh
Tomoaki e323120c59 phase15: update CLAUDE.md with Phase 15 enhancements from AGENTS.md
- Add JIT Self-Host Quickstart section for Phase 15
- Include important flags reference (plugins, parsers, debugging)
- Add Codex async workflow documentation for parallel tasks
- Update test execution with Phase 15 smoke tests
- Improve build time notes (JIT vs LLVM)
- Align with current Phase 15 progress and tooling

🎉 Bootstrap (c0→c1→c1') test confirmed working\!

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-05 15:18:13 +09:00

38 lines
1.4 KiB
Bash

#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
ROOT_DIR=$(CDPATH= cd -- "$SCRIPT_DIR/.." && pwd)
BIN="$ROOT_DIR/target/release/nyash"
NY_PARSER="$ROOT_DIR/tools/ny_parser_run.sh"
if [ ! -x "$BIN" ]; then
echo "Building nyash (release)..." >&2
cargo build --release --features cranelift-jit >/dev/null
fi
echo "[Roundtrip] Case A: Ny → JSON(v0) → MIR-Interp (pipe)" >&2
set -o pipefail
# Use a subset-friendly program (no parentheses) compatible with current tokenizer/desugar
printf 'return 1+2*3\n' | "$NY_PARSER" | "$BIN" --ny-parser-pipe > /tmp/nyash-rt-a.out || true
if rg -q '^Result:\s*7\b' /tmp/nyash-rt-a.out; then
echo "PASS: Case A (pipe)" >&2
else
echo "SKIP: Case A (pipe) - parser pipeline not ready; proceeding with Case B" >&2
cat /tmp/nyash-rt-a.out >&2 || true
fi
echo "[Roundtrip] Case B: JSON(v0) file → MIR-Interp" >&2
TMPJSON=$(mktemp)
cat >"$TMPJSON" <<'JSON'
{"version":0,"kind":"Program","body":[{"type":"Return","expr":{"type":"Binary","op":"+","lhs":{"type":"Int","value":1},"rhs":{"type":"Binary","op":"*","lhs":{"type":"Int","value":2},"rhs":{"type":"Int","value":3}}}}]}
JSON
"$BIN" --json-file "$TMPJSON" > /tmp/nyash-rt-b.out
if rg -q '^Result:\s*7\b' /tmp/nyash-rt-b.out; then
echo "PASS: Case B (json-file)" >&2
else
echo "FAIL: Case B (json-file)" >&2; cat /tmp/nyash-rt-b.out; exit 1
fi
echo "All PASS" >&2