feat(joinir): Phase 188 Pattern 1 Core Implementation + Phase 189 Planning
Phase 188 Status: Planning & Foundation Complete (100%) Completed Tasks: ✅ Task 188-1: Error Inventory (5 patterns identified) ✅ Task 188-2: Pattern Classification (3 patterns selected) ✅ Task 188-3: Design (51KB comprehensive blueprint) ✅ Task 188-4: Implementation Foundation (1,802 lines scaffolding) ✅ Task 188-5: Verification & Documentation ✅ Pattern 1 Core Implementation: Detection + Lowering + Routing Pattern 1 Implementation (322 lines): - Pattern Detection: is_simple_while_pattern() in loop_pattern_detection.rs - JoinIR Lowering: lower_simple_while_to_joinir() in simple_while_minimal.rs (219 lines) - Generates 3 functions: entry, loop_step (tail-recursive), k_exit - Implements condition negation: exit_cond = !(i < 3) - Tail-recursive Call pattern with state propagation - Routing: Added "main" to function routing list in control_flow.rs - Build: ✅ SUCCESS (0 errors, 34 warnings) Infrastructure Blocker Identified: - merge_joinir_mir_blocks() only handles single-function JoinIR modules - Pattern 1 generates 3 functions (entry + loop_step + k_exit) - Current implementation only merges first function → loop body never executes - Root cause: control_flow.rs line ~850 takes only .next() function Phase 189 Planning Complete: - Goal: Refactor merge_joinir_mir_blocks() for multi-function support - Strategy: Sequential Merge (Option A) - merge all functions in call order - Effort estimate: 5.5-7.5 hours - Deliverables: README.md (16KB), current-analysis.md (15KB), QUICKSTART.md (5.8KB) Files Modified/Created: - src/mir/loop_pattern_detection.rs (+50 lines) - Pattern detection - src/mir/join_ir/lowering/simple_while_minimal.rs (+219 lines) - Lowering - src/mir/join_ir/lowering/loop_patterns.rs (+803 lines) - Foundation skeleton - src/mir/join_ir/lowering/mod.rs (+2 lines) - Module registration - src/mir/builder/control_flow.rs (+1 line) - Routing fix - src/mir/builder/loop_frontend_binding.rs (+20 lines) - Binding updates - tools/test_phase188_foundation.sh (executable) - Foundation verification - CURRENT_TASK.md (updated) - Phase 188/189 status Next: Phase 189 implementation (merge_joinir_mir_blocks refactor) 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
74
tools/test_joinir_freeze_inventory.sh
Normal file
74
tools/test_joinir_freeze_inventory.sh
Normal file
@ -0,0 +1,74 @@
|
||||
#!/bin/bash
|
||||
# Phase 188 Task 188-1: Collect [joinir/freeze] error inventory
|
||||
# Run loop tests with JoinIR-only configuration (no LoopBuilder fallback)
|
||||
|
||||
set -e
|
||||
|
||||
HAKORUNE_BIN="./target/release/hakorune"
|
||||
|
||||
# Check if hakorune binary exists
|
||||
if [ ! -f "$HAKORUNE_BIN" ]; then
|
||||
echo "Error: $HAKORUNE_BIN not found. Run 'cargo build --release' first."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# JoinIR-only configuration
|
||||
export NYASH_JOINIR_CORE=1
|
||||
export NYASH_LEGACY_LOOPBUILDER=0
|
||||
export NYASH_DISABLE_PLUGINS=1
|
||||
|
||||
# Test files
|
||||
TEST_FILES=(
|
||||
"apps/tests/joinir_if_merge_multiple.hako"
|
||||
"apps/tests/joinir_if_merge_simple.hako"
|
||||
"apps/tests/joinir_if_select_local.hako"
|
||||
"apps/tests/joinir_if_select_simple.hako"
|
||||
"apps/tests/joinir_min_loop.hako"
|
||||
"apps/tests/loop_if_phi.hako"
|
||||
"apps/tests/loop_if_phi_continue.hako"
|
||||
"apps/tests/loop_min_while.hako"
|
||||
"apps/tests/loop_phi_one_sided.hako"
|
||||
)
|
||||
|
||||
echo "=========================================="
|
||||
echo "Phase 188 Task 188-1: JoinIR Error Inventory"
|
||||
echo "Configuration:"
|
||||
echo " NYASH_JOINIR_CORE=1"
|
||||
echo " NYASH_LEGACY_LOOPBUILDER=0"
|
||||
echo " NYASH_DISABLE_PLUGINS=1"
|
||||
echo "=========================================="
|
||||
echo ""
|
||||
|
||||
TOTAL=0
|
||||
FAILED=0
|
||||
PASSED=0
|
||||
|
||||
for test_file in "${TEST_FILES[@]}"; do
|
||||
TOTAL=$((TOTAL + 1))
|
||||
echo "----------------------------------------"
|
||||
echo "[$TOTAL] Testing: $test_file"
|
||||
echo "----------------------------------------"
|
||||
|
||||
if [ ! -f "$test_file" ]; then
|
||||
echo "SKIP: File not found"
|
||||
echo ""
|
||||
continue
|
||||
fi
|
||||
|
||||
# Run test and capture both stdout and stderr
|
||||
if "$HAKORUNE_BIN" "$test_file" 2>&1; then
|
||||
echo "PASS"
|
||||
PASSED=$((PASSED + 1))
|
||||
else
|
||||
echo "FAIL (exit code: $?)"
|
||||
FAILED=$((FAILED + 1))
|
||||
fi
|
||||
echo ""
|
||||
done
|
||||
|
||||
echo "=========================================="
|
||||
echo "Summary:"
|
||||
echo " Total: $TOTAL"
|
||||
echo " Passed: $PASSED"
|
||||
echo " Failed: $FAILED"
|
||||
echo "=========================================="
|
||||
Reference in New Issue
Block a user