feat(mir/llvm): Phase 273 P0-P1 DomainPlan→CorePlan + LLVM arg fix

Phase 273 P0-P1: Two-layer plan architecture
- DomainPlan: Pattern-specific knowledge (ScanWithInit)
- CorePlan: Fixed vocabulary (Seq, Loop, If, Effect, Exit)
- ValueId references only (String expressions forbidden)
- Pipeline: Extractor→Normalizer→Verifier→Lowerer

New plan/ module:
- mod.rs: Type definitions, SSOT spec
- normalizer.rs: DomainPlan→CorePlan + ID allocation
- verifier.rs: V1-V6 invariant checks (fail-fast)
- lowerer.rs: CorePlan→MIR (pattern-agnostic)

LLVM fix (ChatGPT):
- function_lower.py: Fix argument reference bug
- Phase 258 index_of_string now PASS on LLVM backend

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2025-12-22 22:42:56 +09:00
parent f07c2e7874
commit 960241795d
20 changed files with 1728 additions and 388 deletions

View File

@ -2,18 +2,25 @@
# Phase 258 P0: index_of_string (dynamic needle) - LLVM backend
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../../../../../.." && pwd)"
HAKORUNE_BIN="${HAKORUNE_BIN:-$PROJECT_ROOT/target/release/hakorune}"
HAKO_PATH="apps/tests/phase258_p0_index_of_string_min.hako"
# Test: "hello world".index_of_string("world") → 6
EXPECTED_EXIT=6
NYASH_LLVM_USE_HARNESS=1 $HAKORUNE_BIN --backend llvm "$HAKO_PATH"
set +e
NYASH_LLVM_USE_HARNESS=1 "$HAKORUNE_BIN" --backend llvm "$PROJECT_ROOT/$HAKO_PATH"
actual_exit=$?
set -e
if [[ $actual_exit -eq $EXPECTED_EXIT ]]; then
echo "✅ phase258_p0_index_of_string_llvm_exe: PASS (exit=$actual_exit)"
exit 0
else
echo "❌ phase258_p0_index_of_string_llvm_exe: FAIL (expected=$EXPECTED_EXIT, got=$actual_exit)"
echo " Hint: build LLVM harness via: cargo build --release --features llvm"
exit 1
fi