Phase 2: TypeOp変換の一本化(Optimizer安全ネット削除)\nPhase 3: 可視化/スナップショット基盤(--mir-verbose-effects, snapshot/compare/ci_check)\nDocs: Phase 1/2 完了マーク・利用方法追記

This commit is contained in:
Moe Charm
2025-08-24 01:58:41 +09:00
parent 3c3dc86be0
commit 0aef8d49a7
19 changed files with 835 additions and 132 deletions

29
tools/compare_mir.sh Normal file
View File

@ -0,0 +1,29 @@
#!/usr/bin/env bash
set -euo pipefail
if [ "$#" -ne 2 ]; then
echo "Usage: $0 <input.nyash> <golden.mir.txt>" >&2
exit 2
fi
INPUT="$1"
GOLDEN="$2"
TMPDIR="${TMPDIR:-/tmp}"
OUT="$TMPDIR/mir_snapshot_$$.txt"
trap 'rm -f "$OUT"' EXIT
# Allow effect annotation opt-in via env var
if [ -n "${NYASH_MIR_VERBOSE_EFFECTS:-}" ]; then
NYASH_MIR_VERBOSE_EFFECTS=1 ./tools/snapshot_mir.sh "$INPUT" "$OUT" >/dev/null
else
./tools/snapshot_mir.sh "$INPUT" "$OUT" >/dev/null
fi
if ! diff -u "$GOLDEN" "$OUT"; then
echo "MIR snapshot differs from golden: $GOLDEN" >&2
exit 1
fi
echo "MIR matches golden: $GOLDEN"