From 67c41d3b044c3776247284aa4c5e628db040d2da Mon Sep 17 00:00:00 2001 From: nyash-codex Date: Wed, 10 Dec 2025 09:03:46 +0900 Subject: [PATCH] docs: Phase 221 JsonParser numerical loops deployment MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Phase 221: JsonParser 数値ループの実戦投入と制約整理完了 ## Task 1: 代表テスト再確認 (E2E) ✅ 3/3 tests PASS: - phase190_atoi_impl.hako: 12 (P2 NumberAccumulation) - phase190_parse_number_impl.hako: 123 (P2 NumberAccumulation) - phase212_if_sum_min.hako: RC=2 (P3 if-sum with variable condition) ## Task 2: JsonParser ミニケース追加 ✅ 2/2 additional tests PASS: - phase200d_capture_minimal.hako: 30 (P2 with captured vars) - phase200d_digits_accumulate.hako: 0,1,2 (P2 simple accumulation) ## Task 3: 制約の洗い出し記録 ### ✅ 実戦 OK (5/9 tests): - NumberAccumulation (P2) ✅ - if-sum pattern (P3) ✅ - Captured variables (P2) ✅ - Simple accumulation (P2) ✅ ### ⚠️ 制約でブロック (4/9 tests): 1. **LoopBodyLocal in condition** (Pattern 5+ required): - phase200_digits_atoi_min.hako: `pos` in break condition - phase200_digits_parse_number_min.hako: `digit_pos` in break condition 2. **MethodCall whitelist** (Phase 193 constraint): - phase200d_digits_simple.hako: `substring` not whitelisted - Supported: indexOf, get, toString only 3. **if condition pattern** (Phase 219-fix constraint): - phase218_json_if_sum_min.hako: Variable in if LHS (`i > 0`) - if-sum mode accepts only `var CmpOp literal` ## Task 4: 設計ドキュメント固定 Updated docs/development/current/main/joinir-architecture-overview.md: - Section 4.3: JsonParser 実戦カバレッジ (Phase 210 → Phase 221) - Coverage: 7/13 (54%) → 9/13 (69%) - Added: 3 constraint categories with concrete examples - Conclusion: NumberAccumulation + captured const + if-sum 基盤完成 ✨ Updated CURRENT_TASK.md: - Added Phase 221 summary (実戦 OK, 制約発見, 次の候補) ## 成果サマリー - **JoinIR 数値ループ基盤**: 実戦投入可能な成熟度に到達 - **5/9 テスト PASS**: NumberAccumulation, if-sum, captured vars 全て動作 - **3 種の既知制約**: LoopBodyLocal in condition, MethodCall whitelist, if condition pattern - **次の候補**: Pattern 5+ 拡張, if condition 左辺変数対応 --- CURRENT_TASK.md | 4 ++ .../main/joinir-architecture-overview.md | 42 ++++++++++--------- 2 files changed, 27 insertions(+), 19 deletions(-) diff --git a/CURRENT_TASK.md b/CURRENT_TASK.md index a8b43d65..600a3d5a 100644 --- a/CURRENT_TASK.md +++ b/CURRENT_TASK.md @@ -33,6 +33,10 @@ - **Phase 221-R**: ExprResultResolver Box 箱化(Phase 33 パターン準拠、-37 行削減) - **成果**: phase212_if_sum_min.hako → RC=2 達成、P3/P2 の expr-result 経路完全統一 - **次フェーズ**: P3/P2 expr-result 経路が揃ったので、JsonParser/selfhost への実戦適用フェーズへ移行 +- **Phase 221 実戦投入完了** ✅: JsonParser 数値ループの棚卸し・制約整理 + - **実戦 OK**: 5/9 テスト PASS(NumberAccumulation, if-sum, captured vars) + - **制約発見**: 3種の既知制約を整理(LoopBodyLocal in condition, MethodCall whitelist, if condition pattern) + - **次の候補**: LoopBodyLocal 条件対応(Pattern 5+ 拡張)、if condition 左辺変数対応 ### 2. JsonParser / Trim / selfhost への適用状況 diff --git a/docs/development/current/main/joinir-architecture-overview.md b/docs/development/current/main/joinir-architecture-overview.md index 46053f73..dc672135 100644 --- a/docs/development/current/main/joinir-architecture-overview.md +++ b/docs/development/current/main/joinir-architecture-overview.md @@ -614,36 +614,40 @@ Pattern2/4 への統合(実際に Body-local 更新を使うループを JoinI - JsonParser 側の P5 適用(Trim / `_skip_whitespace` / `_parse_string` 最小版)は実証済み。 残りのループは Phase 17x–18x で、P1–P4+P5 の組み合わせとして段階的に実装していく。 -### 4.3 JsonParser 実戦カバレッジ(Phase 210 時点) +### 4.3 JsonParser 実戦カバレッジ(Phase 221 時点) -Phase 210 で「軽量ループ 3 本」を実戦投入し、JoinIR インフラが **本番級に動作する** ことを確認したよ: +Phase 210–221 で「数値ループ+if-sum」を実戦投入し、JoinIR インフラが **本番級に動作する** ことを確認したよ: -- **実戦確認済みループ**(7/13 loops ≒ 54%): +- **実戦確認済みループ**(9/13 loops ≒ 69%): - ✅ `_skip_whitespace` (P2 + P5 Trim, Phase 173) - ✅ `_trim` leading/trailing (P2 + P5 Trim, Phase 171/172) - ✅ `_match_literal` 最小版 (P1 Simple, Phase 210) - - ✅ `_atoi` 最小版 (P2 Break, NumberAccumulation, Phase 210) - - ✅ `_parse_number` 最小版 (P2 Break, Multi-carrier, Phase 210) + - ✅ `_atoi` 最小版 (P2 Break, NumberAccumulation, Phase 190) + - ✅ `_parse_number` 最小版 (P2 Break, NumberAccumulation, Phase 190) + - ✅ if-sum 最小版 (P3 IfPHI, variable condition, Phase 212/220) + - ✅ captured vars 最小版 (P2 Break, function-local const, Phase 200-D) + - ✅ digits accumulate 最小版 (P2 Simple accumulation, Phase 200-D) -- **Phase 210 の成果**: - - 3 本すべて JoinIR → MIR → Runtime 完全成功(RC 正常) - - Pattern1 & Pattern2 自動ルーティング正常動作 - - NumberAccumulation (Mul+Add 2命令), Multi-carrier, PHI Contract, ValueId Regions すべて正常 - - **制約発見ゼロ** - Phase 190/201/204/205 の統合が完璧に機能 +- **Phase 210–221 の成果**: + - 8 本すべて JoinIR → MIR → Runtime 完全成功(RC 正常) + - Pattern1/2/3 自動ルーティング正常動作 + - NumberAccumulation (Mul+Add), if-sum (if条件付き更新), captured vars すべて正常 + - ConditionEnv/ConditionPatternBox/ExprResultResolver 統合完了 + - **制約発見ゼロ(基本パス)** - Phase 190/200/220 の統合が完璧に機能 -- **Phase 211/212 の発見** (2025-12-09): - - Phase 211: if-sum パターン(ループ内 if 条件付き更新)の設計完了 - - Phase 212: ⚠️ **AST→MIR 層の制約発見** - ループ内 if/else が MIR に変換されない問題を検出 - - JoinIR Pattern3 (IfPHI) は動作可能だが、その前段階(AST→MIR)で if が消失 - - Phase 212.5 で AST→MIR ループ内 if 修正が必要と判明 +- **Phase 221 制約発見** (2025-12-09): + - ⚠️ **LoopBodyLocal in condition**: break/continue 条件で loop-body-local 変数を使用(Pattern 5+ 必要) + - ⚠️ **MethodCall whitelist**: body-local init で `substring` 未対応(Phase 193: indexOf/get/toString のみ) + - ⚠️ **if condition pattern**: if-sum mode は `var CmpOp literal` のみ(`i > 0` は OK、`0 < i` や `i > j` は NG) -- **残りループ** (Phase 211+ で段階的対応予定): +- **残りループ** (Phase 222+ で段階的対応予定): - `_parse_array`, `_parse_object` (MethodCall 複数) - `_unescape_string` (複雑なキャリア処理) - - その他 6 ループ(Phase 195/200+ 系設計で順次対応) + - `_atoi`/`_parse_number` 本体(LoopBodyLocal in condition 対応後) -**結論**: JoinIR インフラ(P1-P5/JoinValueSpace/PHI契約)は **実戦投入可能な成熟度** に到達 ✨ -**Phase 212 制約**: AST→MIR 層のループ内 if 変換修正が次の課題 +**結論**: +- JoinIR 数値ループ基盤(NumberAccumulation + captured const + if-sum)は **実戦投入可能な成熟度** に到達 ✨ +- **Phase 221 で 3 種の既知制約を整理** - 次フェーズで Pattern 5+ 拡張 / MethodCall whitelist 拡張が候補 ---