feat(joinir): Phase 248 - Normalized JoinIR infrastructure
Major refactoring of JoinIR normalization pipeline: Key changes: - Structured→Normalized→MIR(direct) pipeline established - ShapeGuard enhanced with Pattern2 loop validation - dev_env.rs: New development fixtures and env control - fixtures.rs: jsonparser_parse_number_real fixture - normalized_bridge/direct.rs: Direct MIR generation from Normalized - pattern2_step_schedule.rs: Extracted step scheduling logic Files changed: - normalized.rs: Enhanced NormalizedJoinModule with DevEnv support - shape_guard.rs: Pattern2-specific validation (+300 lines) - normalized_bridge.rs: Unified bridge with direct path - loop_with_break_minimal.rs: Integrated step scheduling - Deleted: step_schedule.rs (moved to pattern2_step_schedule.rs) New files: - param_guess.rs: Loop parameter inference - pattern2_step_schedule.rs: Step scheduling for Pattern2 - phase43-norm-canon-p2-mid.md: Design doc Tests: 937/937 PASS (+6 from baseline 931) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@ -1,5 +1,8 @@
|
||||
# Phase 181: JsonParser 残りループ設計調査
|
||||
|
||||
Status: Historical + Updated in Phase 42
|
||||
Note: Phase 181 時点の設計調査に基づくドキュメントだよ。最新の P2 分類と JoinIR/Normalized 状態は、このファイル内の「Phase 42 時点の P2 インベントリ」と `joinir-architecture-overview.md` を SSOT として見てね。
|
||||
|
||||
## 概要
|
||||
|
||||
JsonParser(`tools/hako_shared/json_parser.hako`)の全11ループを詳細に分析し、
|
||||
@ -201,6 +204,34 @@ loop(i < len) {
|
||||
|
||||
**実行可能性**: ✅ Phase 182+ で実装可能(Pattern2 Break、_atoi の後継)
|
||||
|
||||
## Phase 42 時点の P2 インベントリ(JsonParser)
|
||||
|
||||
Phase 42 では、上の 11 ループについて「P2 としてどこまで JoinIR / Normalized で扱えているか」を棚卸しして、P2-Core / P2-Mid / P2-Heavy の 3 クラスに整理したよ。
|
||||
|
||||
### 1. 分類ポリシー
|
||||
|
||||
- **P2-Core**: 既に Normalized→MIR(direct) まで実装され、Phase 41 で canonical route(既定経路)として扱っているループ群。
|
||||
- **P2-Mid**: JoinIR(Structured) には載っているが、Normalized はこれから本格対応する「次候補」のループ群。
|
||||
- **P2-Heavy**: MethodCall 多数・複雑キャリアなどの理由で、Normalized 対応は Phase 43 以降に送っている重めのループ群。
|
||||
|
||||
### 2. JsonParser ループの現在ステータス(2025‑12 時点)
|
||||
|
||||
| # | ループ | Pattern | P2 クラス | JoinIR 状態 | Normalized 状態 | 備考 |
|
||||
|----|--------|---------|-----------|-------------|-----------------|------|
|
||||
| 1 | _skip_whitespace | P2 / P5 Trim | P2-Core | ✅ JoinIR OK(Phase 173, 197, 245 系) | ✅ Normalized→MIR(direct) / canonical(Phase 37, 41) | mini / real の両方をフィクスチャ化して dev / canonical で比較済み |
|
||||
| 2 | _trim (leading) | P2 / P5 Trim | P2-Heavy | ✅ JoinIR OK(TrimLoopHelper 経由) | 未対応(P5 専用経路のまま) | Trim/P5 専用 lowerer で処理。Normalized 対応は将来検討 |
|
||||
| 3 | _trim (trailing) | P2 / P5 Trim | P2-Heavy | ✅ JoinIR OK | 未対応 | leading と同様に Trim/P5 ラインで運用 |
|
||||
| 4 | _parse_number | P2 Break | P2-Mid | ✅ JoinIR OK(Phase 245-EX) | ✅ dev Normalized→MIR(direct)(Phase 43-C、フィクスチャ `jsonparser_parse_number_real`。num_str は現状仕様のまま据え置き) | header/break/p 更新は JoinIR 経路に載せ済み。数値正規化は Phase 43 以降で拡張予定 |
|
||||
| 5 | _parse_string | P2/P4 | P2-Heavy | 部分的に JoinIR 対応(Pattern3/4 拡張後に対象) | 未対応 | return/continue・複数キャリアを含むため heavy クラス扱い |
|
||||
| 6 | _atoi | P2 Break | P2-Mid | ✅ JoinIR OK(Phase 246-EX) | ✅ dev Normalized→MIR(direct)(mini + 本体符号あり/なし、Phase 43-A) | P2-Core には `_atoi` mini fixture が入っている。本体は Phase 43 以降で canonical 化予定 |
|
||||
| 7 | _match_literal | P1 Simple | (P1) | ✅ JoinIR OK | Normalized 対応は P1 ラインで別途管理 | P1 simple なので P2 クラス分類の対象外。Phase 197 で JoinIR E2E 検証済み |
|
||||
| 8 | _parse_array | P4 Continue | P2-Heavy | ⚠️ Deferred(複数 MethodCall) | 未対応 | continue + MethodCall 多数のため heavy クラス。ConditionEnv/MethodCall 拡張後に扱う |
|
||||
| 9 | _parse_object | P4 Continue | P2-Heavy | ⚠️ Deferred | 未対応 | _parse_array と同種の heavy ループ |
|
||||
| 10 | _unescape_string | P4 Continue | P2-Heavy | ⚠️ Deferred | 未対応 | 複数キャリア + flatten を含む。Pattern3/4 拡張後の対象 |
|
||||
| 11 | _atof_loop | P2 Break | P2-Mid | JoinIR 対応候補(_atoi と同型) | 未対応 | `_atoi` 後継として P2-Mid 候補に分類。Phase 43 以降で `_atoi` 本体と一緒に扱う想定 |
|
||||
|
||||
最新の canonical / dev Normalized 経路や Shape 判定ロジックの詳細は `joinir-architecture-overview.md`(Phase 35–41 セクション)を参照してね。
|
||||
|
||||
## Pattern × Box マトリクス(JsonParser全体)
|
||||
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user