phase: 20.49 COMPLETE; 20.50 Flow+String minimal reps; 20.51 selfhost v0/v1 minimal (Option A/B); hv1-inline binop/unop/copy; docs + run_all + CURRENT_TASK -> 21.0

This commit is contained in:
nyash-codex
2025-11-06 15:41:52 +09:00
parent 2dc370223d
commit 77d4fd72b3
1658 changed files with 6288 additions and 2612 deletions

View File

@ -22,12 +22,12 @@
### 4. 新しい例の追加
#### `examples/jit_stats_bool_ret.nyash`
#### `examples/jit_stats_bool_ret.hako`
- 統計JSONをプリントする最小デモ
- 最後にブールを返す
- JIT統計の動作確認用
#### `examples/jit_mixed_f64_compare.nyash`
#### `examples/jit_mixed_f64_compare.hako`
- f64比較のデモ
- **注意**: VMのf64演算/比較未対応のため、Cranelift有効環境向けサンプル
@ -36,7 +36,7 @@
### 統計JSON出力
```bash
NYASH_JIT_STATS=1 NYASH_JIT_STATS_JSON=1 NYASH_JIT_THRESHOLD=1 \
./target/release/nyash --backend vm examples/jit_stats_bool_ret.nyash
./target/release/nyash --backend vm examples/jit_stats_bool_ret.hako
```
JSONに以下が出力される
@ -47,14 +47,14 @@ JSONに以下が出力される
### CFG/PHIダンプ
```bash
NYASH_JIT_DUMP=1 ./target/release/nyash --backend vm examples/phi_bool_merge.nyash
NYASH_JIT_DUMP=1 ./target/release/nyash --backend vm examples/phi_bool_merge.hako
```
- b1 PHIには `(b1)` タグが付与される
## 注意事項
- VMのf64演算/比較は未対応
- `jit_mixed_f64_compare.nyash` はCranelift有効環境JIT実行での確認用
- `jit_mixed_f64_compare.hako` はCranelift有効環境JIT実行での確認用
- VMでの実行はエラーになる
## 実装の意義

View File

@ -5,7 +5,7 @@
## 🔴 重要:ループビルダーのバグ発見(詳細調査完了)
### 問題詳細
- **症状**: dep_tree_min_string.nyashがVM実行でエラー `Invalid value: Value %57 not set`
- **症状**: dep_tree_min_string.hakoがVM実行でエラー `Invalid value: Value %57 not set`
- **発生箇所**: `loop(i + m <= n) { if ... { return 1 } i = i + 1 }`のような構造
### 根本原因(深掘り調査結果)
@ -51,12 +51,12 @@ Nyashの開発哲学「Everything is Box」に従い、スコープも箱化す
- 各ブロックの変数状態を自動的に箱として保存
- 実装工数: 中程度(既存構造を活用)
- 代替案A: ループビルダーの根本的な再設計(工数大)
- 代替案B: 一時的なワークアラウンドdep_tree_min_string.nyashの書き換え)
- 代替案B: 一時的なワークアラウンドdep_tree_min_string.hakoの書き換え)
2. dep-tree 深さ1直下 includeを children に反映(行ベースの素朴抽出、`//`/`#` 行コメントスキップ)。
3. `make dep-tree` 結果の JSON 形を確認(先頭 `{`、必須キー、children のリーフが path のみ)。
4. その後、深さ2→任意深さmax-depth=64、visitedを段階的に解禁。
代表コマンド
- ビルド: `cargo build --release`
- 最小 dep-tree: `./target/release/nyash --backend vm apps/selfhost/tools/dep_tree_min_string.nyash`
- 最小 dep-tree: `./target/release/nyash --backend vm apps/selfhost/tools/dep_tree_min_string.hako`
- 生成: `make dep-tree``tmp/deps.json`

View File

@ -8,7 +8,7 @@ Scope (Phase 0)
- Runner bridge: `NYASH_DEPS_JSON=<path>` is read and logged only (no behavior change).
Tool
- `apps/selfhost/tools/dep_tree_min_string.nyash`
- `apps/selfhost/tools/dep_tree_min_string.hako`
- Recursively reads source files, scans for `include "path"` outside of strings and comments.
- Comments: `//` and `#` (line comments) are ignored.
- Strings: `"..."` with `\"` escapes are honored.
@ -30,10 +30,10 @@ Acceptance criteria
- Cycles do not crash or loop; the repeated node is represented as a leaf.
Examples
- Root: `apps/selfhost/smokes/dep_smoke_root.nyash` (includes `dep_smoke_child.nyash`)
- Cycle: `apps/selfhost/smokes/dep_smoke_cycle_a.nyash``dep_smoke_cycle_b.nyash`
- Root: `apps/selfhost/smokes/dep_smoke_root.hako` (includes `dep_smoke_child.hako`)
- Cycle: `apps/selfhost/smokes/dep_smoke_cycle_a.hako``dep_smoke_cycle_b.hako`
Validation (examples)
- `echo apps/selfhost/smokes/dep_smoke_root.nyash | ./target/release/nyash --backend vm apps/selfhost/tools/dep_tree_min_string.nyash`
- `echo apps/selfhost/smokes/dep_smoke_root.hako | ./target/release/nyash --backend vm apps/selfhost/tools/dep_tree_min_string.hako`
- `make dep-tree`