Files
hakorune/tools/selfhost/gen_v1_min.sh
nyash-codex 97a776aac3 feat(phase73): Stage-3 ENV consolidation complete - Shell scripts
Phase 73-B: Unified legacy Stage-3 environment variables in 27 shell scripts:
- Replaced NYASH_PARSER_STAGE3=1 → NYASH_FEATURES=stage3
- Replaced HAKO_PARSER_STAGE3=1 → NYASH_FEATURES=stage3
- Updated all variant patterns (with/without assignments)

Files modified (27 total):
- tools/dev/*.sh (9 files)
- tools/dev_stageb.sh, dump_stageb_min_mir.sh, hakorune_emit_mir.sh
- tools/joinir_ab_test.sh, ny_selfhost_inline.sh
- tools/perf/*.sh, tools/selfhost/*.sh (9 files)
- tools/hako_check/dot_edges_smoke.sh, tools/selfhost_smoke.sh

Complete Phase 73 consolidation count:
- Phase 73-A: 20 test files + 2 special files (stage3 compat)
- Phase 73-B: 27 shell script files
- Total: 49 files with legacy Stage-3 ENV consolidated

Next: Phase 72 (JoinIR EXPERIMENT SSOT consolidation)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 12:38:01 +09:00

45 lines
1.5 KiB
Bash
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env bash
set -euo pipefail
# gen_v1_min.sh — 最小の v1 JSON 生成MinMirEmitter を Hako で呼ぶ)
# 標準出力に v1 JSON を出す。
ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
NYASH_BIN="${NYASH_BIN:-}"
if [ -z "$NYASH_BIN" ]; then
if [ -x "$ROOT/target/release/hakorune" ]; then
NYASH_BIN="$ROOT/target/release/hakorune"
else
NYASH_BIN="$ROOT/target/release/nyash"
fi
fi
if [ ! -x "$NYASH_BIN" ]; then
echo "[FAIL] nyash/hakorune not found; build first: cargo build --release" >&2
exit 2
fi
CODE='include "lang/src/mir/min_emitter.hako"
static box Main { method main(args) {
local j = MinMirEmitter.emit_if_gt_i64(3,5)
print(j)
return 0
} }'
tmp="/tmp/gen_v1_min_$$.nyash"; echo "$CODE" > "$tmp"
pref="/tmp/gen_v1_min_pre_$$.nyash"
# Text preinclude.hako using を安全に統合)
if [ -x "$ROOT/tools/dev/hako_preinclude.sh" ]; then
"$ROOT/tools/dev/hako_preinclude.sh" "$tmp" "$pref" >/dev/null || cp "$tmp" "$pref"
else
cp "$tmp" "$pref"
fi
# Remove optional helper using that is not needed for inline run and may not resolve in VM path
sed -i '/using selfhost\.shared\.common\.entry_point_base/d' "$pref" 2>/dev/null || true
# できるだけ静かに実行して JSON のみを出力
NYASH_ROOT="$ROOT" NYASH_ENTRY_ALLOW_TOPLEVEL_MAIN=1 \
NYASH_FEATURES=stage3 NYASH_FEATURES=stage3 NYASH_PARSER_ALLOW_SEMICOLON=1 \
NYASH_DISABLE_NY_COMPILER=1 HAKO_DISABLE_NY_COMPILER=1 NYASH_USING_AST=0 \
"$NYASH_BIN" --backend vm "$pref" 2>/dev/null | tr -d '\r'
rm -f "$tmp" "$pref" 2>/dev/null || true