docs: Phase 107 plan (find_balanced_array_end)
This commit is contained in:
@ -120,6 +120,7 @@ JoinIR を触るときは、次を破ったら「即エラーで止める」前
|
|||||||
- Pattern は「認識できる shape だけ」を通し、曖昧な許容をしない。
|
- Pattern は「認識できる shape だけ」を通し、曖昧な許容をしない。
|
||||||
- 形状が合わないときは `Ok(None)` で静かに進めない(非JoinIRへの退避を作らない)。
|
- 形状が合わないときは `Ok(None)` で静かに進めない(非JoinIRへの退避を作らない)。
|
||||||
- 例外: 明確な “routing” で「別 JoinIR 経路」を選ぶのは可(同一層内での選択)。
|
- 例外: 明確な “routing” で「別 JoinIR 経路」を選ぶのは可(同一層内での選択)。
|
||||||
|
- depth-scan(Phase 107: `find_balanced_*`)は Pattern2 の policy で受理し、break 条件は “derived 値(depth_delta/depth_next)” から合成して SSOT 化する(by-name 分岐は禁止)。
|
||||||
|
|
||||||
### ValueId / PHI / Boundary の世界
|
### ValueId / PHI / Boundary の世界
|
||||||
|
|
||||||
|
|||||||
@ -1,20 +1,10 @@
|
|||||||
# Phase 107 — find_balanced_*(doc-only / 準備)
|
# Phase 107 — json_cur find_balanced_array_end(Active)
|
||||||
|
|
||||||
目的: `apps/libs/json_cur.hako` の `find_balanced_array_end` / `find_balanced_object_end`(depth scan + nested if)を、
|
目的: `apps/libs/json_cur.hako` の `find_balanced_array_end`(depth scan + nested if + return-in-loop)を Pattern2 policy で受理し、VM/LLVM EXE parity を integration smoke で固定する。
|
||||||
次フェーズで fixture + integration smoke(VM/LLVM EXE)に落とすための設計メモを先に確定する。
|
形状: `loop(i < n)` + `ch = s.substring(i, i+1)` + `depth += 1/-1` + `if depth == 0 { return i }` + `i = i + 1`。
|
||||||
|
受け入れ基準: fixture で `[]`→`1`, `[[]]`→`3` を VM と LLVM EXE の両方で出す(LLVM 前提不足時は SKIP のみ許容)。
|
||||||
## 期待するループ形(要点)
|
|
||||||
|
|
||||||
- `loop(...)` または `loop(true)` の中で `depth`(i64)を更新しながら走査
|
|
||||||
- `if ch == "[" { depth += 1 }` / `if ch == "]" { depth -= 1; if depth == 0 { break/return } }` のようなネスト if
|
|
||||||
- “break/return” の条件が複数(boundary + depth==0 など)
|
|
||||||
|
|
||||||
## 必要になりそうな追加能力(予告)
|
|
||||||
|
|
||||||
- multi-branch delta: 1ループ内で `i += 1` 以外の分岐更新(例: `i += 2`)が混ざるケース
|
|
||||||
- nested-if merge: if の中で depth を更新し、その後の break 条件に反映される形
|
|
||||||
- early-exit parity: break だけでなく `return` を含む出口の固定(VM/LLVM EXE)
|
|
||||||
|
|
||||||
置き場(SSOT の決め打ち):
|
|
||||||
- “shape/route の判断” は `src/mir/builder/control_flow/joinir/patterns/policies/` に集約し、lowering 本体は Pattern2/5 側で維持する。
|
|
||||||
|
|
||||||
|
TODO(実装後に追記):
|
||||||
|
- fixture: `apps/tests/phase107_find_balanced_array_end_min.hako`
|
||||||
|
- smoke(VM): `tools/smokes/v2/profiles/integration/apps/phase107_find_balanced_array_end_vm.sh`
|
||||||
|
- smoke(LLVM EXE): `tools/smokes/v2/profiles/integration/apps/phase107_find_balanced_array_end_llvm_exe.sh`
|
||||||
|
|||||||
Reference in New Issue
Block a user