Files
hakorune/tools/exe_first_smoke.sh
nyash-codex d7805e5974 feat(joinir): Phase 213-2 Step 2-2 & 2-3 Data structure extensions
Extended PatternPipelineContext and CarrierUpdateInfo for Pattern 3 AST-based generalization.

Changes:
1. PatternPipelineContext:
   - Added loop_condition: Option<ASTNode>
   - Added loop_body: Option<Vec<ASTNode>>
   - Added loop_update_summary: Option<LoopUpdateSummary>
   - Updated build_pattern_context() for Pattern 3

2. CarrierUpdateInfo:
   - Added then_expr: Option<ASTNode>
   - Added else_expr: Option<ASTNode>
   - Updated analyze_loop_updates() with None defaults

Status: Phase 213-2 Steps 2-2 & 2-3 complete
Next: Create Pattern3IfAnalyzer to extract if statement and populate update summary
2025-12-10 00:01:53 +09:00

43 lines
1.3 KiB
Bash

#!/usr/bin/env bash
# EXE-first smoke: build the selfhost parser EXE and run a tiny program end-to-end.
set -euo pipefail
if [[ "${NYASH_CLI_VERBOSE:-0}" == "1" ]]; then set -x; fi
ROOT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd)
cd "$ROOT_DIR"
echo "[1/4] Building parser EXE bundle ..."
tools/build_compiler_exe.sh >/dev/null
echo "[2/4] Preparing sample source ..."
mkdir -p dist/nyash_compiler/tmp
echo 'return 1+2*3' > dist/nyash_compiler/tmp/sample_exe_smoke.hako
echo "[3/4] Running parser EXE → JSON ..."
(cd dist/nyash_compiler && timeout -s KILL 60s ./nyash_compiler tmp/sample_exe_smoke.hako > sample.json)
echo "[3.5/4] Validating JSON schema ..."
python3 tools/validate_mir_json.py dist/nyash_compiler/sample.json
if ! head -n1 dist/nyash_compiler/sample.json | grep -q '"kind":"Program"'; then
echo "error: JSON does not look like a Program" >&2
exit 2
fi
echo "[4/4] Executing via bridge (pipe) to verify semantics ..."
# Keep core minimal and deterministic
export NYASH_DISABLE_PLUGINS=1
BIN=${NYASH_BIN:-./target/release/hakorune}
set +e
timeout -s KILL 60s bash -c "cat dist/nyash_compiler/sample.json | ${BIN} --ny-parser-pipe --backend vm >/dev/null"
RC=$?
set -e
if [[ "$RC" -ne 7 ]]; then
echo "error: expected exit code 7, got $RC" >&2
exit 3
fi
echo "✅ EXE-first smoke passed (parser EXE + bridge run)"
exit 0