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:
@ -26,8 +26,8 @@ Current Performance (100 iterations avg):
|
||||
**実装アプローチ**:
|
||||
```bash
|
||||
# 新CLI機能
|
||||
nyash --compile-native program.nyash -o program.exe
|
||||
nyash --aot program.nyash # 短縮形
|
||||
nyash --compile-native program.hako -o program.exe
|
||||
nyash --aot program.hako # 短縮形
|
||||
|
||||
# 内部パイプライン
|
||||
Nyash → AST → MIR → WASM → wasmtime compile → Native Binary
|
||||
@ -50,7 +50,7 @@ Nyash → AST → MIR → WASM → wasmtime compile → Native Binary
|
||||
**実装ファイル**:
|
||||
- `src/backend/native_aot.rs` - AOTコンパイラ
|
||||
- `src/main.rs` - CLI統合
|
||||
- `benchmarks/bench_native.nyash` - ネイティブ性能測定
|
||||
- `benchmarks/bench_native.hako` - ネイティブ性能測定
|
||||
|
||||
### 🥈 Phase B: Cranelift Direct (中期 - 2-3ヶ月)
|
||||
**Goal**: MIRから直接ネイティブコード生成
|
||||
|
||||
@ -19,7 +19,7 @@
|
||||
|
||||
#### **Phase A: AOT WASM** (最優先 - 2-3週間)
|
||||
```bash
|
||||
nyash --compile-native program.nyash -o program.exe
|
||||
nyash --compile-native program.hako -o program.exe
|
||||
```
|
||||
- **技術**: wasmtime compile でネイティブ化
|
||||
- **効果**: 13.5倍 → 100倍 (7倍追加向上)
|
||||
|
||||
@ -123,12 +123,12 @@ Scope:
|
||||
Tasks:
|
||||
- Cargo.toml: examples/GUI を feature でガード(default は CLI 最小)。
|
||||
- ビルド検証: `cargo build --bin nyash`(Linux/Windows)。
|
||||
- 実行検証: `cargo run -- ./local_tests/sample.nyash`。
|
||||
- 実行検証: `cargo run -- ./local_tests/sample.hako`。
|
||||
- ドキュメント: 上記手順を how-to-build-native に追記/点検。
|
||||
|
||||
Acceptance Criteria:
|
||||
- Linux/Windows で `cargo build --bin nyash` が成功する。
|
||||
- `local_tests/` 配下の簡単な .nyash が実行できる。
|
||||
- `local_tests/` 配下の簡単な .hako が実行できる。
|
||||
- 他 bin/examples が壊れていても `--bin nyash` だけで通る。
|
||||
|
||||
Out of Scope:
|
||||
@ -255,7 +255,7 @@ Summary:
|
||||
Scope/Tasks:
|
||||
- AST: BoxDeclaration(is_static=true, name=Main) を検出 → main() を抽出
|
||||
- Lowering: body を Program に変換して既存経路に渡す
|
||||
- Tests: local_tests/mir_loop_no_local.nyash で dump/VM が通る
|
||||
- Tests: local_tests/mir_loop_no_local.hako で dump/VM が通る
|
||||
|
||||
Acceptance Criteria:
|
||||
- `--dump-mir` が static Main サンプルで成功
|
||||
@ -350,7 +350,7 @@ Expected Duration: 1週間
|
||||
|
||||
### 成功基準
|
||||
- Phase 8.3のBox操作WASMが実際に動作
|
||||
- test_wasm_box_ops.nyash が正常実行
|
||||
- test_wasm_box_ops.hako が正常実行
|
||||
- ユーザー定義Boxの完全サポート
|
||||
|
||||
------------------------------------------------------------
|
||||
@ -555,7 +555,7 @@ Scope/Tasks:
|
||||
- 起動時間・配布サイズ最適化
|
||||
|
||||
Acceptance Criteria:
|
||||
- `nyash --compile-native app.nyash -o app.exe` 動作
|
||||
- `nyash --compile-native app.hako -o app.exe` 動作
|
||||
- 起動時間大幅短縮(JIT起動コスト除去)
|
||||
- 配布可能実行ファイル生成
|
||||
|
||||
|
||||
@ -124,12 +124,12 @@ Scope:
|
||||
Tasks:
|
||||
- Cargo.toml: examples/GUI を feature でガード(default は CLI 最小)。
|
||||
- ビルド検証: `cargo build --bin nyash`(Linux/Windows)。
|
||||
- 実行検証: `cargo run -- ./local_tests/sample.nyash`。
|
||||
- 実行検証: `cargo run -- ./local_tests/sample.hako`。
|
||||
- ドキュメント: 上記手順を how-to-build-native に追記/点検。
|
||||
|
||||
Acceptance Criteria:
|
||||
- Linux/Windows で `cargo build --bin nyash` が成功する。
|
||||
- `local_tests/` 配下の簡単な .nyash が実行できる。
|
||||
- `local_tests/` 配下の簡単な .hako が実行できる。
|
||||
- 他 bin/examples が壊れていても `--bin nyash` だけで通る。
|
||||
|
||||
Out of Scope:
|
||||
@ -256,7 +256,7 @@ Summary:
|
||||
Scope/Tasks:
|
||||
- AST: BoxDeclaration(is_static=true, name=Main) を検出 → main() を抽出
|
||||
- Lowering: body を Program に変換して既存経路に渡す
|
||||
- Tests: local_tests/mir_loop_no_local.nyash で dump/VM が通る
|
||||
- Tests: local_tests/mir_loop_no_local.hako で dump/VM が通る
|
||||
|
||||
Acceptance Criteria:
|
||||
- `--dump-mir` が static Main サンプルで成功
|
||||
@ -350,7 +350,7 @@ Expected Duration: 1週間
|
||||
|
||||
### 成功基準
|
||||
- Phase 8.3のBox操作WASMが実際に動作
|
||||
- test_wasm_box_ops.nyash が正常実行
|
||||
- test_wasm_box_ops.hako が正常実行
|
||||
- ユーザー定義Boxの完全サポート
|
||||
|
||||
------------------------------------------------------------
|
||||
@ -555,7 +555,7 @@ Scope/Tasks:
|
||||
- 起動時間・配布サイズ最適化
|
||||
|
||||
Acceptance Criteria:
|
||||
- `nyash --compile-native app.nyash -o app.exe` 動作
|
||||
- `nyash --compile-native app.hako -o app.exe` 動作
|
||||
- 起動時間大幅短縮(JIT起動コスト除去)
|
||||
- 配布可能実行ファイル生成
|
||||
|
||||
@ -592,7 +592,7 @@ Summary:
|
||||
|
||||
1. **WASM/AOT コンパイルエラー(最重要)**
|
||||
```bash
|
||||
$ ./target/release/nyash --compile-wasm test_simple_loop.nyash
|
||||
$ ./target/release/nyash --compile-wasm test_simple_loop.hako
|
||||
❌ Unsupported instruction: Jump { target: BasicBlockId(1) }
|
||||
```
|
||||
**影響**: ループ・条件分岐を含む全プログラムがWASM/AOT化不可
|
||||
@ -623,7 +623,7 @@ Summary:
|
||||
- グレースフルシャットダウン
|
||||
|
||||
Acceptance Criteria:
|
||||
- ✅ `nyash --compile-wasm test_loop.nyash` 成功
|
||||
- ✅ `nyash --compile-wasm test_loop.hako` 成功
|
||||
- ✅ HTTPサーバー実動作(curl http://localhost:8080/)
|
||||
- ✅ unwrap()使用箇所: 26 → 5以下
|
||||
- ✅ WASM性能: 11.5倍 → 13.5倍達成
|
||||
|
||||
@ -123,12 +123,12 @@ Scope:
|
||||
Tasks:
|
||||
- Cargo.toml: examples/GUI を feature でガード(default は CLI 最小)。
|
||||
- ビルド検証: `cargo build --bin nyash`(Linux/Windows)。
|
||||
- 実行検証: `cargo run -- ./local_tests/sample.nyash`。
|
||||
- 実行検証: `cargo run -- ./local_tests/sample.hako`。
|
||||
- ドキュメント: 上記手順を how-to-build-native に追記/点検。
|
||||
|
||||
Acceptance Criteria:
|
||||
- Linux/Windows で `cargo build --bin nyash` が成功する。
|
||||
- `local_tests/` 配下の簡単な .nyash が実行できる。
|
||||
- `local_tests/` 配下の簡単な .hako が実行できる。
|
||||
- 他 bin/examples が壊れていても `--bin nyash` だけで通る。
|
||||
|
||||
Out of Scope:
|
||||
@ -255,7 +255,7 @@ Summary:
|
||||
Scope/Tasks:
|
||||
- AST: BoxDeclaration(is_static=true, name=Main) を検出 → main() を抽出
|
||||
- Lowering: body を Program に変換して既存経路に渡す
|
||||
- Tests: local_tests/mir_loop_no_local.nyash で dump/VM が通る
|
||||
- Tests: local_tests/mir_loop_no_local.hako で dump/VM が通る
|
||||
|
||||
Acceptance Criteria:
|
||||
- `--dump-mir` が static Main サンプルで成功
|
||||
@ -349,7 +349,7 @@ Expected Duration: 1週間
|
||||
|
||||
### 成功基準
|
||||
- Phase 8.3のBox操作WASMが実際に動作
|
||||
- test_wasm_box_ops.nyash が正常実行
|
||||
- test_wasm_box_ops.hako が正常実行
|
||||
- ユーザー定義Boxの完全サポート
|
||||
|
||||
------------------------------------------------------------
|
||||
@ -553,7 +553,7 @@ Scope/Tasks:
|
||||
- 起動時間・配布サイズ最適化
|
||||
|
||||
Acceptance Criteria:
|
||||
- `nyash --compile-native app.nyash -o app.exe` 動作
|
||||
- `nyash --compile-native app.hako -o app.exe` 動作
|
||||
- 起動時間大幅短縮(JIT起動コスト除去)
|
||||
- 配布可能実行ファイル生成
|
||||
|
||||
|
||||
@ -124,12 +124,12 @@ Scope:
|
||||
Tasks:
|
||||
- Cargo.toml: examples/GUI を feature でガード(default は CLI 最小)。
|
||||
- ビルド検証: `cargo build --bin nyash`(Linux/Windows)。
|
||||
- 実行検証: `cargo run -- ./local_tests/sample.nyash`。
|
||||
- 実行検証: `cargo run -- ./local_tests/sample.hako`。
|
||||
- ドキュメント: 上記手順を how-to-build-native に追記/点検。
|
||||
|
||||
Acceptance Criteria:
|
||||
- Linux/Windows で `cargo build --bin nyash` が成功する。
|
||||
- `local_tests/` 配下の簡単な .nyash が実行できる。
|
||||
- `local_tests/` 配下の簡単な .hako が実行できる。
|
||||
- 他 bin/examples が壊れていても `--bin nyash` だけで通る。
|
||||
|
||||
Out of Scope:
|
||||
@ -256,7 +256,7 @@ Summary:
|
||||
Scope/Tasks:
|
||||
- AST: BoxDeclaration(is_static=true, name=Main) を検出 → main() を抽出
|
||||
- Lowering: body を Program に変換して既存経路に渡す
|
||||
- Tests: local_tests/mir_loop_no_local.nyash で dump/VM が通る
|
||||
- Tests: local_tests/mir_loop_no_local.hako で dump/VM が通る
|
||||
|
||||
Acceptance Criteria:
|
||||
- `--dump-mir` が static Main サンプルで成功
|
||||
@ -350,7 +350,7 @@ Expected Duration: 1週間
|
||||
|
||||
### 成功基準
|
||||
- Phase 8.3のBox操作WASMが実際に動作
|
||||
- test_wasm_box_ops.nyash が正常実行
|
||||
- test_wasm_box_ops.hako が正常実行
|
||||
- ユーザー定義Boxの完全サポート
|
||||
|
||||
------------------------------------------------------------
|
||||
@ -555,7 +555,7 @@ Scope/Tasks:
|
||||
- 起動時間・配布サイズ最適化
|
||||
|
||||
Acceptance Criteria:
|
||||
- `nyash --compile-native app.nyash -o app.exe` 動作
|
||||
- `nyash --compile-native app.hako -o app.exe` 動作
|
||||
- 起動時間大幅短縮(JIT起動コスト除去)
|
||||
- 配布可能実行ファイル生成
|
||||
|
||||
@ -592,7 +592,7 @@ Summary:
|
||||
|
||||
1. **WASM/AOT コンパイルエラー(最重要)**
|
||||
```bash
|
||||
$ ./target/release/nyash --compile-wasm test_simple_loop.nyash
|
||||
$ ./target/release/nyash --compile-wasm test_simple_loop.hako
|
||||
❌ Unsupported instruction: Jump { target: BasicBlockId(1) }
|
||||
```
|
||||
**影響**: ループ・条件分岐を含む全プログラムがWASM/AOT化不可
|
||||
@ -623,7 +623,7 @@ Summary:
|
||||
- グレースフルシャットダウン
|
||||
|
||||
Acceptance Criteria:
|
||||
- ✅ `nyash --compile-wasm test_loop.nyash` 成功
|
||||
- ✅ `nyash --compile-wasm test_loop.hako` 成功
|
||||
- ✅ HTTPサーバー実動作(curl http://localhost:8080/)
|
||||
- ✅ unwrap()使用箇所: 26 → 5以下
|
||||
- ✅ WASM性能: 11.5倍 → 13.5倍達成
|
||||
|
||||
@ -27,7 +27,7 @@ nyash-macos (1.8MB) - 署名付き
|
||||
### **2. 開発者向け配布**
|
||||
```bash
|
||||
# LLVM IRの中立性を活用
|
||||
nyashc --emit-bitcode program.nyash
|
||||
nyashc --emit-bitcode program.hako
|
||||
# → program.bc (プラットフォーム中立)
|
||||
|
||||
# 各自のマシンで最適化コンパイル
|
||||
|
||||
@ -9,7 +9,7 @@ LLVM IRはプラットフォーム中立。だから**1回のIR生成から同
|
||||
|
||||
```rust
|
||||
// 革命的ワンパス・マルチターゲット生成
|
||||
nyashc --targets linux,windows,macos program.nyash
|
||||
nyashc --targets linux,windows,macos program.hako
|
||||
|
||||
// 出力(同時生成!)
|
||||
dist/x86_64-unknown-linux-musl/nyash # Linux版
|
||||
|
||||
@ -23,7 +23,7 @@
|
||||
#### **即効性のある解決策(Week 1-3)**
|
||||
```bash
|
||||
# Linux + Windows同時生成
|
||||
nyashc --targets linux,windows-gnu program.nyash
|
||||
nyashc --targets linux,windows-gnu program.hako
|
||||
|
||||
# 出力
|
||||
dist/linux/nyash # Linux版(musl静的)
|
||||
|
||||
@ -14,7 +14,7 @@ Phase 9.78 LLVM PoCの第一歩として、inkwellクレートを導入し、最
|
||||
以下のNyashプログラムがLLVM経由で実行され、正しい終了コードを返すこと:
|
||||
|
||||
```nyash
|
||||
// test_return_42.nyash
|
||||
// test_return_42.hako
|
||||
static box Main {
|
||||
main() {
|
||||
return 42
|
||||
@ -24,7 +24,7 @@ static box Main {
|
||||
|
||||
期待される動作:
|
||||
```bash
|
||||
$ cargo run --features llvm -- --backend llvm test_return_42.nyash
|
||||
$ cargo run --features llvm -- --backend llvm test_return_42.hako
|
||||
$ echo $?
|
||||
42
|
||||
```
|
||||
|
||||
@ -29,7 +29,7 @@ Phase 9.78 LLVM PoCの開始です!最初のステップとして、inkwellク
|
||||
## 🎯 成功条件
|
||||
|
||||
```nyash
|
||||
// test_return_42.nyash
|
||||
// test_return_42.hako
|
||||
static box Main {
|
||||
main() {
|
||||
return 42
|
||||
@ -68,7 +68,7 @@ static box Main {
|
||||
## ✅ 完了条件
|
||||
|
||||
- [ ] inkwellがビルドできる
|
||||
- [ ] test_return_42.nyashがコンパイルできる
|
||||
- [ ] test_return_42.hakoがコンパイルできる
|
||||
- [ ] 実行ファイルが終了コード42を返す
|
||||
- [ ] 基本的なテストがパスする
|
||||
|
||||
|
||||
@ -52,7 +52,7 @@ cargo build --features llvm
|
||||
### 4. **テストプログラム作成**(5分)
|
||||
```bash
|
||||
# テスト用Nyashファイル
|
||||
cat > test_return_42.nyash << 'EOF'
|
||||
cat > test_return_42.hako << 'EOF'
|
||||
static box Main {
|
||||
main() {
|
||||
return 42
|
||||
|
||||
@ -70,7 +70,7 @@ fn load_builtin_plugins(&mut self) {
|
||||
|
||||
#### 2.2 テストプログラム
|
||||
```nyash
|
||||
// test_array_plugin.nyash
|
||||
// test_array_plugin.hako
|
||||
local arr
|
||||
arr = new ArrayBox() // プラグイン版を呼ぶ
|
||||
print(arr.length()) // 0が出力されれば成功
|
||||
@ -78,7 +78,7 @@ print(arr.length()) // 0が出力されれば成功
|
||||
|
||||
#### 2.3 VM実行
|
||||
```bash
|
||||
./target/release/nyash --backend vm test_array_plugin.nyash
|
||||
./target/release/nyash --backend vm test_array_plugin.hako
|
||||
```
|
||||
|
||||
### Step 3: JIT動作確認
|
||||
@ -97,7 +97,7 @@ match box_type {
|
||||
|
||||
#### 3.2 JIT実行テスト
|
||||
```bash
|
||||
NYASH_JIT_EXEC=1 NYASH_JIT_THRESHOLD=1 ./target/release/nyash --backend vm test_array_plugin.nyash
|
||||
NYASH_JIT_EXEC=1 NYASH_JIT_THRESHOLD=1 ./target/release/nyash --backend vm test_array_plugin.hako
|
||||
```
|
||||
|
||||
### Step 4: 段階的移行
|
||||
@ -123,7 +123,7 @@ if env::var("NYASH_USE_PLUGIN_BUILTINS").is_ok() {
|
||||
|
||||
#### 5.1 ベンチマーク作成
|
||||
```nyash
|
||||
// bench_array_ops.nyash
|
||||
// bench_array_ops.hako
|
||||
local arr = new ArrayBox()
|
||||
local start = Timer.now()
|
||||
loop(i in 0..1000000) {
|
||||
@ -136,10 +136,10 @@ print("Time: " + elapsed)
|
||||
#### 5.2 比較測定
|
||||
```bash
|
||||
# 従来版
|
||||
./target/release/nyash --benchmark bench_array_ops.nyash
|
||||
./target/release/nyash --benchmark bench_array_ops.hako
|
||||
|
||||
# プラグイン版
|
||||
NYASH_USE_PLUGIN_BUILTINS=1 ./target/release/nyash --benchmark bench_array_ops.nyash
|
||||
NYASH_USE_PLUGIN_BUILTINS=1 ./target/release/nyash --benchmark bench_array_ops.hako
|
||||
```
|
||||
|
||||
## 🎯 成功基準
|
||||
@ -169,10 +169,10 @@ NYASH_USE_PLUGIN_BUILTINS=1 ./target/release/nyash --benchmark bench_array_ops.n
|
||||
|
||||
```bash
|
||||
# プラグインロード確認
|
||||
NYASH_DEBUG_PLUGIN=1 ./target/release/nyash test.nyash
|
||||
NYASH_DEBUG_PLUGIN=1 ./target/release/nyash test.hako
|
||||
|
||||
# JIT呼び出し確認
|
||||
NYASH_JIT_EVENTS=1 ./target/release/nyash --backend vm test.nyash
|
||||
NYASH_JIT_EVENTS=1 ./target/release/nyash --backend vm test.hako
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
@ -58,7 +58,7 @@ This plan refines how we leverage the existing plugin system (BID-FFI) to unify
|
||||
- Link scripts and `nyc build-aot` proof-of-concept.
|
||||
- Hello World-level standalone EXE on Linux/macOS.
|
||||
- DoD:
|
||||
- `nyc build-aot <file.nyash> -o app` runs without JIT/VM.
|
||||
- `nyc build-aot <file.hako> -o app` runs without JIT/VM.
|
||||
- Basic debug info and minimal unwind.
|
||||
|
||||
### 10.5: Python Integration (moved; separate phase)
|
||||
|
||||
@ -46,7 +46,7 @@ export NYASH_PLUGIN_OVERRIDE_TYPES="ArrayBox,MapBox,ConsoleBox,StringBox,Integer
|
||||
export NYASH_DISABLE_BUILTINS=1
|
||||
|
||||
cargo build --release --features cranelift-jit
|
||||
./target/release/nyash --backend vm examples/console_demo.nyash
|
||||
./target/release/nyash --backend vm examples/console_demo.hako
|
||||
```
|
||||
|
||||
## Notes
|
||||
|
||||
@ -440,7 +440,7 @@ pub fn register_builtin_boxes(env: &mut Environment) {
|
||||
|
||||
### 6. 使用例とテストケース
|
||||
```nyash
|
||||
// test_python_parser_phase1.nyash
|
||||
// test_python_parser_phase1.hako
|
||||
local py = new PythonParserBox()
|
||||
|
||||
// Phase 1: 基本的な関数定義と演算
|
||||
@ -513,7 +513,7 @@ export NYASH_PYTHONPARSER_TELEMETRY=2 # 詳細ログ
|
||||
export NYASH_PYTHONPARSER_STRICT=1 # フォールバック時にパニック
|
||||
|
||||
# 実行例
|
||||
./target/release/nyash test_python_parser.nyash
|
||||
./target/release/nyash test_python_parser.hako
|
||||
|
||||
# 出力
|
||||
[PythonParser] Module: test.py (Python 3.11)
|
||||
|
||||
@ -46,7 +46,7 @@ result = add(10, 5)
|
||||
## 🛠️ コマンドラインツール
|
||||
```bash
|
||||
# 基本変換
|
||||
nyash-transpile input.py -o output.nyash
|
||||
nyash-transpile input.py -o output.hako
|
||||
|
||||
# 変換統計付き
|
||||
nyash-transpile --stats complex.py
|
||||
|
||||
@ -21,7 +21,7 @@ for i in range(10):
|
||||
↓ 変換
|
||||
|
||||
```nyash
|
||||
# output.nyash
|
||||
# output.hako
|
||||
function calculate(x, y) {
|
||||
local result
|
||||
result = x * 2 + y
|
||||
@ -74,7 +74,7 @@ impl PythonParserBox {
|
||||
### コマンドライン版
|
||||
```bash
|
||||
# PythonファイルをNyashに変換
|
||||
nyash-transpile input.py -o output.nyash
|
||||
nyash-transpile input.py -o output.hako
|
||||
|
||||
# 標準出力に出力
|
||||
nyash-transpile script.py
|
||||
@ -94,7 +94,7 @@ local python_code = FileBox.read("algorithm.py")
|
||||
local nyash_code = transpiler.to_nyash_source(python_code)
|
||||
|
||||
// ファイルに保存
|
||||
FileBox.write("algorithm.nyash", nyash_code)
|
||||
FileBox.write("algorithm.hako", nyash_code)
|
||||
|
||||
// または直接実行
|
||||
eval(nyash_code)
|
||||
|
||||
@ -17,8 +17,8 @@ Python統合を本格化する前に、配布可能なネイティブ実行フ
|
||||
|
||||
## ✅ 成果(DoD)
|
||||
- `cargo build --release --features cranelift-jit` の後、
|
||||
- Linux: `./tools/build_aot.sh examples/aot_min_string_len.nyash -o app && ./app`
|
||||
- Windows: `powershell -ExecutionPolicy Bypass -File tools\build_aot.ps1 -Input examples\aot_min_string_len.nyash -Out app.exe && .\app.exe`
|
||||
- Linux: `./tools/build_aot.sh examples/aot_min_string_len.hako -o app && ./app`
|
||||
- Windows: `powershell -ExecutionPolicy Bypass -File tools\build_aot.ps1 -Input examples\aot_min_string_len.hako -Out app.exe && .\app.exe`
|
||||
- プラグインは `.so` 記述でも各OSで自動解決(.dll/.dylib へ変換、lib剥がし)
|
||||
- `tools/smoke_aot_vs_vm.sh` で VM/EXE の `Result:` 行比較が可能(差異は警告表示)
|
||||
|
||||
|
||||
@ -69,7 +69,7 @@
|
||||
|
||||
### 10.5d JIT/AOT 統合(3–5日)
|
||||
- AOTパイプライン固定: Lower→CLIF→OBJ出力→`ny_main`+`libnyrt.a`リンク→EXE
|
||||
- CLI: `nyash --compile-native file.nyash -o app` を追加(失敗は非ゼロ終了)
|
||||
- CLI: `nyash --compile-native file.hako -o app` を追加(失敗は非ゼロ終了)
|
||||
- libnyrt: `nyash.python.*` 等のシムを提供し、未解決シンボル解決
|
||||
- ディスパッチ: type_id→`nyplug_*_invoke` の静的/動的ルート(第一段は動的優先)
|
||||
|
||||
@ -79,8 +79,8 @@
|
||||
- ドキュメント: 使用例、制約(GIL/スレッド)、AOT時のリンク・ランタイム要件
|
||||
|
||||
追加済みサンプル(最小チェーン)
|
||||
- VM: `examples/py_min_chain_vm.nyash`(import→getattr→call→println)
|
||||
- AOT: `examples/aot_py_min_chain.nyash`(import→getattr→call→return)
|
||||
- VM: `examples/py_min_chain_vm.hako`(import→getattr→call→println)
|
||||
- AOT: `examples/aot_py_min_chain.hako`(import→getattr→call→return)
|
||||
|
||||
## 🎯 DoD(定義)
|
||||
- NyashからPythonコードを評価し、PyObjectをHandleで往復できる
|
||||
|
||||
@ -6,8 +6,8 @@
|
||||
1) 到達イメージ(DoD)
|
||||
====================
|
||||
- Linux/Windows で以下が安定動作:
|
||||
- AOT: `examples/aot_py_min_chain.nyash` → `Result: 4`(math.sqrt(16))
|
||||
- VM: `examples/py_min_chain_vm.nyash` → 4.0 表示(NYASH_PY_AUTODECODE=1)
|
||||
- AOT: `examples/aot_py_min_chain.hako` → `Result: 4`(math.sqrt(16))
|
||||
- VM: `examples/py_min_chain_vm.hako` → 4.0 表示(NYASH_PY_AUTODECODE=1)
|
||||
- returns_result 系サンプル(importR/getattrR/callR)で Ok/Err が期待通りに表示
|
||||
- AOTビルドの配布体験が明確:
|
||||
- `tools/build_aot.{sh,ps1}` で .o → EXE、`nyash.toml`/plugins 解決、Windowsでは PATH/PYTHONHOME 調整
|
||||
@ -66,7 +66,7 @@ M5: 観測/CI(軽量)
|
||||
====================
|
||||
6) 成果物(Artifacts)
|
||||
====================
|
||||
- 例: `examples/aot_py_min_chain.nyash`, `examples/py_min_chain_vm.nyash`(既存)
|
||||
- 例: `examples/aot_py_min_chain.hako`, `examples/py_min_chain_vm.hako`(既存)
|
||||
- ツール: `tools/build_aot.{sh,ps1}`(Python節)、`tools/smoke_aot_vs_vm.sh`(Python最小)
|
||||
- Docs: `docs/guides/build/aot_quickstart.md`(Python節)、`docs/reference/abi/ffi_calling_convention_min.md`(bytes/N引数注記)
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
### 使用例1: 基本的な関数のネイティブ化
|
||||
|
||||
```nyash
|
||||
// example1_basic.nyash
|
||||
// example1_basic.hako
|
||||
// Pythonコードをネイティブコンパイル
|
||||
|
||||
// Step 1: Pythonコードを用意
|
||||
@ -51,7 +51,7 @@ if mir_module.isOk() {
|
||||
### 使用例2: コンパイル可否の明確な判定
|
||||
|
||||
```nyash
|
||||
// example2_clear_separation.nyash
|
||||
// example2_clear_separation.hako
|
||||
// コンパイルできるかどうか事前に判定
|
||||
|
||||
// Phase 1対応のコード
|
||||
@ -107,7 +107,7 @@ if result2.isOk() {
|
||||
### 使用例3: プログレッシブ最適化
|
||||
|
||||
```nyash
|
||||
// example3_progressive.nyash
|
||||
// example3_progressive.hako
|
||||
// 実行しながら徐々に最適化
|
||||
|
||||
// 型推論付きコンパイラー
|
||||
@ -153,7 +153,7 @@ for i in range(5) {
|
||||
### 使用例4: 言語間相互運用
|
||||
|
||||
```nyash
|
||||
// example4_interop.nyash
|
||||
// example4_interop.hako
|
||||
// PythonコードとNyashコードのシームレスな連携
|
||||
|
||||
// Pythonで数値計算関数を定義
|
||||
@ -198,7 +198,7 @@ box GameObject {
|
||||
### 使用例5: デバッグとプロファイリング
|
||||
|
||||
```nyash
|
||||
// example5_debug.nyash
|
||||
// example5_debug.hako
|
||||
// 開発時のデバッグ支援
|
||||
|
||||
// デバッグモード有効
|
||||
|
||||
@ -59,7 +59,7 @@ fn test_compile_arithmetic() {
|
||||
### 2. Differential Testing Framework
|
||||
|
||||
```nyash
|
||||
// tests/differential/framework.nyash
|
||||
// tests/differential/framework.hako
|
||||
box DifferentialTester {
|
||||
init { oracle, implementation, results }
|
||||
|
||||
@ -145,7 +145,7 @@ def test_arithmetic_properties(x, y):
|
||||
### 4. ベンチマークスイート
|
||||
|
||||
```nyash
|
||||
// benchmarks/numeric_suite.nyash
|
||||
// benchmarks/numeric_suite.hako
|
||||
box NumericBenchmark {
|
||||
run() {
|
||||
local suite = new BenchmarkSuite()
|
||||
|
||||
@ -52,7 +52,7 @@
|
||||
5) ベンチと回帰(最小)
|
||||
- 目標: ラインの性能/退行の早期検知
|
||||
- タスク:
|
||||
- ny_bench.nyash のケース整理(関数呼出/Map set-get/branch)
|
||||
- ny_bench.hako のケース整理(関数呼出/Map set-get/branch)
|
||||
- compare: VM vs JIT(ウォームアップ付き)
|
||||
- 受入: ベンチ出力に JIT/VM の比較が出る(改善/退行が見える)
|
||||
|
||||
@ -71,15 +71,15 @@
|
||||
```bash
|
||||
# math.min(関数スタイル)
|
||||
NYASH_JIT_EXEC=1 NYASH_JIT_THRESHOLD=1 NYASH_JIT_NATIVE_F64=1 NYASH_JIT_EVENTS=1 \
|
||||
./target/release/nyash --backend vm examples/jit_math_function_style_min_float.nyash
|
||||
./target/release/nyash --backend vm examples/jit_math_function_style_min_float.hako
|
||||
|
||||
# Map.get HH直実行
|
||||
NYASH_JIT_EXEC=1 NYASH_JIT_THRESHOLD=1 NYASH_JIT_HOSTCALL=1 NYASH_JIT_EVENTS=1 \
|
||||
./target/release/nyash --backend vm examples/jit_map_get_param_hh.nyash
|
||||
./target/release/nyash --backend vm examples/jit_map_get_param_hh.hako
|
||||
|
||||
# Mutating opt-in(Array.push)
|
||||
NYASH_JIT_EXEC=1 NYASH_JIT_THRESHOLD=1 NYASH_JIT_HOSTCALL=1 NYASH_JIT_EVENTS=1 \
|
||||
./target/release/nyash --backend vm examples/jit_policy_optin_mutating.nyash
|
||||
./target/release/nyash --backend vm examples/jit_policy_optin_mutating.hako
|
||||
|
||||
## 例とスモーク(開発者向けクイック)
|
||||
- 例一覧: `examples/README.md`(HH直実行・mutating opt-in・GCデモ)
|
||||
|
||||
@ -11,7 +11,7 @@ How-To (Local)
|
||||
(env)
|
||||
set NYASH_GC_BARRIER_STRICT=1
|
||||
set NYASH_GC_TRACE=1
|
||||
nyash <program.nyash>
|
||||
nyash <program.hako>
|
||||
|
||||
Expected
|
||||
- Barrier sites log to stderr.
|
||||
|
||||
@ -25,7 +25,7 @@ Deliverables
|
||||
- Lowering updates: Branch/Jump hook uses real block IDs; Compare emits b1-friendly shape.
|
||||
- Env flags: Reuse `NYASH_JIT_EXEC/THRESHOLD/STATS/DUMP`; guard hostcalls by `NYASH_JIT_HOSTCALL`.
|
||||
- Docs: Update execution-backends.md with “JIT control-flow coverage (10.7)”.
|
||||
- Examples: `examples/jit_branch_demo.nyash` (if/loop minimal).
|
||||
- Examples: `examples/jit_branch_demo.hako` (if/loop minimal).
|
||||
|
||||
Design Sketch
|
||||
1) Block Mapping
|
||||
@ -59,13 +59,13 @@ Implementation Plan (Tasks)
|
||||
- For Branch/Jump, call builder with mapped blocks and condition value hint.
|
||||
- Compare: emit b1 icmp; when Compare is used as value elsewhere, allow i64 extend as needed.
|
||||
- T4: Minimal PHI support for a single merge (optional; guarded by env `NYASH_JIT_PHI_MIN=1`).
|
||||
- T5: Add `examples/jit_branch_demo.nyash` with: `if (a < b) { return 1 } else { return 2 }` and a small loop with early `return`.
|
||||
- T5: Add `examples/jit_branch_demo.hako` with: `if (a < b) { return 1 } else { return 2 }` and a small loop with early `return`.
|
||||
- T6: Docs update: execution-backends.md “JIT coverage 10.7” + env flags.
|
||||
- T7: Bench (optional): integrate into `--benchmark` with JIT warmup when `NYASH_JIT_EXEC=1`.
|
||||
|
||||
Validation
|
||||
- Build matrix: with/without `cranelift-jit` feature.
|
||||
- Smoke tests: run `jit_branch_demo.nyash` with `NYASH_JIT_EXEC=1 NYASH_JIT_THRESHOLD=1`.
|
||||
- Smoke tests: run `jit_branch_demo.hako` with `NYASH_JIT_EXEC=1 NYASH_JIT_THRESHOLD=1`.
|
||||
- Fallback verification: force a path with unsupported op to confirm VM fallback.
|
||||
- GC/scheduler: ensure safepoint path still works (unchanged).
|
||||
|
||||
|
||||
@ -14,10 +14,10 @@ Flags and CLI (common across 10.7)
|
||||
- CLI: --jit-exec --jit-stats --jit-stats-json --jit-dump --jit-threshold N --jit-phi-min --jit-hostcall
|
||||
|
||||
Examples to validate
|
||||
- examples/jit_branch_demo.nyash
|
||||
- examples/jit_loop_early_return.nyash
|
||||
- examples/jit_phi_demo.nyash
|
||||
- examples/jit_array_param_call.nyash, jit_map_param_call.nyash (when hostcall is enabled)
|
||||
- examples/jit_branch_demo.hako
|
||||
- examples/jit_loop_early_return.hako
|
||||
- examples/jit_phi_demo.hako
|
||||
- examples/jit_array_param_call.hako, jit_map_param_call.hako (when hostcall is enabled)
|
||||
|
||||
Sub-phases (10.7a → 10.7h)
|
||||
|
||||
|
||||
@ -42,9 +42,9 @@ Non-Goals (later 10.7b+)
|
||||
|
||||
Deliverables
|
||||
- Working minimal PHI + branch JIT execution on curated examples:
|
||||
- examples/jit_branch_demo.nyash
|
||||
- examples/jit_loop_early_return.nyash
|
||||
- examples/jit_phi_demo.nyash (single-PHI diamond)
|
||||
- examples/jit_branch_demo.hako
|
||||
- examples/jit_loop_early_return.hako
|
||||
- examples/jit_phi_demo.hako (single-PHI diamond)
|
||||
- Fallback correctness: traps/panic → VM path; results match VM
|
||||
- Configurable via CLI flags; metrics visible via JIT summary/JSON
|
||||
|
||||
|
||||
@ -67,11 +67,11 @@
|
||||
- `NYASH_JIT_EVENTS=1`(標準出力へJSON)
|
||||
- 任意: `NYASH_JIT_EVENTS_PATH=target/nyash/jit-events.jsonl`
|
||||
- 代表サンプル(VM経由でJITパス通過)
|
||||
- 成功: `./target/release/nyash --backend vm examples/jit_hostcall_len_string.nyash`
|
||||
- 失敗: `NYASH_JIT_EVENTS=1 ./target/release/nyash --backend vm examples/jit_hostcall_array_append.nyash`
|
||||
- 境界: `NYASH_JIT_EVENTS=1 ./target/release/nyash --backend vm examples/jit_hostcall_math_sin_mismatch.nyash`
|
||||
- 署名一致(allow観測): `NYASH_JIT_EVENTS=1 ./target/release/nyash --backend vm examples/jit_hostcall_math_sin_allow_float.nyash`
|
||||
- 関数スタイル(math.*): `NYASH_JIT_NATIVE_F64=1 NYASH_JIT_EVENTS=1 ./target/release/nyash --backend vm examples/jit_math_function_style_sin_float.nyash`
|
||||
- 成功: `./target/release/nyash --backend vm examples/jit_hostcall_len_string.hako`
|
||||
- 失敗: `NYASH_JIT_EVENTS=1 ./target/release/nyash --backend vm examples/jit_hostcall_array_append.hako`
|
||||
- 境界: `NYASH_JIT_EVENTS=1 ./target/release/nyash --backend vm examples/jit_hostcall_math_sin_mismatch.hako`
|
||||
- 署名一致(allow観測): `NYASH_JIT_EVENTS=1 ./target/release/nyash --backend vm examples/jit_hostcall_math_sin_allow_float.hako`
|
||||
- 関数スタイル(math.*): `NYASH_JIT_NATIVE_F64=1 NYASH_JIT_EVENTS=1 ./target/release/nyash --backend vm examples/jit_math_function_style_sin_float.hako`
|
||||
- `cos/abs/min/max` も同様のサンプルあり
|
||||
- 詰まったら
|
||||
- `--features cranelift-jit` が付いているか
|
||||
@ -98,15 +98,15 @@
|
||||
```bash
|
||||
# math.*(関数スタイル): 署名一致でallow、戻りFloat表示
|
||||
NYASH_JIT_EXEC=1 NYASH_JIT_THRESHOLD=1 NYASH_JIT_NATIVE_F64=1 NYASH_JIT_EVENTS=1 \
|
||||
./target/release/nyash --backend vm examples/jit_math_function_style_min_float.nyash
|
||||
./target/release/nyash --backend vm examples/jit_math_function_style_min_float.hako
|
||||
|
||||
# Map.get(パラメータ受け+Handleキー → HH直実行)
|
||||
NYASH_JIT_EXEC=1 NYASH_JIT_THRESHOLD=1 NYASH_JIT_HOSTCALL=1 NYASH_JIT_EVENTS=1 \
|
||||
./target/release/nyash --backend vm examples/jit_map_get_param_hh.nyash
|
||||
./target/release/nyash --backend vm examples/jit_map_get_param_hh.hako
|
||||
|
||||
# Map.get(非パラメータ受け → fallback記録)
|
||||
NYASH_JIT_EXEC=1 NYASH_JIT_THRESHOLD=1 NYASH_JIT_HOSTCALL=1 NYASH_JIT_EVENTS=1 \
|
||||
./target/release/nyash --backend vm examples/jit_hostcall_map_get_handle.nyash
|
||||
./target/release/nyash --backend vm examples/jit_hostcall_map_get_handle.hako
|
||||
```
|
||||
|
||||
### ⚙️ Quick flags(イベント観測を確実に)
|
||||
|
||||
@ -104,9 +104,9 @@ Status(2025-08-27)
|
||||
```bash
|
||||
cargo build --features cranelift-jit --release
|
||||
NYASH_JIT_THRESHOLD=1 NYASH_JIT_HOSTCALL=1 NYASH_JIT_EXEC=1 \
|
||||
./target/release/nyash --backend vm examples/jit_array_param_call.nyash
|
||||
./target/release/nyash --backend vm examples/jit_array_param_call.hako
|
||||
NYASH_JIT_THRESHOLD=1 NYASH_JIT_HOSTCALL=1 NYASH_JIT_EXEC=1 \
|
||||
./target/release/nyash --backend vm examples/jit_map_param_call.nyash
|
||||
./target/release/nyash --backend vm examples/jit_map_param_call.hako
|
||||
```
|
||||
Notes
|
||||
- 関数パラメータに渡した配列/MapのみHostCall経由でアクセス(thread-local引数参照)
|
||||
@ -238,12 +238,12 @@ JIT実装(10_a~10_h)で構築したMIR→CLIF変換基盤をそのまま
|
||||
### 使用イメージ
|
||||
```bash
|
||||
# ネイティブ実行ファイル生成
|
||||
./target/release/nyash --compile-native program.nyash -o program
|
||||
./target/release/nyash --compile-native program.hako -o program
|
||||
./program # スタンドアロン実行!
|
||||
|
||||
# クロスコンパイル
|
||||
./target/release/nyash --compile-native --target x86_64-pc-windows-msvc program.nyash -o program.exe
|
||||
./target/release/nyash --compile-native --target aarch64-apple-darwin program.nyash -o program.mac
|
||||
./target/release/nyash --compile-native --target x86_64-pc-windows-msvc program.hako -o program.exe
|
||||
./target/release/nyash --compile-native --target aarch64-apple-darwin program.hako -o program.mac
|
||||
```
|
||||
|
||||
### 技術的詳細
|
||||
|
||||
@ -210,10 +210,10 @@ function sumStringLengths(strings) {
|
||||
### 2. プロファイリング
|
||||
```bash
|
||||
# Mutexプロファイル
|
||||
NYASH_PROFILE_LOCKS=1 ./target/release/nyash bench.nyash
|
||||
NYASH_PROFILE_LOCKS=1 ./target/release/nyash bench.hako
|
||||
|
||||
# Atomic最適化後
|
||||
NYASH_ATOMIC_OPT=1 ./target/release/nyash bench.nyash
|
||||
NYASH_ATOMIC_OPT=1 ./target/release/nyash bench.hako
|
||||
```
|
||||
|
||||
## 🚧 実装上の注意点
|
||||
|
||||
@ -265,10 +265,10 @@ async function fetchAll(urls) {
|
||||
### 2. ベンチマーク
|
||||
```bash
|
||||
# 10000並行リクエスト
|
||||
./target/release/nyash bench/async_stress.nyash
|
||||
./target/release/nyash bench/async_stress.hako
|
||||
|
||||
# メモリプロファイル
|
||||
NYASH_COROUTINE_STATS=1 ./target/release/nyash bench/async_memory.nyash
|
||||
NYASH_COROUTINE_STATS=1 ./target/release/nyash bench/async_memory.hako
|
||||
```
|
||||
|
||||
## 🚧 実装上の注意点
|
||||
|
||||
@ -10,7 +10,7 @@ Phase 11.5完了を待たずに、**今すぐ作れる**実用アプリ5本で
|
||||
**目的**: I/O・StringBoxの道通し確認
|
||||
|
||||
```nyash
|
||||
// apps/ny-echo/main.nyash
|
||||
// apps/ny-echo/main.hako
|
||||
static box Main {
|
||||
main(args) {
|
||||
local console = new ConsoleBox()
|
||||
@ -42,7 +42,7 @@ static box Main {
|
||||
**目的**: PyRuntimeBox/PyObjectBox経由のPluginInvoke検証
|
||||
|
||||
```nyash
|
||||
// apps/ny-jsonlint/main.nyash
|
||||
// apps/ny-jsonlint/main.hako
|
||||
static box Main {
|
||||
init { py, console }
|
||||
|
||||
@ -85,7 +85,7 @@ except Exception as e:
|
||||
**目的**: ArrayBox map/reduce、StatsBox導入、性能可視化
|
||||
|
||||
```nyash
|
||||
// apps/ny-array-bench/main.nyash
|
||||
// apps/ny-array-bench/main.hako
|
||||
static box Main {
|
||||
init { stats }
|
||||
|
||||
@ -139,7 +139,7 @@ static box Main {
|
||||
**目的**: BytesBox/FileBox(プラグイン)I/O、実用的なツール
|
||||
|
||||
```nyash
|
||||
// apps/ny-filegrep/main.nyash
|
||||
// apps/ny-filegrep/main.hako
|
||||
static box Main {
|
||||
init { pattern, recursive, results }
|
||||
|
||||
@ -202,7 +202,7 @@ static box Main {
|
||||
**目的**: NetBox(プラグイン)とイベントループ、FutureBox活用
|
||||
|
||||
```nyash
|
||||
// apps/ny-http-hello/main.nyash
|
||||
// apps/ny-http-hello/main.hako
|
||||
static box Main {
|
||||
init { server, running }
|
||||
|
||||
@ -292,7 +292,7 @@ nyash-apps-v1.0/
|
||||
│ ├── ny-filegrep[.exe]
|
||||
│ └── ny-http-hello[.exe]
|
||||
├── examples/
|
||||
│ └── *.nyash (ソースコード)
|
||||
│ └── *.hako (ソースコード)
|
||||
├── benchmarks/
|
||||
│ └── results.json
|
||||
└── README.md
|
||||
|
||||
@ -152,7 +152,7 @@ mod migration_tests {
|
||||
|
||||
#[test]
|
||||
fn test_unified_vs_legacy_semantics() {
|
||||
let test_cases = load_test_cases("tests/semantics/*.nyash");
|
||||
let test_cases = load_test_cases("tests/semantics/*.hako");
|
||||
|
||||
for case in test_cases {
|
||||
let legacy_result = legacy_interpreter.execute(&case);
|
||||
|
||||
@ -9,8 +9,8 @@ MIR→LLVM IR直接変換による最高性能AOT実現。Cranelift JITをスキ
|
||||
## 🎯 実装目標
|
||||
```bash
|
||||
# Phase 9基盤の拡張
|
||||
nyash --compile-llvm app.nyash -o app # LLVM AOT実行ファイル生成
|
||||
nyash --optimize app.nyash -o app # 最適化AOT(LTO・PGO)
|
||||
nyash --compile-llvm app.hako -o app # LLVM AOT実行ファイル生成
|
||||
nyash --optimize app.hako -o app # 最適化AOT(LTO・PGO)
|
||||
./app # 最高性能実行
|
||||
|
||||
# 内部実装パイプライン
|
||||
|
||||
@ -12,7 +12,7 @@ Last Updated: 2025-08-25
|
||||
- ExternCall命令(Phase 9.7)導入予定。ABIは`docs/予定/native-plan/box_ffi_abi.md`に準拠。
|
||||
|
||||
アウトカム(受け入れ基準)
|
||||
- CLI: `nyash --backend llvm --emit obj app.nyash -o app.o` が成功し、`clang app.o -o app` で実行可能。
|
||||
- CLI: `nyash --backend llvm --emit obj app.hako -o app.o` が成功し、`clang app.o -o app` で実行可能。
|
||||
- 代表サンプルで `main` が `i32` を返却(0=成功)。
|
||||
- `ExternCall(env.console.log)` を `printf` 等へ写像し、標準出力へ表示できる(文字列は (i8*, i32))。
|
||||
- 単純な四則演算・比較・分岐・ループが LLVM AOT で動作。
|
||||
|
||||
@ -146,7 +146,7 @@ impl OptPass for DeadCodeElimPass {
|
||||
|
||||
```bash
|
||||
# MIRからCへ変換
|
||||
nyash --emit-c program.nyash -o program.c
|
||||
nyash --emit-c program.hako -o program.c
|
||||
|
||||
# 最適化コンパイル
|
||||
zig cc -O3 -flto -march=native \
|
||||
@ -178,7 +178,7 @@ zig cc -O3 -fprofile-use program.c -o program_opt
|
||||
## 5. 性能測定の例
|
||||
|
||||
```nyash
|
||||
// benchmark.nyash
|
||||
// benchmark.hako
|
||||
static box Benchmark {
|
||||
main() {
|
||||
local start, end, result
|
||||
|
||||
@ -89,27 +89,27 @@ Branch(cond, then, else) → {likely: Some(true)} // thenが高確率
|
||||
Level 0: 開発モード
|
||||
- MIR最適化なし
|
||||
- デバッグ情報完全保持
|
||||
- nyash program.nyash
|
||||
- nyash program.hako
|
||||
|
||||
Level 1: 基本最適化(デフォルト)
|
||||
- MIRカノニカル化のみ
|
||||
- Cエミッタ → gcc -O2
|
||||
- nyash --release program.nyash
|
||||
- nyash --release program.hako
|
||||
|
||||
Level 2: 高速化
|
||||
- MIR全最適化パス
|
||||
- Cエミッタ → zig cc -O3 -flto
|
||||
- nyash --release --opt program.nyash
|
||||
- nyash --release --opt program.hako
|
||||
|
||||
Level 3: プロファイルガイド(PGO)
|
||||
- 実行プロファイル収集
|
||||
- ホットパス特定
|
||||
- nyash --release --pgo program.nyash
|
||||
- nyash --release --pgo program.hako
|
||||
|
||||
Level 4: 特殊用途
|
||||
- SIMD必要 → LLVM使用(ただし依存が重い)
|
||||
- 起動速度重視 → Cranelift JIT(推奨)
|
||||
- nyash --backend cranelift program.nyash
|
||||
- nyash --backend cranelift program.hako
|
||||
|
||||
================================================================================
|
||||
5. 実装計画
|
||||
|
||||
@ -231,9 +231,9 @@ override → O # オーバーライド
|
||||
**すべての糖衣構文は双方向変換可能:**
|
||||
```bash
|
||||
# フォーマッターによる自由な変換
|
||||
nyash format --style=explicit code.nyash # 明示的記法へ
|
||||
nyash format --style=sugar code.nyash # 糖衣構文へ
|
||||
nyash format --style=ancp code.nyash # 極限圧縮へ
|
||||
nyash format --style=explicit code.hako # 明示的記法へ
|
||||
nyash format --style=sugar code.hako # 糖衣構文へ
|
||||
nyash format --style=ancp code.hako # 極限圧縮へ
|
||||
```
|
||||
|
||||
**同じコードの3つの表現:**
|
||||
|
||||
@ -54,9 +54,9 @@ onHover(position) {
|
||||
### Phase 2: 実用化(2週間目)
|
||||
1. **CLI実装**(Codex提案)
|
||||
```bash
|
||||
ancp encode --layer F input.nyash -o output.f
|
||||
ancp encode --layer F input.hako -o output.f
|
||||
ancp decode output.f --map output.map
|
||||
ancp verify input.nyash output.f # MIR等価性チェック
|
||||
ancp verify input.hako output.f # MIR等価性チェック
|
||||
```
|
||||
|
||||
2. **プロジェクト辞書**(Gemini提案)
|
||||
|
||||
@ -102,7 +102,7 @@ esac
|
||||
|
||||
### Test 1: 最小Box
|
||||
```nyash
|
||||
# input.nyash
|
||||
# input.hako
|
||||
box Test {
|
||||
init { value }
|
||||
}
|
||||
@ -113,7 +113,7 @@ $Test{#{value}}
|
||||
|
||||
### Test 2: 簡単な関数
|
||||
```nyash
|
||||
# input.nyash
|
||||
# input.hako
|
||||
box Calculator {
|
||||
add(a, b) {
|
||||
return a + b
|
||||
|
||||
@ -252,22 +252,22 @@ peek ast {
|
||||
### ステップ1: 標準コードを書く
|
||||
```bash
|
||||
# 通常のNyashで開発
|
||||
vim src/feature.nyash
|
||||
vim src/feature.hako
|
||||
```
|
||||
|
||||
### ステップ2: 段階的圧縮
|
||||
```bash
|
||||
# L1: 糖衣構文適用
|
||||
nyashfmt --sugar src/feature.nyash > feature.sugar.nyash
|
||||
nyashfmt --sugar src/feature.hako > feature.sugar.hako
|
||||
|
||||
# L2: ANCP変換
|
||||
nyash2ancp feature.sugar.nyash > feature.ancp
|
||||
nyash2ancp feature.sugar.hako > feature.ancp
|
||||
|
||||
# L3: 極限糖衣
|
||||
nyashfmt --ultra feature.ancp > feature.ultra.nyash
|
||||
nyashfmt --ultra feature.ancp > feature.ultra.hako
|
||||
|
||||
# L4: 最大圧縮
|
||||
nyash2fusion feature.ultra.nyash > feature.fusion
|
||||
nyash2fusion feature.ultra.hako > feature.fusion
|
||||
```
|
||||
|
||||
### ステップ3: AIとの対話
|
||||
@ -284,10 +284,10 @@ cat *.fusion | clip
|
||||
### ステップ4: 可逆展開
|
||||
```bash
|
||||
# AIの応答を展開
|
||||
fusion2nyash --level=0 ai_response.fusion > fixed.nyash
|
||||
fusion2nyash --level=0 ai_response.fusion > fixed.hako
|
||||
|
||||
# 差分確認
|
||||
diff src/feature.nyash fixed.nyash
|
||||
diff src/feature.hako fixed.hako
|
||||
```
|
||||
|
||||
## 🛠️ ツールチェーン
|
||||
|
||||
@ -251,9 +251,9 @@ r=d\:_.isValid()/:_|>n|>t
|
||||
### 可逆変換の保証
|
||||
```bash
|
||||
# どの形式からでも相互変換可能
|
||||
nyash format --from=explicit --to=sugar code.nyash
|
||||
nyash format --from=sugar --to=ancp code.nyash
|
||||
nyash format --from=ancp --to=explicit code.nyash
|
||||
nyash format --from=explicit --to=sugar code.hako
|
||||
nyash format --from=sugar --to=ancp code.hako
|
||||
nyash format --from=ancp --to=explicit code.hako
|
||||
```
|
||||
|
||||
## 🚀 Phase 15との相乗効果
|
||||
|
||||
@ -178,7 +178,7 @@ result"
|
||||
5. 使用例:コマンドラインツール
|
||||
================================================================================
|
||||
|
||||
// nyashfmt.nyash - フォーマッターCLI
|
||||
// nyashfmt.hako - フォーマッターCLI
|
||||
static box Main {
|
||||
main(args) {
|
||||
local formatter = new NyashFormatter()
|
||||
@ -285,7 +285,7 @@ box LearningMode {
|
||||
8. 設定ファイル
|
||||
================================================================================
|
||||
|
||||
// .nyashfmt.json - プロジェクト別設定
|
||||
// .hakofmt.json - プロジェクト別設定
|
||||
{
|
||||
"mode": "standard",
|
||||
"rules": {
|
||||
|
||||
@ -156,7 +156,7 @@ impl SourceMap {
|
||||
// ANCP位置 → Nyash位置への変換
|
||||
self.mappings
|
||||
.binary_search_by_key(&ancp_pos, |m| m.ancp_pos)
|
||||
.map(|i| self.mappings[i].nyash_pos)
|
||||
.map(|i| self.mappings[i].hako_pos)
|
||||
.unwrap_or(ancp_pos)
|
||||
}
|
||||
}
|
||||
@ -214,7 +214,7 @@ expected_pattern=$2
|
||||
normal_output=$(./target/release/nyash "$test_file" 2>&1)
|
||||
|
||||
# 2. ANCP変換
|
||||
ancp_file="${test_file%.nyash}.ancp"
|
||||
ancp_file="${test_file%.hako}.ancp"
|
||||
./target/release/nyash2ancp -i "$test_file" -o "$ancp_file"
|
||||
|
||||
# 3. ANCP実行
|
||||
@ -289,8 +289,8 @@ def measure_file(nyash_path, ancp_path):
|
||||
|
||||
# 全サンプルファイルで測定
|
||||
results = []
|
||||
for nyash_file in glob.glob("examples/*.nyash"):
|
||||
ancp_file = nyash_file.replace(".nyash", ".ancp")
|
||||
for nyash_file in glob.glob("examples/*.hako"):
|
||||
ancp_file = nyash_file.replace(".hako", ".ancp")
|
||||
results.append(measure_file(nyash_file, ancp_file))
|
||||
|
||||
# 統計出力
|
||||
@ -316,7 +316,7 @@ jobs:
|
||||
|
||||
- name: Run roundtrip tests
|
||||
run: |
|
||||
for f in examples/*.nyash; do
|
||||
for f in examples/*.hako; do
|
||||
echo "Testing: $f"
|
||||
./tools/test_ancp_roundtrip.sh "$f"
|
||||
done
|
||||
|
||||
@ -161,14 +161,14 @@ impl Lexer {
|
||||
### 5.2 CLI統合
|
||||
```bash
|
||||
# 変換コマンド
|
||||
nyash --to-ancp input.nyash > output.ancp
|
||||
nyash --from-ancp input.ancp > output.nyash
|
||||
nyash --to-ancp input.hako > output.ancp
|
||||
nyash --from-ancp input.ancp > output.hako
|
||||
|
||||
# 直接実行
|
||||
nyash --dialect=ancp script.ancp
|
||||
|
||||
# フォーマット表示
|
||||
nyash --view=ancp script.nyash # Nyashファイルをancp形式で表示
|
||||
nyash --view=ancp script.hako # Nyashファイルをancp形式で表示
|
||||
nyash --view=hybrid script.ancp # 並列表示
|
||||
```
|
||||
|
||||
@ -209,7 +209,7 @@ fn roundtrip_all_constructs() {
|
||||
"loop(i < 10) { i = i + 1 }",
|
||||
|
||||
// 複雑な例
|
||||
include_str!("../examples/complex.nyash"),
|
||||
include_str!("../examples/complex.hako"),
|
||||
];
|
||||
|
||||
for case in test_cases {
|
||||
|
||||
@ -198,7 +198,7 @@ Expected 'token' but found 'actual'
|
||||
【エラーメッセージ例】
|
||||
```
|
||||
Error: Missing 'else' in peek expression
|
||||
--> program.nyash:10:5
|
||||
--> program.hako:10:5
|
||||
|
|
||||
10 | peek value {
|
||||
| ^^^^ peek expression requires 'else' branch
|
||||
|
||||
@ -167,7 +167,7 @@ if animal == "dog" {
|
||||
================================================================================
|
||||
|
||||
```nyash
|
||||
// test_peek_basic.nyash
|
||||
// test_peek_basic.hako
|
||||
local animal = "cat"
|
||||
local sound = peek animal {
|
||||
"dog" => "woof"
|
||||
@ -176,7 +176,7 @@ local sound = peek animal {
|
||||
}
|
||||
print(sound) // "meow"
|
||||
|
||||
// test_peek_block.nyash
|
||||
// test_peek_block.hako
|
||||
local result = peek x {
|
||||
1 => {
|
||||
local temp = "one"
|
||||
@ -185,7 +185,7 @@ local result = peek x {
|
||||
else => "other"
|
||||
}
|
||||
|
||||
// test_continue.nyash
|
||||
// test_continue.hako
|
||||
local i = 0
|
||||
local sum = 0
|
||||
loop(i < 5) {
|
||||
@ -197,7 +197,7 @@ loop(i < 5) {
|
||||
}
|
||||
print(sum) // 12 (1+2+4+5, 3はスキップ)
|
||||
|
||||
// test_field_declaration.nyash
|
||||
// test_field_declaration.hako
|
||||
box Point {
|
||||
public x: IntegerBox
|
||||
public y: IntegerBox
|
||||
|
||||
@ -134,7 +134,7 @@ processor.process(3.14) # すべてプラグインで動作!
|
||||
|
||||
```
|
||||
Nyashエコシステム(統一TypeBox ABI採用後):
|
||||
├── Nyashスクリプトプラグイン ← .nyashファイル(純粋なNyashコード)
|
||||
├── Nyashスクリプトプラグイン ← .hakoファイル(純粋なNyashコード)
|
||||
└── 統一TypeBoxプラグイン ← .so/.dll(ネイティブ実装)
|
||||
├── 基本機能(旧C ABI互換)
|
||||
├── 高速ディスパッチ(JIT最適化)
|
||||
|
||||
@ -195,7 +195,7 @@ tests/abi/
|
||||
|
||||
### nyash.toml設定
|
||||
```toml
|
||||
[plugins.nyash_abi_provider]
|
||||
[plugins.hako_abi_provider]
|
||||
path = "plugins/nyash_abi_provider.so"
|
||||
abi = "c"
|
||||
types = ["NyashABIProvider"]
|
||||
|
||||
@ -54,10 +54,10 @@ AIの頭の中:
|
||||
|
||||
```bash
|
||||
# スクリプトファイルをAOTコンパイル可能
|
||||
./nyash --aot script.nyash -o script.exe
|
||||
./nyash --aot script.hako -o script.exe
|
||||
|
||||
# JITで実行(ホットコードを自動最適化)
|
||||
./nyash --backend vm --jit script.nyash
|
||||
./nyash --backend vm --jit script.hako
|
||||
```
|
||||
|
||||
つまり:
|
||||
|
||||
@ -29,7 +29,7 @@ Nyashスクリプトプラグインは、**最もNyashらしいプラグイン
|
||||
### 1. シンプルなユーティリティBox
|
||||
|
||||
```nyash
|
||||
# math_utils.nyash - 数学ユーティリティプラグイン
|
||||
# math_utils.hako - 数学ユーティリティプラグイン
|
||||
|
||||
box MathUtils {
|
||||
init { }
|
||||
@ -66,7 +66,7 @@ box MathUtils {
|
||||
### 2. 他のプラグインと組み合わせる例
|
||||
|
||||
```nyash
|
||||
# data_processor.nyash - データ処理プラグイン
|
||||
# data_processor.hako - データ処理プラグイン
|
||||
|
||||
box DataProcessor {
|
||||
init { file, math, cache }
|
||||
@ -109,7 +109,7 @@ box DataProcessor {
|
||||
### 3. 高度なプラグイン - P2Pノード拡張
|
||||
|
||||
```nyash
|
||||
# mesh_node.nyash - P2Pメッシュネットワークノード
|
||||
# mesh_node.hako - P2Pメッシュネットワークノード
|
||||
|
||||
box MeshNode from P2PBox {
|
||||
init { routing, peers, messageHandlers }
|
||||
@ -181,8 +181,8 @@ box MeshNode from P2PBox {
|
||||
### 1. ローカルファイルとして
|
||||
|
||||
```nyash
|
||||
# main.nyash
|
||||
include "plugins/math_utils.nyash"
|
||||
# main.hako
|
||||
include "plugins/math_utils.hako"
|
||||
|
||||
local utils = new MathUtils()
|
||||
print(utils.factorial(5)) # 120
|
||||
@ -209,7 +209,7 @@ local utils = new MathUtils()
|
||||
|
||||
```nyash
|
||||
# 実行時にプラグインをロード
|
||||
local pluginCode = new FileBox().read("plugin.nyash")
|
||||
local pluginCode = new FileBox().read("plugin.hako")
|
||||
eval(pluginCode) # プラグインが利用可能に
|
||||
|
||||
local processor = new DataProcessor()
|
||||
@ -270,7 +270,7 @@ box SafeCalculator {
|
||||
| パフォーマンス | 中速 | 最速 | 高速 |
|
||||
| 開発効率 | 最高 | 中 | 中 |
|
||||
| デバッグ | 簡単 | 難しい | 中程度 |
|
||||
| 配布 | .nyashファイル | .so/.dll | 任意 |
|
||||
| 配布 | .hakoファイル | .so/.dll | 任意 |
|
||||
|
||||
## 📚 まとめ
|
||||
|
||||
|
||||
@ -84,7 +84,7 @@ my-awesome-package/
|
||||
│ └── README.md
|
||||
├── examples/
|
||||
│ └── basic_usage.ny
|
||||
└── .nyashignore # 公開時の除外ファイル
|
||||
└── .hakoignore # 公開時の除外ファイル
|
||||
```
|
||||
|
||||
### nyash.toml仕様
|
||||
@ -200,7 +200,7 @@ GET /search?q={query} # パッケージ検索
|
||||
"dependencies": {
|
||||
"basic-utils": "^2.0.0"
|
||||
},
|
||||
"tarball": "https://registry.nyash.dev/awesome-math-1.0.0.tgz"
|
||||
"tarball": "https://registry.hako.dev/awesome-math-1.0.0.tgz"
|
||||
}
|
||||
```
|
||||
|
||||
@ -221,7 +221,7 @@ public_key = "..."
|
||||
nyash_modules/
|
||||
└── awesome-math/
|
||||
├── nyash.toml
|
||||
└── .nyash-integrity # SHA256ハッシュ
|
||||
└── .hako-integrity # SHA256ハッシュ
|
||||
```
|
||||
|
||||
### 権限システム
|
||||
@ -247,9 +247,9 @@ members = [
|
||||
### プライベートレジストリ
|
||||
|
||||
```toml
|
||||
# .nyashrc
|
||||
# .hakorc
|
||||
[registries]
|
||||
default = "https://registry.nyash.dev"
|
||||
default = "https://registry.hako.dev"
|
||||
company = "https://npm.company.com"
|
||||
|
||||
[scopes]
|
||||
@ -276,7 +276,7 @@ nyash cache add awesome-math@1.0.0
|
||||
### インテリジェントキャッシュ
|
||||
|
||||
```
|
||||
~/.nyash/cache/
|
||||
~/.hako/cache/
|
||||
├── packages/
|
||||
│ └── awesome-math-1.0.0.tgz
|
||||
├── metadata/
|
||||
|
||||
@ -56,7 +56,7 @@ impl eframe::App for NyashBrowser {
|
||||
ui.text_edit_singleline(&mut self.url);
|
||||
if ui.button("Go").clicked() {
|
||||
// Nyashファイル実行
|
||||
if self.url.ends_with(".nyash") {
|
||||
if self.url.ends_with(".hako") {
|
||||
self.content = execute_nyash(&self.url);
|
||||
}
|
||||
}
|
||||
@ -78,7 +78,7 @@ impl eframe::App for NyashBrowser {
|
||||
// Tauriコマンドでブラウザ機能実装
|
||||
#[tauri::command]
|
||||
async fn browse_nyash(url: String) -> Result<BrowseResult, String> {
|
||||
if url.ends_with(".nyash") {
|
||||
if url.ends_with(".hako") {
|
||||
// Nyash VMで直接実行
|
||||
let vm = NyashVM::new();
|
||||
let result = vm.execute_file(&url)?;
|
||||
@ -158,7 +158,7 @@ box SharedMemoryRenderer {
|
||||
```nyash
|
||||
box DevServer from FileWatcherBox {
|
||||
watchAndReload(directory) {
|
||||
me.watch(directory, "*.nyash", (file) => {
|
||||
me.watch(directory, "*.hako", (file) => {
|
||||
// 変更を検出したら即座にリコンパイル
|
||||
local compiled = me.compiler.compileWithSourceMap(file)
|
||||
|
||||
@ -231,7 +231,7 @@ box CollaborativeEditor from P2PBox {
|
||||
- [ ] Nyash VM統合
|
||||
|
||||
### Week 2: コア機能
|
||||
- [ ] .nyashファイル実行
|
||||
- [ ] .hakoファイル実行
|
||||
- [ ] JIT/AOTコンパイル統合
|
||||
- [ ] 基本的なセキュリティ
|
||||
|
||||
|
||||
@ -14,15 +14,15 @@ Nyashでブラウザーを作り、ネイティブ実行する構想について
|
||||
{
|
||||
"name": "Nyash Browser Extension",
|
||||
"permissions": ["webRequest", "webRequestBlocking", "nativeMessaging"],
|
||||
"host_permissions": ["*://*/*.nyash"]
|
||||
"host_permissions": ["*://*/*.hako"]
|
||||
}
|
||||
|
||||
// background.js
|
||||
chrome.webRequest.onBeforeRequest.addListener(
|
||||
(details) => {
|
||||
if (details.url.endsWith('.nyash')) {
|
||||
if (details.url.endsWith('.hako')) {
|
||||
// Native hostと通信してNyash VMで実行
|
||||
chrome.runtime.sendNativeMessage('com.nyash.runtime',
|
||||
chrome.runtime.sendNativeMessage('com.hako.runtime',
|
||||
{ command: 'execute', url: details.url },
|
||||
(response) => {
|
||||
// 結果を新しいタブで表示
|
||||
@ -99,8 +99,8 @@ async fn execute_nyash(window: Window, code: String) -> Result<Value, String> {
|
||||
fn nyash_protocol_handler(app: &AppHandle, request: &Request) -> Response {
|
||||
let path = request.uri().path();
|
||||
|
||||
// .nyashファイルを実行
|
||||
if path.ends_with(".nyash") {
|
||||
// .hakoファイルを実行
|
||||
if path.ends_with(".hako") {
|
||||
let code = std::fs::read_to_string(path).unwrap();
|
||||
let vm = VM::new();
|
||||
let result = vm.execute(&code).unwrap();
|
||||
@ -124,7 +124,7 @@ fn nyash_protocol_handler(app: &AppHandle, request: &Request) -> Response {
|
||||
#### 1. カスタムHTMLエレメント
|
||||
```html
|
||||
<!-- Nyashコードを直接HTMLに埋め込み -->
|
||||
<nyash-app src="todo-app.nyash">
|
||||
<nyash-app src="todo-app.hako">
|
||||
<template>
|
||||
<div class="todo-list">
|
||||
<nyash-for items="todos" as="todo">
|
||||
@ -423,7 +423,7 @@ impl eframe::App for NyashBrowser {
|
||||
|
||||
2. **Week 2**: カスタムプロトコル
|
||||
- nyash://プロトコルハンドラー
|
||||
- .nyashファイル実行
|
||||
- .hakoファイル実行
|
||||
- 結果表示
|
||||
|
||||
3. **Week 3**: 高速化
|
||||
|
||||
@ -18,9 +18,9 @@
|
||||
```javascript
|
||||
// Chrome拡張機能側
|
||||
chrome.webNavigation.onBeforeNavigate.addListener((details) => {
|
||||
if (details.url.endsWith('.nyash')) {
|
||||
if (details.url.endsWith('.hako')) {
|
||||
// Native Messagingでローカルプロセスと通信
|
||||
chrome.runtime.sendNativeMessage('com.nyash.executor',
|
||||
chrome.runtime.sendNativeMessage('com.hako.executor',
|
||||
{ action: 'execute', url: details.url },
|
||||
(response) => {
|
||||
// 実行結果をタブに表示
|
||||
@ -109,7 +109,7 @@ box NyashBrowser from TauriBox {
|
||||
init { apps, vm, cache }
|
||||
|
||||
navigateTo(url) {
|
||||
if url.endsWith(".nyash") {
|
||||
if url.endsWith(".hako") {
|
||||
// ローカルキャッシュチェック
|
||||
local app = me.cache.get(url)
|
||||
if !app {
|
||||
@ -216,7 +216,7 @@ let wasi_env = WasiEnv::builder("nyash-app")
|
||||
```nyash
|
||||
box DevServer {
|
||||
watch(directory) {
|
||||
me.fs.watchFiles(directory, "*.nyash", (file) => {
|
||||
me.fs.watchFiles(directory, "*.hako", (file) => {
|
||||
me.recompile(file)
|
||||
me.browser.reload()
|
||||
me.notify("Reloaded: " + file)
|
||||
|
||||
@ -56,10 +56,10 @@ I::Call { dst, func, callee, args, effects } => {
|
||||
#### 環境変数制御
|
||||
```bash
|
||||
# v1形式出力(統一Call対応)
|
||||
NYASH_MIR_UNIFIED_CALL=1 ./target/release/nyash program.nyash
|
||||
NYASH_MIR_UNIFIED_CALL=1 ./target/release/nyash program.hako
|
||||
|
||||
# v0形式出力(既存互換)
|
||||
NYASH_MIR_UNIFIED_CALL=0 ./target/release/nyash program.nyash
|
||||
NYASH_MIR_UNIFIED_CALL=0 ./target/release/nyash program.hako
|
||||
```
|
||||
|
||||
### 📊 優先度2: スキーマ情報追加
|
||||
|
||||
@ -37,7 +37,7 @@ Unified Call(開発既定ON)
|
||||
|
||||
4) NYABI(VM Kernel Bridge)下地(未配線・既定OFF)
|
||||
- docs/abi/vm-kernel.md(関数: caps()/policy.*()/resolve_method_batch())
|
||||
- スケルトン: apps/selfhost/vm/boxes/vm_kernel_box.nyash(policy スタブ)
|
||||
- スケルトン: apps/selfhost/vm/boxes/vm_kernel_box.hako(policy スタブ)
|
||||
- 既定OFFトグル予約: NYASH_VM_NY_KERNEL, *_TIMEOUT_MS, *_TRACE
|
||||
|
||||
非スコープ(やらない)
|
||||
@ -82,7 +82,7 @@ Unified Call(開発既定ON)
|
||||
- Phase 15.5(基盤整理): ../phase-15.5/README.md
|
||||
- Known/Rewrite 観測: src/mir/builder/{method_call_handlers.rs,builder_calls.rs}, src/debug/hub.rs
|
||||
- QuickRef(表示API): docs/reference/language/quick-reference.md
|
||||
- Mini‑VM: apps/selfhost/vm/boxes/mir_vm_min.nyash
|
||||
- Mini‑VM: apps/selfhost/vm/boxes/mir_vm_min.hako
|
||||
- スモーク: tools/smokes/v2/profiles/quick/core/
|
||||
|
||||
更新履歴
|
||||
|
||||
@ -133,10 +133,10 @@ Call { callee: Callee, args }
|
||||
|
||||
#### Phase 15.3 — Detailed Plan(Ny compiler MVP)
|
||||
- Directory layout(selfhost compiler)
|
||||
- `apps/selfhost-compiler/compiler.nyash`(CompilerBox entry; Ny→JSON v0 emit)
|
||||
- `apps/selfhost-compiler/parser/{lexer.nyash,parser.nyash,ast.nyash}`(Stage‑2 へ段階拡張)
|
||||
- `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}`(Stage‑2 へ段階拡張)
|
||||
- `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 plan(15.3‑late)
|
||||
- See: imports-namespace-plan.md — keep `nyash.toml` resolution in runner; accept `using` in Ny compiler as no‑op (no resolution) gated by `NYASH_ENABLE_USING=1`.
|
||||
@ -182,7 +182,7 @@ Imports/Namespace plan(15.3‑late)
|
||||
|
||||
【受入(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)。
|
||||
|
||||
#### 予告: LoopForm(MIR18)での PHI 自動化(Phase‑15 後)
|
||||
- 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`
|
||||
- Stage‑2 smokes: `tools/ny_stage2_bridge_smoke.sh`, `tools/ny_parser_stage2_phi_smoke.sh`, `tools/ny_me_dummy_smoke.sh`
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -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
|
||||
```
|
||||
|
||||
|
||||
@ -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 end‑to‑end: `... --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.
|
||||
|
||||
@ -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 {
|
||||
### 📅 Medium(1ヶ月以内)
|
||||
|
||||
7. **mini-vm統一Call実装**
|
||||
- `apps/selfhost/vm/call_executor.nyash`作成
|
||||
- `apps/selfhost/vm/call_executor.hako`作成
|
||||
- Nyashでの統一処理実装
|
||||
|
||||
8. **環境変数デフォルト化**
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
@ -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)
|
||||
|
||||
## 備考
|
||||
|
||||
|
||||
@ -186,10 +186,10 @@ Error: @derive(Equals) cannot be applied to UserBox
|
||||
### デバッグ支援
|
||||
```bash
|
||||
# マクロ展開の可視化
|
||||
nyash --expand program.nyash
|
||||
nyash --expand program.hako
|
||||
|
||||
# ステップバイステップ追跡
|
||||
NYASH_MACRO_TRACE=1 nyash program.nyash
|
||||
NYASH_MACRO_TRACE=1 nyash program.hako
|
||||
```
|
||||
|
||||
## 📊 成功指標(2週間後)
|
||||
|
||||
@ -110,7 +110,7 @@ test_person_equals() {
|
||||
|
||||
```bash
|
||||
# テスト実行
|
||||
nyash --run-tests my_program.nyash
|
||||
nyash --run-tests my_program.hako
|
||||
# [TEST] test_person_creation ... OK
|
||||
# [TEST] test_person_equals ... OK
|
||||
# Tests: 2 passed, 0 failed
|
||||
@ -158,10 +158,10 @@ macro bad_macro() {
|
||||
### **マクロ展開の可視化**
|
||||
```bash
|
||||
# マクロ展開結果を表示
|
||||
nyash --expand my_program.nyash
|
||||
nyash --expand my_program.hako
|
||||
|
||||
# 詳細トレース
|
||||
NYASH_MACRO_TRACE=1 nyash my_program.nyash
|
||||
NYASH_MACRO_TRACE=1 nyash my_program.hako
|
||||
# [MACRO] @derive(Equals) -> generating equals() method for Person
|
||||
# [MACRO] @test -> collecting test_person_creation()
|
||||
# [MACRO] Expansion complete: 2 macros processed, 0 errors
|
||||
@ -174,7 +174,7 @@ box Person {}
|
||||
|
||||
// エラー例:
|
||||
// error: Unknown derive trait 'UnknownTrait'
|
||||
// --> person.nyash:1:9
|
||||
// --> person.hako:1:9
|
||||
// |
|
||||
// 1 | @derive(UnknownTrait)
|
||||
// | ^^^^^^^^^^^^
|
||||
|
||||
@ -14,7 +14,7 @@ Status: active (Stage B → C 準備)
|
||||
Stages(概要)
|
||||
- Stage A(完了)
|
||||
- 文字列スキャンで整数抽出→print、if(リテラル条件)の最小到達。
|
||||
- サンプル: `apps/selfhost-vm/mini_vm*.nyash`
|
||||
- サンプル: `apps/selfhost-vm/mini_vm*.hako`
|
||||
- スモーク(v2): `tools/smokes/v2/run.sh --profile quick --filter "mini_vm|selfhost"`
|
||||
- Stage B(進行中)
|
||||
- stdinローダ(`NYASH_MINIVM_READ_STDIN=1`)[実装済]
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
Week 1 — LoopForm MVP(while, break/continue無し)
|
||||
- 目標: whileループを“キャリア(タプル)”へ正規化するユーザーマクロを実装(Nyash/PyVM)。
|
||||
- 成果物:
|
||||
- apps/macros/examples/loop_normalize_macro.nyash(MVP)
|
||||
- apps/macros/examples/loop_normalize_macro.hako(MVP)
|
||||
- ゴールデン: while基本/2変数キャリア/更新式の正規化
|
||||
- スモーク: selfhost-preexpand で自動適用→PyVM/LLVMの一致
|
||||
- 受け入れ基準:
|
||||
|
||||
@ -39,7 +39,7 @@ Constraints / Notes
|
||||
- 衛生: MacroCtx.gensym で __car_phi/__carK などの一意名を生成。
|
||||
|
||||
Integration
|
||||
- ユーザーマクロ: `apps/macros/examples/loop_normalize_macro.nyash`
|
||||
- ユーザーマクロ: `apps/macros/examples/loop_normalize_macro.hako`
|
||||
- 事前展開: selfhost‑preexpand auto(PyVM限定)で適用
|
||||
- 検証: macro‑golden + LLVM PHI健全性スモーク(空PHIなし/先頭グループ化)
|
||||
|
||||
|
||||
@ -39,9 +39,9 @@ Purpose: ship a tiny, beautiful vertical slice that runs Core‑13 IR end‑to
|
||||
- Events (lines): `{"event":"EnterFunc","func":"main"}` / `{"event":"ExitFunc","func":"main"}`.
|
||||
|
||||
5) CLI UX
|
||||
- `nyash run --engine=vm apps/hello.nyash`
|
||||
- `nyash run --engine=remote --exe ./nyash-engine-core13 apps/hello.nyash`
|
||||
- `nyash ir-emit --ir=core13 --format=json apps/hello.nyash > out.json`
|
||||
- `nyash run --engine=vm apps/hello.hako`
|
||||
- `nyash run --engine=remote --exe ./nyash-engine-core13 apps/hello.hako`
|
||||
- `nyash ir-emit --ir=core13 --format=json apps/hello.hako > out.json`
|
||||
- `nyash ir-run --engine=vm < out.json`
|
||||
|
||||
6) Milestones
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
## 🎯 核心的なアイデア
|
||||
|
||||
```
|
||||
ソースコード(.nyash) ⇔ データベース(SQLite)
|
||||
ソースコード(.hako) ⇔ データベース(SQLite)
|
||||
↓ ↓
|
||||
Git管理 高速リファクタリング
|
||||
エディタ編集 構造化分析
|
||||
@ -185,7 +185,7 @@ box FileSyncDaemon {
|
||||
local watcher = new FileWatcher(directory)
|
||||
|
||||
watcher.on("change") { event ->
|
||||
if event.file.endsWith(".nyash") {
|
||||
if event.file.endsWith(".hako") {
|
||||
me.syncFileToDb(event.file)
|
||||
}
|
||||
}
|
||||
|
||||
@ -173,7 +173,7 @@ box FileDBBridge {
|
||||
for box in boxes {
|
||||
local path = outputDir + "/" +
|
||||
box.namespace.replace(".", "/") + "/" +
|
||||
box.name + ".nyash"
|
||||
box.name + ".hako"
|
||||
|
||||
local file = new FileBox(path)
|
||||
file.write(me.generateFileContent(box))
|
||||
@ -182,7 +182,7 @@ box FileDBBridge {
|
||||
|
||||
// ファイル→DB インポート
|
||||
importFromFiles(sourceDir) {
|
||||
local files = FileBox.glob(sourceDir + "/**/*.nyash")
|
||||
local files = FileBox.glob(sourceDir + "/**/*.hako")
|
||||
|
||||
me.db.beginTransaction()
|
||||
try {
|
||||
|
||||
@ -26,8 +26,8 @@
|
||||
- 最小限:main関数、return文のみ
|
||||
- [ ] エンドツーエンドテスト
|
||||
```bash
|
||||
echo 'print(42)' > test.nyash
|
||||
./nyash phase22-compiler.nyash test.nyash
|
||||
echo 'print(42)' > test.hako
|
||||
./nyash phase22-compiler.hako test.hako
|
||||
```
|
||||
- [ ] Rust版との出力比較
|
||||
|
||||
@ -62,7 +62,7 @@
|
||||
## 成功指標
|
||||
|
||||
### 必須要件
|
||||
- [ ] `dep_tree_min_string.nyash` のコンパイル成功
|
||||
- [ ] `dep_tree_min_string.hako` のコンパイル成功
|
||||
- [ ] 基本的なプラグインテスト通過
|
||||
- [ ] Rust版と同一のオブジェクトファイル生成
|
||||
|
||||
@ -97,7 +97,7 @@
|
||||
```nyash
|
||||
// NyashコンパイラでNyashコンパイラをコンパイル!
|
||||
local compiler = new NyashCompiler()
|
||||
compiler.compile("phase22-compiler.nyash", "nyash-compiler.exe")
|
||||
compiler.compile("phase22-compiler.hako", "nyash-compiler.exe")
|
||||
```
|
||||
|
||||
### Phase 23: 完全セルフホスティング
|
||||
|
||||
@ -100,7 +100,7 @@ i64 llvm_build_batch(i64 module, const char* encoded_ops, i32 len);
|
||||
cargo build --release --features llvm # 5-7分待つ...
|
||||
|
||||
# 提案(即座に実行)
|
||||
./target/release/nyash nyash-llvm-compiler.nyash test.nyash
|
||||
./target/release/nyash nyash-llvm-compiler.hako test.hako
|
||||
```
|
||||
|
||||
### 2. 理解可能性の革命
|
||||
|
||||
@ -7,7 +7,7 @@ Summary:
|
||||
Scope:
|
||||
- AST: BoxDeclaration(is_static=true, name=Main) を検出 → 同名 main() を探して Program 化
|
||||
- Lowering: 発見した body を既存の Program lowering に渡す(関数単位でOK)
|
||||
- Tests: local_tests/mir_loop_no_local.nyash(static Main)で dump/VM が通る
|
||||
- Tests: local_tests/mir_loop_no_local.hako(static Main)で dump/VM が通る
|
||||
|
||||
Tasks:
|
||||
- [ ] MirBuilder: static Main → Program lowering 経路
|
||||
@ -15,8 +15,8 @@ Tasks:
|
||||
- [ ] サンプル/スナップショットの点検
|
||||
|
||||
Acceptance Criteria:
|
||||
- `nyash --dump-mir ./local_tests/mir_loop_no_local.nyash` が成功
|
||||
- `nyash --backend vm ./local_tests/mir_loop_no_local.nyash` が成功
|
||||
- `nyash --dump-mir ./local_tests/mir_loop_no_local.hako` が成功
|
||||
- `nyash --backend vm ./local_tests/mir_loop_no_local.hako` が成功
|
||||
|
||||
References:
|
||||
- #33, #35
|
||||
|
||||
@ -104,7 +104,7 @@ MirInstruction::NewBox { dst, box_type, args } // Box生成
|
||||
## Technical Notes
|
||||
|
||||
### 現在の実装基盤(2025-08-14時点)
|
||||
- ✅ **WASM CLI**: `./target/release/nyash --compile-wasm program.nyash` で動作
|
||||
- ✅ **WASM CLI**: `./target/release/nyash --compile-wasm program.hako` で動作
|
||||
- ✅ **ブラウザテスト**: `wasm_demo/` ディレクトリに実行環境完備
|
||||
- ✅ **Safepoint対応**: `src/backend/wasm/codegen.rs:line XX` で実装済み
|
||||
- ✅ **実行ドキュメント**: `docs/reference/architecture/execution-backends.md` で使用方法詳細化
|
||||
|
||||
@ -41,7 +41,7 @@
|
||||
- **PoC3**: Weak/Barrier の下地(WeakLoad は当面 Some 相当、Barrier は no-op)
|
||||
- **PoC4**: Future/Await の基本実装(スレッドなしの即座完了)
|
||||
- **CLI 統合**
|
||||
- `nyash --backend wasm program.nyash` で生成・実行(wasmtime 呼び出し)
|
||||
- `nyash --backend wasm program.hako` で生成・実行(wasmtime 呼び出し)
|
||||
- `--output program.wasm` でWASMファイル出力のみ
|
||||
|
||||
## Implementation Plan
|
||||
@ -129,8 +129,8 @@
|
||||
- ✅ **Future Operations**: FutureNew/Await が即座完了として動作
|
||||
|
||||
### CLI Integration
|
||||
- ✅ **Command Line**: `nyash --backend wasm test.nyash` で実行可能
|
||||
- ✅ **File Output**: `nyash --backend wasm --output test.wasm test.nyash` でファイル出力
|
||||
- ✅ **Command Line**: `nyash --backend wasm test.hako` で実行可能
|
||||
- ✅ **File Output**: `nyash --backend wasm --output test.wasm test.hako` でファイル出力
|
||||
- ✅ **Error Messages**: 未対応機能の明確なエラーメッセージ
|
||||
|
||||
## Test Strategy
|
||||
@ -156,9 +156,9 @@ fn test_ref_operations_codegen() {
|
||||
```
|
||||
|
||||
### Integration Tests
|
||||
- `tests/wasm_poc1_arithmetic.nyash` → MIR → WASM → wasmtime実行
|
||||
- `tests/wasm_poc2_objects.nyash` → RefNew/RefGet/RefSet使用 → WASM実行
|
||||
- `tests/wasm_poc3_features.nyash` → Weak/Future命令含む → WASM実行
|
||||
- `tests/wasm_poc1_arithmetic.hako` → MIR → WASM → wasmtime実行
|
||||
- `tests/wasm_poc2_objects.hako` → RefNew/RefGet/RefSet使用 → WASM実行
|
||||
- `tests/wasm_poc3_features.hako` → Weak/Future命令含む → WASM実行
|
||||
|
||||
### Browser Testing
|
||||
```html
|
||||
|
||||
@ -138,7 +138,7 @@ impl MirBuilder {
|
||||
## 🧪 テストケース(Copilot実装必須)
|
||||
|
||||
### Test 1: 基本Box定義・生成
|
||||
**ファイル**: `test_user_defined_box.nyash`
|
||||
**ファイル**: `test_user_defined_box.hako`
|
||||
```nyash
|
||||
box DataBox {
|
||||
init { value }
|
||||
@ -171,7 +171,7 @@ bb0:
|
||||
**実行期待結果**: `42`
|
||||
|
||||
### Test 2: フィールドアクセス・代入
|
||||
**ファイル**: `test_field_operations.nyash`
|
||||
**ファイル**: `test_field_operations.hako`
|
||||
```nyash
|
||||
box Counter {
|
||||
init { count }
|
||||
@ -197,7 +197,7 @@ static box Main {
|
||||
**期待結果**: `1`
|
||||
|
||||
### Test 3: デリゲーション基本
|
||||
**ファイル**: `test_delegation_basic.nyash`
|
||||
**ファイル**: `test_delegation_basic.hako`
|
||||
```nyash
|
||||
box Parent {
|
||||
init { name }
|
||||
@ -236,7 +236,7 @@ static box Main {
|
||||
**期待結果**: `"Hello Alice (age 25)"`
|
||||
|
||||
### Test 4: WASM Box操作統合テスト
|
||||
**ファイル**: `test_wasm_box_integration.nyash`
|
||||
**ファイル**: `test_wasm_box_integration.hako`
|
||||
```nyash
|
||||
box SimpleData {
|
||||
init { x, y }
|
||||
@ -262,13 +262,13 @@ static box Main {
|
||||
**テスト方法**:
|
||||
```bash
|
||||
# MIR生成テスト
|
||||
./target/release/nyash --dump-mir test_wasm_box_integration.nyash
|
||||
./target/release/nyash --dump-mir test_wasm_box_integration.hako
|
||||
|
||||
# WASM生成テスト
|
||||
./target/release/nyash --compile-wasm test_wasm_box_integration.nyash
|
||||
./target/release/nyash --compile-wasm test_wasm_box_integration.hako
|
||||
|
||||
# WASM実行テスト(wasmtime)
|
||||
./target/release/nyash --compile-wasm test_wasm_box_integration.nyash > test.wat
|
||||
./target/release/nyash --compile-wasm test_wasm_box_integration.hako > test.wat
|
||||
sed -n '4,$p' test.wat > clean_test.wat
|
||||
$HOME/.wasmtime/bin/wasmtime run clean_test.wat --invoke main
|
||||
```
|
||||
@ -306,10 +306,10 @@ $HOME/.wasmtime/bin/wasmtime run clean_test.wat --invoke main
|
||||
### デバッグ支援
|
||||
```bash
|
||||
# MIR生成確認
|
||||
./target/release/nyash --dump-mir --mir-verbose test_file.nyash
|
||||
./target/release/nyash --dump-mir --mir-verbose test_file.hako
|
||||
|
||||
# パーサー確認
|
||||
./target/release/nyash --debug-fuel unlimited test_file.nyash
|
||||
./target/release/nyash --debug-fuel unlimited test_file.hako
|
||||
```
|
||||
|
||||
## 📊 期待される効果
|
||||
@ -335,4 +335,4 @@ $HOME/.wasmtime/bin/wasmtime run clean_test.wat --invoke main
|
||||
|
||||
**優先度**: Critical
|
||||
**担当**: Copilot + Claude協調実装
|
||||
**最終目標**: test_wasm_box_integration.nyash が完全動作
|
||||
**最終目標**: test_wasm_box_integration.hako が完全動作
|
||||
|
||||
@ -132,13 +132,13 @@ Frontend → New MIR(25命令) →
|
||||
### デバッグ支援
|
||||
```bash
|
||||
# セマンティクス確認
|
||||
./target/release/nyash --dump-mir-semantic test.nyash
|
||||
./target/release/nyash --dump-mir-semantic test.hako
|
||||
|
||||
# 降格パス確認
|
||||
./target/release/nyash --dump-mir-lowered test.nyash
|
||||
./target/release/nyash --dump-mir-lowered test.hako
|
||||
|
||||
# 性能比較
|
||||
./target/release/nyash --benchmark-mir-passes test.nyash
|
||||
./target/release/nyash --benchmark-mir-passes test.hako
|
||||
```
|
||||
|
||||
## 📊 期待される効果
|
||||
|
||||
@ -78,7 +78,7 @@ struct VMProfiler {
|
||||
#### 📊 ベンチマーク計測拡張
|
||||
```bash
|
||||
# 詳細プロファイリングコマンド
|
||||
./target/release/nyash --benchmark --profile-vm --iterations 1000 program.nyash
|
||||
./target/release/nyash --benchmark --profile-vm --iterations 1000 program.hako
|
||||
|
||||
# 出力例
|
||||
VM Performance Profile:
|
||||
@ -189,7 +189,7 @@ struct ZeroCopyVM {
|
||||
### VM性能測定テスト
|
||||
各テストをInterpreter/VM/WASMで比較実行し、性能プロファイル収集
|
||||
|
||||
#### test_vm_performance_basic.nyash
|
||||
#### test_vm_performance_basic.hako
|
||||
```nyash
|
||||
// 基本演算性能テスト(CPU集約)
|
||||
static box VMPerfTest {
|
||||
@ -234,7 +234,7 @@ box DataBox {
|
||||
}
|
||||
```
|
||||
|
||||
#### test_vm_boxcall_return.nyash
|
||||
#### test_vm_boxcall_return.hako
|
||||
```nyash
|
||||
// BoxCall戻り値問題専用テスト
|
||||
static box BoxCallTest {
|
||||
@ -282,7 +282,7 @@ box ComplexBox {
|
||||
}
|
||||
```
|
||||
|
||||
#### test_vm_memory_usage.nyash
|
||||
#### test_vm_memory_usage.hako
|
||||
```nyash
|
||||
// メモリ使用量測定テスト
|
||||
static box MemoryTest {
|
||||
@ -338,7 +338,7 @@ box LargeDataBox {
|
||||
}
|
||||
```
|
||||
|
||||
#### test_vm_instruction_dispatch.nyash
|
||||
#### test_vm_instruction_dispatch.hako
|
||||
```nyash
|
||||
// 命令ディスパッチ性能特化テスト
|
||||
static box DispatchTest {
|
||||
@ -397,16 +397,16 @@ TESTS=(
|
||||
)
|
||||
|
||||
for test in "${TESTS[@]}"; do
|
||||
echo "📊 $test.nyash テスト実行中..."
|
||||
echo "📊 $test.hako テスト実行中..."
|
||||
|
||||
echo " - Interpreter実行..."
|
||||
time ./target/release/nyash --backend interpreter "tests/vm_performance/$test.nyash"
|
||||
time ./target/release/nyash --backend interpreter "tests/vm_performance/$test.hako"
|
||||
|
||||
echo " - VM実行..."
|
||||
time ./target/release/nyash --backend vm "tests/vm_performance/$test.nyash"
|
||||
time ./target/release/nyash --backend vm "tests/vm_performance/$test.hako"
|
||||
|
||||
echo " - WASM実行..."
|
||||
time ./target/release/nyash --backend wasm "tests/vm_performance/$test.nyash"
|
||||
time ./target/release/nyash --backend wasm "tests/vm_performance/$test.hako"
|
||||
|
||||
echo ""
|
||||
done
|
||||
|
||||
@ -113,7 +113,7 @@ static box Main {
|
||||
|
||||
#### Test 1: 基本メモリ管理
|
||||
```nyash
|
||||
// test_kilo_basic_memory.nyash
|
||||
// test_kilo_basic_memory.hako
|
||||
box Editor {
|
||||
init { rows }
|
||||
pack() { me.rows = new ArrayBox() }
|
||||
@ -141,7 +141,7 @@ static box Main {
|
||||
|
||||
#### Test 2: 複雑な相互参照
|
||||
```nyash
|
||||
// test_kilo_circular_refs.nyash
|
||||
// test_kilo_circular_refs.hako
|
||||
box Editor {
|
||||
init { rows, state }
|
||||
pack() {
|
||||
@ -170,7 +170,7 @@ static box Main {
|
||||
|
||||
#### Test 3: 大量オブジェクト管理
|
||||
```nyash
|
||||
// test_kilo_mass_objects.nyash
|
||||
// test_kilo_mass_objects.hako
|
||||
static box Main {
|
||||
main() {
|
||||
local editor = new Editor()
|
||||
@ -253,22 +253,22 @@ box Client {
|
||||
### デバッグ支援(統合版)
|
||||
```bash
|
||||
# メモリ使用量監視
|
||||
./target/release/nyash --debug-memory test_kilo_basic.nyash
|
||||
./target/release/nyash --debug-memory test_kilo_basic.hako
|
||||
|
||||
# weak参照追跡
|
||||
./target/release/nyash --trace-weak test_kilo_circular.nyash
|
||||
./target/release/nyash --trace-weak test_kilo_circular.hako
|
||||
|
||||
# fini呼び出し追跡
|
||||
./target/release/nyash --trace-fini test_kilo_mass.nyash
|
||||
./target/release/nyash --trace-fini test_kilo_mass.hako
|
||||
|
||||
# BoxCall戻り値デバッグ(新規)
|
||||
./target/release/nyash --debug-boxcall test_kilo_basic.nyash
|
||||
./target/release/nyash --debug-boxcall test_kilo_basic.hako
|
||||
|
||||
# VM/Interpreter/WASM BoxCall比較(新規)
|
||||
./target/release/nyash --compare-boxcall test_kilo_basic.nyash
|
||||
./target/release/nyash --compare-boxcall test_kilo_basic.hako
|
||||
|
||||
# 統合デバッグ(メモリ + BoxCall)
|
||||
./target/release/nyash --debug-all test_kilo_basic.nyash
|
||||
./target/release/nyash --debug-all test_kilo_basic.hako
|
||||
```
|
||||
|
||||
## 📊 期待される効果(統合版)
|
||||
|
||||
@ -56,7 +56,7 @@ fn resolve_builtin_delegation(builtin: &str, args: Vec<_>) -> Result<(), String>
|
||||
|
||||
#### **A. ユーザー定義Box基本動作**
|
||||
```nyash
|
||||
# test_user_box_basic.nyash
|
||||
# test_user_box_basic.hako
|
||||
box Life {
|
||||
init { name, energy }
|
||||
|
||||
@ -73,7 +73,7 @@ assert(alice.energy == 100)
|
||||
|
||||
#### **B. ビルトインBox継承**
|
||||
```nyash
|
||||
# test_builtin_inheritance.nyash
|
||||
# test_builtin_inheritance.hako
|
||||
box EnhancedP2P from P2PBox {
|
||||
init { features }
|
||||
|
||||
@ -89,7 +89,7 @@ assert(node.features != null)
|
||||
|
||||
#### **C. 透明化システム動作**
|
||||
```nyash
|
||||
# test_transparency.nyash
|
||||
# test_transparency.hako
|
||||
box SimpleString from StringBox {
|
||||
init { prefix }
|
||||
|
||||
@ -109,7 +109,7 @@ assert(str.toString() == ">>> Hello")
|
||||
|
||||
#### **D. 混在テスト**
|
||||
```nyash
|
||||
# test_mixed_inheritance.nyash
|
||||
# test_mixed_inheritance.hako
|
||||
box AdvancedCalc from MathBox {
|
||||
init { history }
|
||||
|
||||
@ -135,7 +135,7 @@ assert(calc2.result == 0)
|
||||
|
||||
#### **E. エラーケーステスト**
|
||||
```nyash
|
||||
# test_error_cases.nyash
|
||||
# test_error_cases.hako
|
||||
|
||||
# 1. 存在しないmethodを呼び出し
|
||||
box BadBox from StringBox {
|
||||
@ -154,7 +154,7 @@ box ArgMismatch from P2PBox {
|
||||
|
||||
### **パフォーマンステスト**
|
||||
```nyash
|
||||
# test_performance.nyash
|
||||
# test_performance.hako
|
||||
local startTime = getCurrentTime()
|
||||
|
||||
loop(i < 1000) {
|
||||
@ -187,7 +187,7 @@ assert(elapsed < 1000) # 1秒以内で完了
|
||||
- [ ] エラーメッセージがユーザーフレンドリー
|
||||
|
||||
### **統合テスト**
|
||||
- [ ] `test_birth_simple.nyash` 継続動作 ✅
|
||||
- [ ] `test_birth_simple.hako` 継続動作 ✅
|
||||
- [ ] Chip-8エミュレーター修正版動作
|
||||
- [ ] 全ビルトインBox継承パターン動作
|
||||
- [ ] デリゲーションチェーン正常動作
|
||||
@ -201,10 +201,10 @@ assert(elapsed < 1000) # 1秒以内で完了
|
||||
- `src/box_trait.rs` - BUILTIN_BOXES定数
|
||||
|
||||
### **テストファイル**
|
||||
- `test_pack_transparency.nyash` - 統合テスト
|
||||
- `test_builtin_inheritance.nyash` - ビルトイン継承
|
||||
- `test_user_box_birth.nyash` - ユーザー定義Box
|
||||
- `test_error_cases.nyash` - エラーケース
|
||||
- `test_pack_transparency.hako` - 統合テスト
|
||||
- `test_builtin_inheritance.hako` - ビルトイン継承
|
||||
- `test_user_box_birth.hako` - ユーザー定義Box
|
||||
- `test_error_cases.hako` - エラーケース
|
||||
|
||||
## 🎉 完了条件
|
||||
|
||||
|
||||
@ -27,7 +27,7 @@ nyash-macos (1.8MB) - 署名付き
|
||||
### **2. 開発者向け配布**
|
||||
```bash
|
||||
# LLVM IRの中立性を活用
|
||||
nyashc --emit-bitcode program.nyash
|
||||
nyashc --emit-bitcode program.hako
|
||||
# → program.bc (プラットフォーム中立)
|
||||
|
||||
# 各自のマシンで最適化コンパイル
|
||||
|
||||
@ -9,7 +9,7 @@ LLVM IRはプラットフォーム中立。だから**1回のIR生成から同
|
||||
|
||||
```rust
|
||||
// 革命的ワンパス・マルチターゲット生成
|
||||
nyashc --targets linux,windows,macos program.nyash
|
||||
nyashc --targets linux,windows,macos program.hako
|
||||
|
||||
// 出力(同時生成!)
|
||||
dist/x86_64-unknown-linux-musl/nyash # Linux版
|
||||
|
||||
@ -23,7 +23,7 @@
|
||||
#### **即効性のある解決策(Week 1-3)**
|
||||
```bash
|
||||
# Linux + Windows同時生成
|
||||
nyashc --targets linux,windows-gnu program.nyash
|
||||
nyashc --targets linux,windows-gnu program.hako
|
||||
|
||||
# 出力
|
||||
dist/linux/nyash # Linux版(musl静的)
|
||||
|
||||
@ -14,7 +14,7 @@ Phase 9.78 LLVM PoCの第一歩として、inkwellクレートを導入し、最
|
||||
以下のNyashプログラムがLLVM経由で実行され、正しい終了コードを返すこと:
|
||||
|
||||
```nyash
|
||||
// test_return_42.nyash
|
||||
// test_return_42.hako
|
||||
static box Main {
|
||||
main() {
|
||||
return 42
|
||||
@ -24,7 +24,7 @@ static box Main {
|
||||
|
||||
期待される動作:
|
||||
```bash
|
||||
$ cargo run --features llvm -- --backend llvm test_return_42.nyash
|
||||
$ cargo run --features llvm -- --backend llvm test_return_42.hako
|
||||
$ echo $?
|
||||
42
|
||||
```
|
||||
|
||||
@ -29,7 +29,7 @@ Phase 9.78 LLVM PoCの開始です!最初のステップとして、inkwellク
|
||||
## 🎯 成功条件
|
||||
|
||||
```nyash
|
||||
// test_return_42.nyash
|
||||
// test_return_42.hako
|
||||
static box Main {
|
||||
main() {
|
||||
return 42
|
||||
@ -68,7 +68,7 @@ static box Main {
|
||||
## ✅ 完了条件
|
||||
|
||||
- [ ] inkwellがビルドできる
|
||||
- [ ] test_return_42.nyashがコンパイルできる
|
||||
- [ ] test_return_42.hakoがコンパイルできる
|
||||
- [ ] 実行ファイルが終了コード42を返す
|
||||
- [ ] 基本的なテストがパスする
|
||||
|
||||
|
||||
@ -52,7 +52,7 @@ cargo build --features llvm
|
||||
### 4. **テストプログラム作成**(5分)
|
||||
```bash
|
||||
# テスト用Nyashファイル
|
||||
cat > test_return_42.nyash << 'EOF'
|
||||
cat > test_return_42.hako << 'EOF'
|
||||
static box Main {
|
||||
main() {
|
||||
return 42
|
||||
|
||||
@ -13,7 +13,7 @@ Phase 9で実装されたWASM/AOTとHTTPサーバー機能に重大な制約が
|
||||
### 1. **WASM/AOT コンパイルエラー(最重要)**
|
||||
```bash
|
||||
# 現象
|
||||
$ ./target/release/nyash --compile-wasm test_simple_loop.nyash
|
||||
$ ./target/release/nyash --compile-wasm test_simple_loop.hako
|
||||
❌ WASM compilation error: Unsupported instruction: Jump { target: BasicBlockId(1) }
|
||||
```
|
||||
|
||||
@ -146,7 +146,7 @@ pub fn stop(&self) -> Box<dyn NyashBox> {
|
||||
|
||||
**新規テストファイル**:
|
||||
|
||||
1. `test_wasm_loop.nyash`
|
||||
1. `test_wasm_loop.hako`
|
||||
```nyash
|
||||
// WASMループテスト
|
||||
local sum, i
|
||||
@ -159,7 +159,7 @@ loop (i < 10) {
|
||||
print("Sum: " + sum) // Expected: 45
|
||||
```
|
||||
|
||||
2. `test_http_server_real.nyash`
|
||||
2. `test_http_server_real.hako`
|
||||
```nyash
|
||||
// 実用HTTPサーバーテスト
|
||||
static box Main {
|
||||
@ -193,7 +193,7 @@ static box Main {
|
||||
|
||||
1. **WASM/AOT成功**
|
||||
```bash
|
||||
$ ./target/release/nyash --compile-wasm test_wasm_loop.nyash
|
||||
$ ./target/release/nyash --compile-wasm test_wasm_loop.hako
|
||||
✅ WASM compilation completed successfully!
|
||||
|
||||
$ ./target/release/nyash --benchmark --iterations 100
|
||||
@ -202,7 +202,7 @@ static box Main {
|
||||
|
||||
2. **HTTPサーバー実動作**
|
||||
```bash
|
||||
$ ./target/release/nyash test_http_server_real.nyash &
|
||||
$ ./target/release/nyash test_http_server_real.hako &
|
||||
Server started on http://0.0.0.0:8080
|
||||
|
||||
$ curl http://localhost:8080/
|
||||
|
||||
@ -6,7 +6,7 @@ AOT実装完了後の複雑アプリケーション検証。並行処理・メ
|
||||
## 🎯 実装目標
|
||||
```bash
|
||||
# Phase 9完了後の目標
|
||||
nyash --compile-native http_server.nyash -o http_server.exe # AOTサーバー生成
|
||||
nyash --compile-native http_server.hako -o http_server.exe # AOTサーバー生成
|
||||
./http_server.exe --port 8080 # 高性能HTTPサーバー起動
|
||||
curl http://localhost:8080/api/status # 実用API動作確認
|
||||
|
||||
|
||||
@ -149,7 +149,7 @@ impl Clone for SocketBox {
|
||||
|
||||
#### 4-1: 状態保持テスト
|
||||
```nyash
|
||||
// tests/socket_box_state_persistence.nyash
|
||||
// tests/socket_box_state_persistence.hako
|
||||
// 🎯 最重要テスト: 状態保持の確認
|
||||
|
||||
static box SocketBoxStateTest {
|
||||
@ -213,7 +213,7 @@ static box SocketBoxStateTest {
|
||||
|
||||
#### 4-2: 機能テスト
|
||||
```nyash
|
||||
// tests/socket_box_functionality.nyash
|
||||
// tests/socket_box_functionality.hako
|
||||
// 機能テスト(bind, toString, 基本API)
|
||||
|
||||
static box SocketBoxFunctionalityTest {
|
||||
@ -258,7 +258,7 @@ static box SocketBoxFunctionalityTest {
|
||||
|
||||
#### 4-3: エッジケーステスト
|
||||
```nyash
|
||||
// tests/socket_box_edge_cases.nyash
|
||||
// tests/socket_box_edge_cases.hako
|
||||
static box SocketBoxEdgeCaseTest {
|
||||
init { console }
|
||||
|
||||
@ -294,19 +294,19 @@ static box SocketBoxEdgeCaseTest {
|
||||
cargo build --release
|
||||
|
||||
# 状態保持テスト(最重要)
|
||||
./target/release/nyash tests/socket_box_state_persistence.nyash
|
||||
./target/release/nyash tests/socket_box_state_persistence.hako
|
||||
|
||||
# 機能テスト
|
||||
./target/release/nyash tests/socket_box_functionality.nyash
|
||||
./target/release/nyash tests/socket_box_functionality.hako
|
||||
|
||||
# エッジケーステスト
|
||||
./target/release/nyash tests/socket_box_edge_cases.nyash
|
||||
./target/release/nyash tests/socket_box_edge_cases.hako
|
||||
```
|
||||
|
||||
#### 5-2: HTTPServerBox互換性確認
|
||||
```bash
|
||||
# HTTPServerBoxも正常動作するかチェック
|
||||
./target/release/nyash tests/test_http_server_simple.nyash
|
||||
./target/release/nyash tests/test_http_server_simple.hako
|
||||
```
|
||||
|
||||
## 📚 参照ドキュメント
|
||||
|
||||
@ -262,10 +262,10 @@ loop(100) {
|
||||
#### 4-2: 全体統合テスト
|
||||
```bash
|
||||
# 全Box型の基本動作確認
|
||||
./target/release/nyash tests/all_boxes_basic_test.nyash
|
||||
./target/release/nyash tests/all_boxes_basic_test.hako
|
||||
|
||||
# 回帰テストスイート
|
||||
./target/release/nyash tests/regression_test_suite.nyash
|
||||
./target/release/nyash tests/regression_test_suite.hako
|
||||
```
|
||||
|
||||
## 🤖 Copilot協力期待
|
||||
@ -351,7 +351,7 @@ impl Clone for AnyBox {
|
||||
grep -r "Arc<Mutex<" src/boxes/ | wc -l # → 0
|
||||
|
||||
# 全Box型統合テスト
|
||||
./target/release/nyash tests/phase_9_75_complete_validation.nyash
|
||||
./target/release/nyash tests/phase_9_75_complete_validation.hako
|
||||
# → 全テスト成功
|
||||
```
|
||||
|
||||
|
||||
@ -184,7 +184,7 @@ Arc<Mutex<T>> → RwLock<T>
|
||||
|
||||
### Phase 9.75-C統合テスト
|
||||
```nyash
|
||||
// tests/phase975c_final_validation.nyash
|
||||
// tests/phase975c_final_validation.hako
|
||||
static box Main {
|
||||
main() {
|
||||
// HTTPServerBox状態保持テスト
|
||||
@ -210,7 +210,7 @@ static box Main {
|
||||
|
||||
### 負荷テスト
|
||||
```nyash
|
||||
// tests/phase975c_stress_test.nyash
|
||||
// tests/phase975c_stress_test.hako
|
||||
// 大量のBox作成・状態変更・並行アクセステスト
|
||||
```
|
||||
|
||||
|
||||
@ -6,8 +6,8 @@ wasmtime compileによるAOT実行ファイル生成で確実なユーザー価
|
||||
## 🎯 実装目標
|
||||
```bash
|
||||
# 目標実装
|
||||
nyash --compile-native app.nyash -o app.exe # AOT実行ファイル生成
|
||||
nyash --aot app.nyash # 短縮形
|
||||
nyash --compile-native app.hako -o app.exe # AOT実行ファイル生成
|
||||
nyash --aot app.hako # 短縮形
|
||||
./app.exe # 起動高速化(JIT起動コスト除去)
|
||||
|
||||
# 内部実装
|
||||
@ -125,7 +125,7 @@ fn main() {
|
||||
## ✅ Acceptance Criteria
|
||||
|
||||
### 機能要件
|
||||
- [ ] `nyash --compile-native app.nyash -o app.exe` 動作
|
||||
- [ ] `nyash --compile-native app.hako -o app.exe` 動作
|
||||
- [ ] 生成実行ファイルが単独で動作(依存関係なし)
|
||||
- [ ] 既存Nyashプログラムが100%互換で高速実行
|
||||
|
||||
|
||||
@ -169,11 +169,11 @@ Finished `release` profile [optimized] target(s) in X.XXs
|
||||
### ✅ 検証: DebugBox機能確認
|
||||
```bash
|
||||
# DebugBox基本機能テスト
|
||||
$ ./target/release/nyash test_debug_basic.nyash
|
||||
$ ./target/release/nyash test_debug_basic.hako
|
||||
✅ DebugBoxがRwLockで動作
|
||||
|
||||
# 追跡機能テスト
|
||||
$ ./target/release/nyash test_debug_tracking.nyash
|
||||
$ ./target/release/nyash test_debug_tracking.hako
|
||||
✅ メモリ追跡・ブレークポイント機能正常
|
||||
```
|
||||
|
||||
|
||||
@ -92,15 +92,15 @@ Finished `release` profile [optimized] target(s) in X.XXs
|
||||
### ✅ Verification: All Box Types Functional
|
||||
```bash
|
||||
# Basic functionality test
|
||||
$ ./target/release/nyash local_tests/test_basic_box_operations.nyash
|
||||
$ ./target/release/nyash local_tests/test_basic_box_operations.hako
|
||||
✅ All Box operations successful
|
||||
|
||||
# HTTP Server test (critical for Phase 9.5)
|
||||
$ ./target/release/nyash local_tests/test_http_server_basic.nyash
|
||||
$ ./target/release/nyash local_tests/test_http_server_basic.hako
|
||||
✅ HTTPServerBox functioning with RwLock
|
||||
|
||||
# P2P test (critical for future phases)
|
||||
$ ./target/release/nyash local_tests/test_p2p_basic.nyash
|
||||
$ ./target/release/nyash local_tests/test_p2p_basic.hako
|
||||
✅ P2PBox functioning with RwLock
|
||||
```
|
||||
|
||||
|
||||
@ -122,15 +122,15 @@ Finished `release` profile [optimized] target(s) in X.XXs
|
||||
### ✅ 検証: 全Box型の機能確認
|
||||
```bash
|
||||
# 基本機能テスト
|
||||
$ ./target/release/nyash local_tests/test_basic_box_operations.nyash
|
||||
$ ./target/release/nyash local_tests/test_basic_box_operations.hako
|
||||
✅ 全Box操作成功
|
||||
|
||||
# HTTPサーバーテスト (Phase 9.5にとって重要)
|
||||
$ ./target/release/nyash local_tests/test_http_server_basic.nyash
|
||||
$ ./target/release/nyash local_tests/test_http_server_basic.hako
|
||||
✅ HTTPServerBoxがRwLockで動作
|
||||
|
||||
# P2Pテスト (将来のPhaseにとって重要)
|
||||
$ ./target/release/nyash local_tests/test_p2p_basic.nyash
|
||||
$ ./target/release/nyash local_tests/test_p2p_basic.hako
|
||||
✅ P2PBoxがRwLockで動作
|
||||
```
|
||||
|
||||
|
||||
@ -229,7 +229,7 @@ fn test_share_box_vs_clone_box_semantics() {
|
||||
#### **B7: テスト実行**
|
||||
```bash
|
||||
cargo test array_state_sharing_test
|
||||
./target/debug/nyash tests/array_debug.nyash
|
||||
./target/debug/nyash tests/array_debug.hako
|
||||
```
|
||||
|
||||
**✅ Phase B 完了条件**: ArrayBox状態保持テストが通過
|
||||
@ -299,13 +299,13 @@ WASMの独自メモリ管理での影響確認
|
||||
#### **D3: バックエンド別テスト**
|
||||
```bash
|
||||
# インタープリター
|
||||
./target/debug/nyash tests/array_debug.nyash
|
||||
./target/debug/nyash tests/array_debug.hako
|
||||
|
||||
# VM
|
||||
./target/release/nyash --backend vm tests/array_debug.nyash
|
||||
./target/release/nyash --backend vm tests/array_debug.hako
|
||||
|
||||
# WASM
|
||||
./target/release/nyash --backend wasm tests/array_debug.nyash
|
||||
./target/release/nyash --backend wasm tests/array_debug.hako
|
||||
```
|
||||
|
||||
**✅ Phase D 完了条件**: 3バックエンド全てで一貫した動作
|
||||
@ -325,8 +325,8 @@ WASMの独自メモリ管理での影響確認
|
||||
cargo test
|
||||
|
||||
# 実用アプリテスト
|
||||
./target/release/nyash app_dice_rpg.nyash
|
||||
./target/release/nyash app_statistics.nyash
|
||||
./target/release/nyash app_dice_rpg.hako
|
||||
./target/release/nyash app_statistics.hako
|
||||
|
||||
# 性能ベンチマーク
|
||||
./target/release/nyash --benchmark --iterations 100
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user