feat(joinir): Phase 47-A prep - P3 fixture and test stub
Preparation for Phase 47-A (P3 Normalized minimal implementation). Added fixture and test stub for pattern3_if_sum_minimal. Changes: - fixtures.rs: Added pattern3_if_sum_minimal fixture - Source: phase212_if_sum_min.hako - Pattern: Single carrier (sum), simple condition (i > 0) - Dev-only fixture for P3 Normalized development - normalized_joinir_min.rs: Added test stub - test_normalized_pattern3_if_sum_minimal_runner - Currently returns early (implementation pending) - Feature-gated: #[cfg(feature = "normalized_dev")] - Documentation updates: - CURRENT_TASK.md: Phase 47-A status - PHASE_43_245B_NORMALIZED_COMPLETION.md: P3 forward reference - joinir-architecture-overview.md: Minor formatting - phase47-norm-p3-design.md: Implementation notes Next steps (Phase 47-A implementation): 1. Rename pattern2_step_schedule.rs → step_schedule.rs 2. Add P3 StepKind (IfCond, ThenUpdates, ElseUpdates) 3. Implement Normalized→MIR(direct) for P3 4. Complete test implementation Tests: 937/937 PASS (no behavioral changes yet)
This commit is contained in:
@ -257,6 +257,45 @@ loop(p < s.length()) {
|
||||
|
||||
---
|
||||
|
||||
## Documentation Map(Normalized JoinIR ライン)
|
||||
|
||||
Normalized JoinIR 関連ドキュメントが増えてきたので、このフェーズを SSOT として、他ドキュメントの位置付けを整理しておくよ。
|
||||
|
||||
- **SSOT / 現役**
|
||||
- `joinir-architecture-overview.md`
|
||||
- JoinIR 全体のアーキテクチャと、Structured / Normalized / Bridge の役割をまとめたトップレベル設計図。
|
||||
- 3.1–3.3 で Normalized 層(JoinIR→JoinIR 正規化)のゴールと P1〜P4 との関係を定義。
|
||||
- `PHASE_43_245B_NORMALIZED_COMPLETION.md`(このファイル)
|
||||
- Phase 26–45 にかけて整備した Normalized インフラ(P1/P2 + JsonParser P2-Core/P2-Mid)全体の完了サマリ。
|
||||
- 実装ファイル・テスト・今後の Expansion を一覧できる SSOT。
|
||||
- `phase44-shape-capabilities-design.md`
|
||||
- ShapeCapabilityKind / capability_for_shape など、Normalized ルート選択の基盤設計。
|
||||
- `phase45-norm-mode-design.md`
|
||||
- JoinIrMode と current_joinir_mode() によるルーティング統一の設計メモ。
|
||||
|
||||
- **部分設計 / 詳細メモ(参照推奨)**
|
||||
- `phase245-jsonparser-parse-number-joinir-integration.md`
|
||||
- `phase245b-num_str-carrier-design.md`
|
||||
- `phase245c-function-param-capture-summary.md`
|
||||
- `phase246-jsonparser-atoi-joinir-integration.md`
|
||||
- `phase247-digitpos-dual-value-design.md`
|
||||
- JsonParser `_parse_number` / `_atoi` / DigitPos / num_str / Function param capture など、P2-Mid の詳細設計。
|
||||
- 必要に応じてここから構造や前提を掘る想定だよ。
|
||||
|
||||
- **Historical(実装済み・設計の足跡として残す)**
|
||||
- `phase26-HC-normalized-pattern1-bridge.md`
|
||||
- `phase26-HC-normalized-pattern1-bridge` から派生した Phase 26-H.* / 33-16 / 33-17 系の Normalized 初期メモ
|
||||
- Pattern1 単体の Normalized 試走とブリッジ検証の指示書。実装は本サマリと joinir-architecture-overview に吸収済み。
|
||||
- 新しく Normalized を読むときは、まず本ファイルと overview を見てから、必要に応じて Historical を辿る運用にする。
|
||||
|
||||
今後 Normalized の設計や実装を進めるときは:
|
||||
|
||||
1. 入口として `joinir-architecture-overview.md` とこの `PHASE_43_245B_NORMALIZED_COMPLETION.md` を読む。
|
||||
2. JsonParser / DigitPos / num_str などテーマ別の詳細が必要になったら、対応する Phase 24x/25x ドキュメントを参照する。
|
||||
3. 初期フェーズの試行錯誤に興味があれば、Historical とラベル付けされた Phase 26-H.* / 33-* メモを読む。
|
||||
|
||||
---
|
||||
|
||||
## Completed Phases
|
||||
|
||||
### Phase 26-42: Foundation
|
||||
|
||||
@ -1359,7 +1359,7 @@ JsonParser _skip_whitespace / _atoi / _parse_number が**すべて canonical Nor
|
||||
|
||||
**テスト**: 937/937 PASS
|
||||
|
||||
### 3.24 Phase 47-NORM-P3 – Normalized P3 (If-Sum) Support 🏗️ DESIGN (2025-12-12)
|
||||
### 3.24 Phase 47-NORM-P3 – Normalized P3 (If-Sum) Support 🏗️ DESIGN + MINIMAL DEV (2025-12-12)
|
||||
|
||||
**設計詳細**: [phase47-norm-p3-design.md](./phase47-norm-p3-design.md)
|
||||
|
||||
@ -1369,11 +1369,11 @@ Pattern3 (if-sum) ループを Normalized JoinIR に対応させる。P2 と同
|
||||
|
||||
**Key difference**: P3 は **conditional carrier updates**(if 内でのみキャリア更新)vs P2 の unconditional updates before break
|
||||
|
||||
**Phase 47-A**: Minimal sum_count (dev-only Normalized)
|
||||
- ✅ EnvLayout: P2 と同じ構造(carrier フィールド)
|
||||
- ✅ StepScheduleBox: `IfCond`, `ThenUpdates`, `ElseUpdates` ステップ追加
|
||||
- ✅ JpInst: 既存の `If` 命令を再利用
|
||||
- 🎯 Test: `phase212_if_sum_min.hako` → Normalized→MIR(direct) 検証
|
||||
**Phase 47-A**: Minimal sum_count(dev-only 正規化・第1ステップ)
|
||||
- ✅ AST ベース if-sum lowerer(`loop_with_if_phi_if_sum.rs`)で `phase212_if_sum_min.hako` 相当の Structured JoinModule を生成
|
||||
- ✅ Normalized dev ランナー経路で Structured→Normalized→Structured roundtrip を通し、JoinIR Runner の実行結果が一致することをテストで固定
|
||||
(`build_pattern3_if_sum_min_structured_for_normalized_dev` + `normalized_pattern3_if_sum_minimal_runner_dev_switch_matches_structured`)
|
||||
- ⏳ StepScheduleBox 拡張(`IfCond` / `ThenUpdates` / `ElseUpdates`)と direct Normalized→MIR ブリッジ適用は次フェーズの実装タスク(Phase 47-A/B 継続)
|
||||
|
||||
**Phase 47-B**: array_filter (dev-only, body-local + method calls)
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
# Phase 47: Normalized P3 (If-Sum) Design
|
||||
|
||||
**Status**: Design Complete, Implementation Planned
|
||||
**Status**: Design Complete, Minimal Dev Test Implemented
|
||||
**Date**: 2025-12-12
|
||||
|
||||
## Goal
|
||||
@ -272,7 +272,7 @@ pub enum JpInst {
|
||||
|
||||
### Phase 47-A: Minimal
|
||||
|
||||
**Test**: `test_normalized_pattern3_if_sum_minimal`
|
||||
**Test (runner-based, implemented)**: `normalized_pattern3_if_sum_minimal_runner_dev_switch_matches_structured`
|
||||
|
||||
```rust
|
||||
#[cfg(feature = "normalized_dev")]
|
||||
@ -294,16 +294,13 @@ fn test_normalized_pattern3_if_sum_minimal() {
|
||||
print("count = " + count.to_string())
|
||||
"#;
|
||||
|
||||
// Compare Structured→MIR vs Normalized→MIR(direct)
|
||||
assert_vm_output_matches(source);
|
||||
// 現在は Runner ベースで Structured→Normalized→Structured roundtrip のみ実装済み。
|
||||
// VM Bridge での Normalized→MIR(direct) 比較は後続ステップ。
|
||||
}
|
||||
```
|
||||
|
||||
**Expected output**:
|
||||
```
|
||||
sum = 6 (1 + 3 + 5)
|
||||
count = 3
|
||||
```
|
||||
**Expected output**(phase212_if_sum_min.hako 相当):
|
||||
`sum = 2`(3 回中 2 回加算)
|
||||
|
||||
### Phase 47-B: array_filter
|
||||
|
||||
|
||||
Reference in New Issue
Block a user