feat(joinir): Phase 213-2 Step 2-2 & 2-3 Data structure extensions

Extended PatternPipelineContext and CarrierUpdateInfo for Pattern 3 AST-based generalization.

Changes:
1. PatternPipelineContext:
   - Added loop_condition: Option<ASTNode>
   - Added loop_body: Option<Vec<ASTNode>>
   - Added loop_update_summary: Option<LoopUpdateSummary>
   - Updated build_pattern_context() for Pattern 3

2. CarrierUpdateInfo:
   - Added then_expr: Option<ASTNode>
   - Added else_expr: Option<ASTNode>
   - Updated analyze_loop_updates() with None defaults

Status: Phase 213-2 Steps 2-2 & 2-3 complete
Next: Create Pattern3IfAnalyzer to extract if statement and populate update summary
This commit is contained in:
nyash-codex
2025-12-10 00:01:53 +09:00
parent 577b5b01d5
commit d7805e5974
138 changed files with 3529 additions and 378 deletions

View File

@ -5,12 +5,12 @@
⚠️ **ルートディレクトリの汚染防止ルール** ⚠️
```bash
# ❌ 絶対ダメ:ルートで実行
./target/release/nyash test.hako # ログがルートに散乱!
./target/release/hakorune test.hako # ログがルートに散乱!
cargo test > test_output.txt # 出力ファイルがルートに!
# ✅ 正しい方法:必ずディレクトリを使う
cd local_tests && ../target/release/nyash test.hako
./target/release/nyash local_tests/test.hako
cd local_tests && ../target/release/hakorune test.hako
./target/release/hakorune local_tests/test.hako
```
**必須ルール:**
@ -42,7 +42,7 @@ echo 'print("Hello Nyash!")' > local_tests/test_hello.hako
./target/debug/nyash app_dice_rpg.hako
# JIT 実行フラグCLI
./target/release/nyash --backend vm \
./target/release/hakorune --backend vm \
--jit-exec --jit-stats --jit-dump --jit-threshold 1 \
--jit-phi-min --jit-hostcall --jit-handle-debug \
examples/jit_branch_demo.hako
@ -51,11 +51,11 @@ echo 'print("Hello Nyash!")' > local_tests/test_hello.hako
# NYASH_JIT_PHI_MIN/NYASH_JIT_HOSTCALL/NYASH_JIT_HANDLE_DEBUG
# HostCallハンドルPoCの例
./target/release/nyash --backend vm --jit-exec --jit-hostcall examples/jit_array_param_call.hako
./target/release/nyash --backend vm --jit-exec --jit-hostcall examples/jit_map_param_call.hako
./target/release/nyash --backend vm --jit-exec --jit-hostcall examples/jit_map_int_keys_param_call.hako
./target/release/nyash --backend vm --jit-exec --jit-hostcall examples/jit_string_param_length.hako
./target/release/nyash --backend vm --jit-exec --jit-hostcall examples/jit_string_is_empty.hako
./target/release/hakorune --backend vm --jit-exec --jit-hostcall examples/jit_array_param_call.hako
./target/release/hakorune --backend vm --jit-exec --jit-hostcall examples/jit_map_param_call.hako
./target/release/hakorune --backend vm --jit-exec --jit-hostcall examples/jit_map_int_keys_param_call.hako
./target/release/hakorune --backend vm --jit-exec --jit-hostcall examples/jit_string_param_length.hako
./target/release/hakorune --backend vm --jit-exec --jit-hostcall examples/jit_string_is_empty.hako
```
## PHI ポリシーPhase15と検証トグル
@ -103,11 +103,11 @@ python3 tools/phi_trace_check.py --file tmp/phi_trace.jsonl --summary
### 1. CLI レベルの MIR ダンプ
- ソースから直接 MIR を確認:
- `./target/release/nyash --dump-mir path/to/program.hako`
- `./target/release/hakorune --dump-mir path/to/program.hako`
- VM 実行経路で MIR を一緒に吐く:
- `NYASH_VM_DUMP_MIR=1 ./target/release/nyash path/to/program.hako`
- `NYASH_VM_DUMP_MIR=1 ./target/release/hakorune path/to/program.hako`
- JSON で詳細解析したい場合:
- `./target/release/nyash --emit-mir-json mir.json path/to/program.hako`
- `./target/release/hakorune --emit-mir-json mir.json path/to/program.hako`
- 例: `jq '.functions[0].blocks' mir.json` でブロック構造を確認。
### 2. Scope / Loop ヒントNYASH_MIR_HINTS
@ -137,7 +137,7 @@ python3 tools/phi_trace_check.py --file tmp/phi_trace.jsonl --summary
- 戻り値は Void 定数扱いのため、式コンテキストに書いても型崩れしない。
- 実行時の有効化:
- `NYASH_MIR_DEBUG_LOG=1 ./target/release/nyash path/to/program.hako`
- `NYASH_MIR_DEBUG_LOG=1 ./target/release/hakorune path/to/program.hako`
- VM の MIR interpreter が次のようなログを stderr に出力:
```text
@ -189,9 +189,9 @@ cargo build --release
### パーサー無限ループ対策2025-08-09実装
```bash
# 🔥 デバッグ燃料でパーサー制御
./target/release/nyash --debug-fuel 1000 program.hako # 1000回制限
./target/release/nyash --debug-fuel unlimited program.hako # 無制限
./target/release/nyash program.hako # デフォルト10万回
./target/release/hakorune --debug-fuel 1000 program.hako # 1000回制限
./target/release/hakorune --debug-fuel unlimited program.hako # 無制限
./target/release/hakorune program.hako # デフォルト10万回
# パーサー無限ループが検出されると自動停止+詳細情報表示
🚨 PARSER INFINITE LOOP DETECTED at method call argument parsing