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

@ -133,10 +133,10 @@ Call { callee: Callee, args }
#### Phase 15.3 — Detailed PlanNy compiler MVP
- Directory layoutselfhost compiler
- `apps/selfhost-compiler/compiler.nyash`CompilerBox entry; Ny→JSON v0 emit
- `apps/selfhost-compiler/parser/{lexer.nyash,parser.nyash,ast.nyash}`Stage2 へ段階拡張)
- `apps/selfhost-compiler/emitter/json_v0.nyash`(将来: emit 分離。MVPは inline でも可)
- `apps/selfhost-compiler/mir/{builder.nyash,optimizer.nyash}`(将来)
- `apps/selfhost-compiler/compiler.hako`CompilerBox entry; Ny→JSON v0 emit
- `apps/selfhost-compiler/parser/{lexer.hako,parser.hako,ast.hako}`Stage2 へ段階拡張)
- `apps/selfhost-compiler/emitter/json_v0.hako`(将来: emit 分離。MVPは inline でも可)
- `apps/selfhost-compiler/mir/{builder.hako,optimizer.hako}`(将来)
- `apps/selfhost-compiler/tests/{stage1,stage2}`サンプルと期待JSON
- Runner integration安全ゲート
@ -164,7 +164,7 @@ Call { callee: Callee, args }
- `tools/build_compiler_exe.sh`Selfhost Parser のEXE化
- `tools/ny_stage2_bridge_smoke.sh`(算術/比較/短絡/ネストif
- `tools/ny_parser_stage2_phi_smoke.sh`If/Loop の PHI 合流)
- `tools/parity.sh --lhs pyvm --rhs llvmlite <test.nyash>`(常時)
- `tools/parity.sh --lhs pyvm --rhs llvmlite <test.hako>`(常時)
Imports/Namespace plan15.3late
- See: imports-namespace-plan.md — keep `nyash.toml` resolution in runner; accept `using` in Ny compiler as noop (no resolution) gated by `NYASH_ENABLE_USING=1`.
@ -182,7 +182,7 @@ Imports/Namespace plan15.3late
【受入MVP
- `tools/ny_roundtrip_smoke.sh`Case A/B
- `apps/tests/esc_dirname_smoke.nyash` / `apps/selfhost/tools/dep_tree_min_string.nyash` を Ny パーサ経路で実行し、PyVM/llvmlite とパリティ一致stdout/exit
- `apps/tests/esc_dirname_smoke.hako` / `apps/selfhost/tools/dep_tree_min_string.hako` を Ny パーサ経路で実行し、PyVM/llvmlite とパリティ一致stdout/exit
#### 予告: LoopFormMIR18での PHI 自動化Phase15 後)
- LoopForm を強化し、`loop.begin(loop_carried_values) / loop.iter / loop.branch / loop.end` の構造的情報から逆Loweringで PHI を合成。
@ -433,9 +433,9 @@ ny_free_buf(buffer)
- [ROADMAP.md](ROADMAP.md) - 進捗管理用チェックリスト
### ✅ クイックスモーク(現状)
- PyVM↔llvmlite パリティ: `tools/parity.sh --lhs pyvm --rhs llvmlite apps/tests/esc_dirname_smoke.nyash`
- dep_treeハーネスON: `NYASH_LLVM_FEATURE=llvm ./tools/build_llvm.sh apps/selfhost/tools/dep_tree_min_string.nyash -o app_dep && ./app_dep`
- Selfhost Parser EXE: `tools/build_compiler_exe.sh && (cd dist/nyash_compiler && ./nyash_compiler tmp/sample.nyash > sample.json)`
- PyVM↔llvmlite パリティ: `tools/parity.sh --lhs pyvm --rhs llvmlite apps/tests/esc_dirname_smoke.hako`
- dep_treeハーネスON: `NYASH_LLVM_FEATURE=llvm ./tools/build_llvm.sh apps/selfhost/tools/dep_tree_min_string.hako -o app_dep && ./app_dep`
- Selfhost Parser EXE: `tools/build_compiler_exe.sh && (cd dist/nyash_compiler && ./nyash_compiler tmp/sample.hako > sample.json)`
- JSON v0 bridge spec: `docs/reference/ir/json_v0.md`
- Stage2 smokes: `tools/ny_stage2_bridge_smoke.sh`, `tools/ny_parser_stage2_phi_smoke.sh`, `tools/ny_me_dummy_smoke.sh`

View File

@ -72,7 +72,7 @@ This roadmap is a living checklist to advance Phase 15 with small, safe boxes. U
- JSON v0 bridge: `tools/ny_parser_bridge_smoke.sh` / `tools/ny_parser_bridge_smoke.ps1`
- E2E roundtrip: `tools/ny_roundtrip_smoke.sh` / `tools/ny_roundtrip_smoke.ps1`
- EXE-first smoke: `tools/build_compiler_exe.sh && (cd dist/nyash_compiler && ./nyash_compiler tmp/sample.nyash > sample.json)`
- EXE-first smoke: `tools/build_compiler_exe.sh && (cd dist/nyash_compiler && ./nyash_compiler tmp/sample.hako > sample.json)`
## Implementation Dependencies

View File

@ -362,11 +362,11 @@ box BootstrapVerifier {
verify() {
// Stage 0でStage 1をビルド
local stage0 = new CompilerBox() // Rust版
local stage1_code = stage0.compile(readFile("compiler.nyash"))
local stage1_code = stage0.compile(readFile("compiler.hako"))
// Stage 1でStage 2をビルド
local stage1 = stage1_code.instantiate()
local stage2_code = stage1.compile(readFile("compiler.nyash"))
local stage2_code = stage1.compile(readFile("compiler.hako"))
// バイナリ比較
if stage1_code.equals(stage2_code) {

View File

@ -158,20 +158,20 @@ fn main() -> Result<()> {
### 統合実行(将来)
```bash
# ワンステップビルド
nyash build --backend llvm --emit exe program.nyash -o program.exe
nyash build --backend llvm --emit exe program.hako -o program.exe
# デバッグ用分離実行
nyash --dump-mir program.nyash > program.mir.json
nyash --dump-mir program.hako > program.mir.json
nyash-llvm-compiler program.mir.json -o program.exe
```
### パイプライン実行
```bash
# Unix pipe
nyash --dump-mir program.nyash | nyash-llvm-compiler - -o program.exe
nyash --dump-mir program.hako | nyash-llvm-compiler - -o program.exe
# Windows
nyash --dump-mir program.nyash > temp.mir
nyash --dump-mir program.hako > temp.mir
nyash-llvm-compiler temp.mir -o program.exe
```

View File

@ -68,7 +68,7 @@ Internal Architecture
Integration Points
- Parser EXE → MIR Builder EXE
- `./nyash_compiler <in.nyash> | ny_mir_builder --stdin --emit obj -o a.o`
- `./nyash_compiler <in.hako> | ny_mir_builder --stdin --emit obj -o a.o`
- Compose with link step for quick endtoend: `... --emit exe -o a.out`
- Runner (future option)
- `NYASH_USE_NY_COMPILER_EXE=1`: Runner spawns parser EXE; optionally chain into MIR Builder EXE for AOT.

View File

@ -186,7 +186,7 @@ fn execute_mir_call(&mut self, mir_call: &MirCall) -> Result<VMValue, VMError> {
mini-vmは新規実装のため、最初から統一MirCall対応で実装
```nyash
// apps/selfhost/vm/call_executor.nyash
// apps/selfhost/vm/call_executor.hako
static box CallExecutor {
execute(mir_call: MirCallBox) {
local callee_type = mir_call.getCalleeType()
@ -432,7 +432,7 @@ impl MirInterpreter {
### 📅 Medium1ヶ月以内
7. **mini-vm統一Call実装**
- `apps/selfhost/vm/call_executor.nyash`作成
- `apps/selfhost/vm/call_executor.hako`作成
- Nyashでの統一処理実装
8. **環境変数デフォルト化**

View File

@ -146,8 +146,8 @@ fn is_reserved_type(name: &str) -> bool {
#### 2. プラグイン版テスト
```bash
# Step 1: 単体テスト
NYASH_USE_PLUGIN_CORE_BOXES=1 ./target/release/nyash test_integer.nyash
NYASH_USE_PLUGIN_CORE_BOXES=1 ./target/release/nyash test_string.nyash
NYASH_USE_PLUGIN_CORE_BOXES=1 ./target/release/nyash test_integer.hako
NYASH_USE_PLUGIN_CORE_BOXES=1 ./target/release/nyash test_string.hako
# Step 2: スモークテスト
NYASH_USE_PLUGIN_CORE_BOXES=1 ./tools/jit_smoke.sh
@ -159,7 +159,7 @@ NYASH_USE_PLUGIN_CORE_BOXES=1 cargo test
#### 3. パフォーマンス測定
```bash
# ベンチマーク
./target/release/nyash --benchmark core_vs_plugin.nyash
./target/release/nyash --benchmark core_vs_plugin.hako
```
### Phase B: MIRビルダー統一2週目
@ -219,13 +219,13 @@ MirType::Box(class.to_string())
#### 3. デフォルト動作の確立
```bash
# 環境変数なしでプラグインBox使用
./target/release/nyash test.nyash # StringBox = プラグイン版
./target/release/nyash test.hako # StringBox = プラグイン版
```
### Phase D: Nyashコード実装将来
```nyash
// apps/lib/core_boxes/string_box.nyash
// apps/lib/core_boxes/string_box.hako
box StringBox {
data: InternalString // 内部表現
@ -248,7 +248,7 @@ box StringBox {
```
```nyash
// apps/lib/core_boxes/integer_box.nyash
// apps/lib/core_boxes/integer_box.hako
box IntegerBox {
value: i64

View File

@ -15,7 +15,7 @@
**要点:**
- NyModules 共有レジストリ導入: env.modules.set/getまたは ModulesBox
- ny_plugins のパス→名前空間導出: ルート相対、"/"→".", 拡張子 .nyash 省略、[^a-zA-Z0-9_.]→"_"
- ny_plugins のパス→名前空間導出: ルート相対、"/"→".", 拡張子 .hako 省略、[^a-zA-Z0-9_.]→"_"
- Windowsパス: "\\"→"/" 正規化後に上記規則を適用
- 予約衝突: nyashstd.* の登録を明示拒否しログ出力
@ -64,7 +64,7 @@
**スモーク/CI:**
- `tools/ny_roundtrip_smoke.sh` / `tools/ny_parser_bridge_smoke.sh`
- `tools/parity.sh --lhs pyvm --rhs llvmlite <smoke.nyash>`Nyパーサ経路ON
- `tools/parity.sh --lhs pyvm --rhs llvmlite <smoke.hako>`Nyパーサ経路ON
**完了基準:**
- esc_dirname_smoke / dep_tree_min_string が Ny パーサ経路でも PyVM/llvmlite と一致stdout/exit
@ -140,7 +140,7 @@
cargo build --release --features cranelift-jit
# 実行
./target/release/nyash --backend vm apps/selfhost-minimal/main.nyash
./target/release/nyash --backend vm apps/selfhost-minimal/main.hako
# スモーク
./tools/jit_smoke.sh
@ -158,7 +158,7 @@ cargo build --release --features cranelift-jit
- 2並走・重複回避: `CODEX_MAX_CONCURRENT=2 CODEX_DEDUP=1 CODEX_ASYNC_DETACH=1`
- 監視: `pgrep -af 'codex .* exec'` / `tail -f ~/.codex-async-work/logs/codex-*.log`
- Windowsパス/名前空間: "\\"→"/" 正規化 → ルール適用(/→., .nyash除去, sanitize
- Windowsパス/名前空間: "\\"→"/" 正規化 → ルール適用(/→., .hako除去, sanitize
## 備考