Files
hakorune/CURRENT_TASK.md
tomoaki 6a3b6deb20 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>
2025-12-19 16:19:49 +09:00

2.6 KiB
Raw Blame History

CURRENT_TASK (moved)

Status: SSOT
Scope: Repo root の旧リンク互換。現行の入口は docs/development/current/main/10-Now.md

  • Now: docs/development/current/main/10-Now.md
  • Backlog: docs/development/current/main/30-Backlog.md

Handoff (current)

状況SSOT

  • 現行の入口: docs/development/current/main/10-Now.md
  • 次の候補: docs/development/current/main/30-Backlog.md

直近の道筋JoinIR / Normalized

  • Phase 139: if-only post_k の return lowering を ReturnValueLowererBox に統一DONE
    • docs/development/current/main/phases/phase-139/README.md
  • Phase 140: NormalizedExprLowererBox 初版pure expression のみDONE
    • SSOT: docs/development/current/main/design/normalized-expr-lowering.md
    • docs/development/current/main/phases/phase-140/README.md
  • Phase 141 P0: impure 拡張点contractを SSOT 化Call/MethodCall はまだ out-of-scopeDONE
    • docs/development/current/main/phases/phase-141/README.md
  • Phase 141 P1: “既知 intrinsic だけ” を許可して段階投入DONE
    • docs/development/current/main/phases/phase-141/README.md
  • Phase 141 P1.5: known intrinsic registry + available_inputs 3-source merge + diagnosticsDONE
    • docs/development/current/main/phases/phase-141/README.md
  • Phase 142-loopstmt P0: 正規化単位を statementloop 1個へ寄せるDONE
    • docs/development/current/main/phases/phase-142-loopstmt/README.md
  • Phase 142-loopstmt P1: LLVM EXE smoke同 fixtureを追加DONE
    • docs/development/current/main/phases/phase-142-loopstmt/README.md
  • Phase 141 P2+: Call/MethodCalleffects + typingを分離して段階投入
    • Historical context: docs/development/current/main/investigations/joinir-generalization-study.md
  • Phase 143-loopvocab P0/P1: loop 内 if/break/continue の語彙追加DONE
    • docs/development/current/main/phases/phase-143-loopvocab/README.md
  • Phase 143-loopvocab P2: else 対称化B-C / C-BDONE
    • docs/development/current/main/phases/phase-143-loopvocab/README.md
  • Phase 145-anf P0/P1/P2: ANFimpure hoist + 再帰的線形化DONE
    • docs/development/current/main/phases/phase-145-anf/README.md

Resolved (historical)

WSL EXDEV / cargo build failure (resolved)

  • 2025-12-18: Invalid cross-device link (os error 18) により cargo build が失敗する事象があったが、wsl --shutdown 再起動後に復旧。
  • 再発時のワークアラウンド: tools/build_llvm.sh は EXDEV を避けるため TMPDIRtarget/... 配下へ寄せる。