feat(anf): Phase 145 P0/P1/P2 - ANF (A-Normal Form) transformation
Implement ANF transformation for impure expressions to fix evaluation order: Phase 145 P0 (Skeleton): - Add anf/ module with contract/plan/execute 3-layer separation - AnfDiagnosticTag, AnfOutOfScopeReason, AnfPlan enums - Stub execute_box (always returns Ok(None)) - 11 unit tests pass Phase 145 P1 (Minimal success): - String.length() whitelist implementation - BinaryOp + MethodCall pattern: x + s.length() → t = s.length(); result = x + t - Exit code 12 verification (VM + LLVM EXE) - 17 unit tests pass Phase 145 P2 (Generalization): - Recursive ANF for compound expressions - Left-to-right, depth-first evaluation order - Patterns: x + s.length() + z, s1.length() + s2.length() - ANF strict mode (HAKO_ANF_STRICT=1) - Diagnostic tags (joinir/anf/*) - 21 unit tests pass, 0 regression Also includes Phase 143 P2 (else symmetry) completion. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@ -46,14 +46,12 @@ Related:
|
||||
- Smoke: VM + LLVM EXE
|
||||
- Out-of-scope は `Ok(None)` のまま
|
||||
|
||||
- **Phase 143-loopvocab P2(planned): else 対応(break/continue 対称化)**
|
||||
- 対象: `if(cond){break}else{continue}` と `if(cond){continue}else{break}` を追加
|
||||
- 実装:
|
||||
- LoopIfExitShape で `has_else=true` + symmetric `then/else_` を許可
|
||||
- Contract で 4パターンを明示(P0: no-else, P1: no-else+continue, P2: with-else)
|
||||
- Fixtures: 2本(対称ケース)
|
||||
- Smoke: VM/LLVM EXE
|
||||
- 完了で「語彙として完成」に寄せる
|
||||
(DONE)Phase 143-loopvocab P2: else 対称化(B-C / C-B)
|
||||
- 記録: `docs/development/current/main/10-Now.md`
|
||||
|
||||
- **Phase 143-loopvocab P3+(planned): impure conditions 対応**
|
||||
- 目的: `if(cond_impure) break/continue` を ANF/順序固定の上で段階投入する
|
||||
- 方針: Phase 145-anf の契約(hoist + left-to-right)を条件式にも適用
|
||||
|
||||
- **real-app loop regression の横展開(VM + LLVM EXE)**
|
||||
- ねらい: 実コード由来ループを 1 本ずつ最小抽出して fixture/smoke で固定する(段階投入)。
|
||||
|
||||
Reference in New Issue
Block a user