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

@ -8,7 +8,7 @@ Status: PoC complete; PyVM sandbox route wired. This guide explains how to autho
- `NYASH_MACRO_ENABLE=1`
- `NYASH_MACRO_PATHS=apps/macros/examples/echo_macro.hako`
- Run your program as usual (macro expansion happens once before MIR):
- `./target/release/nyash --backend vm apps/tests/ternary_basic.hako`
- `./target/release/hakorune --backend vm apps/tests/ternary_basic.hako`
Environment overview (recommended minimal set)
- `NYASH_MACRO_ENABLE=1`既定ON
@ -66,7 +66,7 @@ export NYASH_MACRO_ENABLE=1
export NYASH_MACRO_PATHS=apps/macros/examples/echo_macro.hako
# Run your program (macro expansion happens before MIR)
./target/release/nyash --backend vm apps/tests/ternary_basic.hako
./target/release/hakorune --backend vm apps/tests/ternary_basic.hako
```
Selfhost pathNYASH_USE_NY_COMPILER=1での前展開開発用
@ -75,7 +75,7 @@ Selfhost pathNYASH_USE_NY_COMPILER=1での前展開開発用
NYASH_USE_NY_COMPILER=1 \
NYASH_MACRO_SELFHOST_PRE_EXPAND=1 \
NYASH_VM_USE_PY=1 \
./target/release/nyash --backend vm apps/tests/ternary_basic.hako
./target/release/hakorune --backend vm apps/tests/ternary_basic.hako
```
Notes: 現状は PyVM ルートのみ対応。`NYASH_VM_USE_PY=1` が必須。
@ -84,7 +84,7 @@ CLI プロファイル(推奨)
- `--profile dev`(既定相当: マクロON/厳格ON
- `--profile lite`マクロOFFの軽量モード
- `--profile ci|strict`マクロON/厳格ON
- 例: `./target/release/nyash --profile dev --backend vm apps/tests/ternary_basic.hako`
- 例: `./target/release/hakorune --profile dev --backend vm apps/tests/ternary_basic.hako`
Notes
- Built-in child route (stdin JSON -> stdout JSON) remains available when `NYASH_MACRO_BOX_CHILD_RUNNER=0`.
@ -113,7 +113,7 @@ Array/Map editing examples
## Inspect Expanded AST
```bash
./target/release/nyash --dump-expanded-ast-json apps/tests/ternary_basic.hako
./target/release/hakorune --dump-expanded-ast-json apps/tests/ternary_basic.hako
```
Outputs AST JSON v0 after expansion; use this for golden comparison.