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

@ -17,7 +17,7 @@ C-ABI境界デバッグのGUIツール。**「ぽいっと付け外し」「視
## 📁 Files Structure
- `gemini-ipc-implementation.nyash` - Geminiの172行実装コード
- `gemini-ipc-implementation.hako` - Geminiの172行実装コード
- `chatgpt-design-spec.md` - ChatGPTの設計仕様
- `inspiration-process.md` - 1分発想プロセスの記録
- `technical-roadmap.md` - 実装ロードマップ2週間MVP

View File

@ -63,7 +63,7 @@ C ABI Calls → Real-time Logs → JSON Stream → 可視化
"outcome": "Ok",
"elapsed_us": 87,
"by_name": false,
"site": {"file":"apps/x.nyash","line":42}
"site": {"file":"apps/x.hako","line":42}
}
```

View File

@ -36,11 +36,11 @@ description = "素晴らしいNyashプロジェクト"
[dependencies]
# 標準ライブラリ
nyashstd = { path = "./stdlib/nyashstd.nyash" }
nyashstd = { path = "./stdlib/nyashstd.hako" }
# ユーザーライブラリ
mylib = { path = "./libs/mylib.nyash" }
utils = { path = "./src/utils.nyash" }
mylib = { path = "./libs/mylib.hako" }
utils = { path = "./src/utils.hako" }
# 将来の外部パッケージ(例)
# http_client = { version = "1.0.0", registry = "nyash-pkg" }
@ -51,7 +51,7 @@ libs = "./libs/"
src = "./src/"
[build]
entry_point = "./src/main.nyash"
entry_point = "./src/main.hako"
```
### 依存関係タイプ
@ -59,7 +59,7 @@ entry_point = "./src/main.nyash"
#### 1. **ローカル依存**
```toml
[dependencies]
my_module = { path = "./src/my_module.nyash" }
my_module = { path = "./src/my_module.hako" }
```
#### 2. **標準ライブラリ**
@ -130,30 +130,30 @@ nyashstd.string.upper("hello") // using不要
my-nyash-project/
├── nyash.link # 依存関係定義
├── src/
│ ├── main.nyash # エントリーポイント
│ ├── utils.nyash # ユーティリティモジュール
│ ├── main.hako # エントリーポイント
│ ├── utils.hako # ユーティリティモジュール
│ └── models/
│ └── user.nyash # モデル定義
│ └── user.hako # モデル定義
├── libs/ # プロジェクト固有ライブラリ
│ └── mylib.nyash
│ └── mylib.hako
├── stdlib/ # 標準ライブラリ(システム配布)
│ └── nyashstd.nyash
│ └── nyashstd.hako
└── tests/ # テストファイル
└── test_main.nyash
└── test_main.hako
```
### 標準ライブラリ構造
```
stdlib/
├── nyashstd.nyash # メインエントリー
├── nyashstd.hako # メインエントリー
├── string/
│ └── mod.nyash # string関連機能
│ └── mod.hako # string関連機能
├── math/
│ └── mod.nyash # 数学関数
│ └── mod.hako # 数学関数
├── http/
│ └── mod.nyash # HTTP関連
│ └── mod.hako # HTTP関連
└── io/
└── mod.nyash # I/O関連
└── mod.hako # I/O関連
```
## 🔄 動作フロー
@ -167,13 +167,13 @@ cd my-project
### 2. 実行時解決
```
main.nyash実行
main.hako実行
nyash.link読み込み
using nyashstd解析
./stdlib/nyashstd.nyash読み込み
./stdlib/nyashstd.hako読み込み
namespace nyashstd解析・登録
@ -200,7 +200,7 @@ mylib.hello() // 関数呼び出し
// nyash.link
[dependencies]
mylib = { path = "./mylib.nyash" }
mylib = { path = "./mylib.hako" }
```
### Phase 2: 名前空間サポート
@ -209,7 +209,7 @@ mylib = { path = "./mylib.nyash" }
using nyashstd
string.upper("hello")
// nyashstd.nyash
// nyashstd.hako
namespace nyashstd {
static box string {
static upper(str) { ... }
@ -237,7 +237,7 @@ namespace nyashstd {
### 📝 Medium来週
7. **namespace構文** - static box解析
8. **標準ライブラリ設計** - nyashstd.nyash作成
8. **標準ライブラリ設計** - nyashstd.hako作成
9. **完全修飾名** - nyashstd.string.upper()
### 🔮 Future今後

View File

@ -256,7 +256,7 @@ impl UniversalNamespaceRegistry {
},
Dependency::Path { path } => {
let module = ExternalModule::load_from_file(Path::new(path))?;
self.nyash_modules.insert(namespace_name.clone(), Arc::new(module));
self.hako_modules.insert(namespace_name.clone(), Arc::new(module));
},
Dependency::Builtin { .. } => {
// 組み込みライブラリは既に初期化済み
@ -298,7 +298,7 @@ impl UniversalNamespaceRegistry {
}
// Nyashモジュールチェック
if let Some(_module) = self.nyash_modules.get(namespace_name) {
if let Some(_module) = self.hako_modules.get(namespace_name) {
if !context.module_namespaces.contains(&namespace_name.to_string()) {
context.module_namespaces.push(namespace_name.to_string());
}
@ -351,7 +351,7 @@ impl UniversalNamespaceRegistry {
// 3. Nyashモジュール解決
for namespace in &context.module_namespaces {
if let Some(module) = self.nyash_modules.get(namespace) {
if let Some(module) = self.hako_modules.get(namespace) {
if let Some(function) = module.resolve_function(box_name, method_name) {
return Ok(ResolvedCall::ModuleCall {
namespace: namespace.clone(),
@ -580,7 +580,7 @@ impl VmBackend {
#### **Phase 0: 基本統合テスト**
```nyash
# test_basic_integration.nyash
# test_basic_integration.hako
using nyashstd
# 組み込み標準ライブラリのみ
@ -590,7 +590,7 @@ assert(math.sin(0) == 0)
#### **Phase 1: BID統合テスト**
```nyash
# test_bid_integration.nyash
# test_bid_integration.hako
using nyashstd
using console_api
@ -601,7 +601,7 @@ console.log("Testing") # FFI-ABI
#### **Phase 2: 完全統合テスト**
```nyash
# test_full_integration.nyash
# test_full_integration.hako
using nyashstd
using console_api
using mylib
@ -614,7 +614,7 @@ mylib.process("data") # Nyashモジュール
### エラーハンドリングテスト
```nyash
# test_error_handling.nyash
# test_error_handling.hako
try {
using nonexistent_api
} catch error {

View File

@ -386,7 +386,7 @@ string_box.split(separator) // 新規実装不要
#### **基本機能テスト**
```nyash
# test_builtin_stdlib_basic.nyash
# test_builtin_stdlib_basic.hako
using nyashstd
# 文字列操作
@ -406,7 +406,7 @@ assert(array.get(arr, 1) == 2)
#### **エラーハンドリング**
```nyash
# test_builtin_stdlib_errors.nyash
# test_builtin_stdlib_errors.hako
using nyashstd
# 引数数エラー

View File

@ -7,15 +7,15 @@
my-awesome-app/
├── nyash.link # 依存関係定義
├── src/
│ ├── main.nyash # メインファイル
│ ├── main.hako # メインファイル
│ ├── models/
│ │ └── user.nyash # ユーザーモデル
│ │ └── user.hako # ユーザーモデル
│ └── utils/
│ └── helpers.nyash # ヘルパー関数
│ └── helpers.hako # ヘルパー関数
├── libs/
│ └── custom_lib.nyash # カスタムライブラリ
│ └── custom_lib.hako # カスタムライブラリ
└── stdlib/
└── nyashstd.nyash # 標準ライブラリ
└── nyashstd.hako # 標準ライブラリ
```
### 📋 nyash.linkファイル例
@ -27,14 +27,14 @@ description = "Everything is Box philosophy in action!"
[dependencies]
# 標準ライブラリ
nyashstd = { path = "./stdlib/nyashstd.nyash" }
nyashstd = { path = "./stdlib/nyashstd.hako" }
# プロジェクト内モジュール
user_model = { path = "./src/models/user.nyash" }
helpers = { path = "./src/utils/helpers.nyash" }
user_model = { path = "./src/models/user.hako" }
helpers = { path = "./src/utils/helpers.hako" }
# カスタムライブラリ
custom_lib = { path = "./libs/custom_lib.nyash" }
custom_lib = { path = "./libs/custom_lib.hako" }
[search_paths]
stdlib = "./stdlib/"
@ -42,14 +42,14 @@ src = "./src/"
libs = "./libs/"
[build]
entry_point = "./src/main.nyash"
entry_point = "./src/main.hako"
```
## 🌟 実用的なコード例
### 1. 基本的なusing使用
```nyash
# ===== src/main.nyash =====
# ===== src/main.hako =====
using nyashstd
using helpers
@ -77,7 +77,7 @@ static box Main {
### 2. 標準ライブラリ定義例
```nyash
# ===== stdlib/nyashstd.nyash =====
# ===== stdlib/nyashstd.hako =====
namespace nyashstd {
static box string {
static upper(str) {
@ -139,7 +139,7 @@ namespace nyashstd {
### 3. ヘルパーモジュール例
```nyash
# ===== src/utils/helpers.nyash =====
# ===== src/utils/helpers.hako =====
using nyashstd
static function process_data(data) {
@ -161,7 +161,7 @@ static function format_user_name(first, last) {
### 4. モデル定義例
```nyash
# ===== src/models/user.nyash =====
# ===== src/models/user.hako =====
using nyashstd
using helpers
@ -200,7 +200,7 @@ box User {
### 1. シンプルなWebサーバー
```nyash
# ===== web_server.nyash =====
# ===== web_server.hako =====
using nyashstd
using custom_lib
@ -245,7 +245,7 @@ server.start()
### 2. データ処理パイプライン
```nyash
# ===== data_processor.nyash =====
# ===== data_processor.hako =====
using nyashstd
using helpers
@ -341,8 +341,8 @@ local sin_val = sin(3.14) # math.sin不要
### Before現在のinclude使用
```nyash
# ===== 既存のtext_adventure例 =====
include "text_adventure/items.nyash"
include "text_adventure/rooms.nyash"
include "text_adventure/items.hako"
include "text_adventure/rooms.hako"
# アイテム作成
local sword = new Weapon("Sword", 10)
@ -352,10 +352,10 @@ local sword = new Weapon("Sword", 10)
```nyash
# ===== nyash.link =====
[dependencies]
game_items = { path = "./text_adventure/items.nyash" }
game_rooms = { path = "./text_adventure/rooms.nyash" }
game_items = { path = "./text_adventure/items.hako" }
game_rooms = { path = "./text_adventure/rooms.hako" }
# ===== main.nyash =====
# ===== main.hako =====
using game_items
using game_rooms

View File

@ -321,7 +321,7 @@ pub struct NamespaceRegistry {
### 📁 nyash.link対応
```toml
[dependencies]
mylib = { path = "./mylib.nyash" }
mylib = { path = "./mylib.hako" }
# using mylib # Phase 2で対応
```
@ -330,7 +330,7 @@ mylib = { path = "./mylib.nyash" }
### Phase 0テスト
```nyash
# test_phase0_basic.nyash
# test_phase0_basic.hako
using nyashstd
# 基本動作
@ -347,7 +347,7 @@ try {
### Phase 1テスト
```nyash
# test_phase1_qualified.nyash
# test_phase1_qualified.hako
# using不要のテスト
assert(nyashstd.string.upper("hello") == "HELLO")
assert(nyashstd.math.sin(0) == 0)
@ -355,7 +355,7 @@ assert(nyashstd.math.sin(0) == 0)
### Phase 2テスト
```nyash
# test_phase2_external.nyash
# test_phase2_external.hako
using mylib
assert(mylib.custom.process("data") == "processed: data")

View File

@ -187,7 +187,7 @@ impl ModuleResolver {
}
// ファイルパス解決
let file_path = self.nyash_link.resolve_dependency(module_name)
let file_path = self.hako_link.resolve_dependency(module_name)
.ok_or(ResolverError::ModuleNotFound(module_name.to_string()))?;
// 再帰的読み込み防止
@ -376,15 +376,15 @@ impl NyashInterpreter {
### Phase 1テスト
```nyash
# test_basic_using.nyash
# test_basic_using.hako
# 基本using文テスト
# ファイル: mylib.nyash
# ファイル: mylib.hako
static function hello() {
return "Hello from mylib!"
}
# ファイル: main.nyash
# ファイル: main.hako
using mylib
local result = mylib.hello()
assert(result == "Hello from mylib!")
@ -392,12 +392,12 @@ assert(result == "Hello from mylib!")
### Phase 2テスト
```nyash
# test_nyash_link.nyash
# test_nyash_link.hako
# nyash.linkファイル連携テスト
# nyash.link内容:
# [dependencies]
# mylib = { path = "./mylib.nyash" }
# mylib = { path = "./mylib.hako" }
using mylib
local result = mylib.process("data")
@ -406,10 +406,10 @@ assert(result == "processed: data")
### Phase 3テスト
```nyash
# test_namespace.nyash
# test_namespace.hako
# 名前空間システムテスト
# nyashstd.nyash:
# nyashstd.hako:
# namespace nyashstd {
# static box string {
# static upper(str) { ... }
@ -457,7 +457,7 @@ assert(result2 == "WORLD")
- 動的モジュール読み込み
### Phase 6: 標準ライブラリ
- nyashstd.nyash完全実装
- nyashstd.hako完全実装
- string/math/io/http モジュール
- ドキュメント生成

View File

@ -149,9 +149,9 @@ http_api = {
}
# === Nyashモジュール従来通り ===
mylib = { path = "./src/mylib.nyash" }
mylib = { path = "./src/mylib.hako" }
utils = { path = "./src/utils/" }
models = { path = "./src/models.nyash" }
models = { path = "./src/models.hako" }
# === 将来の外部パッケージ ===
awesome_lib = {
@ -161,7 +161,7 @@ awesome_lib = {
}
[build]
entry_point = "./src/main.nyash"
entry_point = "./src/main.hako"
backends = ["vm", "wasm", "aot"]
optimization_level = "release"

View File

@ -342,7 +342,7 @@ impl NyashParser {
#### **基本using文テスト**
```nyash
# test_using_basic.nyash
# test_using_basic.hako
using nyashstd
local result = string.upper("hello")
@ -354,7 +354,7 @@ assert(lower == "world")
#### **数学関数テスト**
```nyash
# test_math_basic.nyash
# test_math_basic.hako
using nyashstd
local sin_result = math.sin(0)
@ -366,7 +366,7 @@ assert(sqrt_result == 4)
#### **配列操作テスト**
```nyash
# test_array_basic.nyash
# test_array_basic.hako
using nyashstd
local arr = [1, 2, 3]
@ -410,7 +410,7 @@ namespace mylib {
```toml
# nyash.link
[dependencies]
mylib = { path = "./mylib.nyash" }
mylib = { path = "./mylib.hako" }
```
## 🎯 実装優先順位

View File

@ -11,7 +11,7 @@ canvas_api = { bid = "./apis/canvas.yaml" }
dom_api = { bid = "./apis/dom.yaml" }
audio_api = { bid = "./apis/webaudio.yaml" }
# === game.nyash ===
# === game.hako ===
using nyashstd
using canvas_api
using dom_api
@ -123,7 +123,7 @@ numpy_api = { bid = "./apis/numpy.yaml", library = "./libs/numpy.so" }
matplotlib_api = { bid = "./apis/matplotlib.yaml", library = "./libs/matplotlib.so" }
file_api = { bid = "./apis/file.yaml" }
# === image_processor.nyash ===
# === image_processor.hako ===
using nyashstd
using opencv_api
using numpy_api
@ -213,7 +213,7 @@ sqlite_api = { bid = "./apis/sqlite.yaml", library = "./libs/sqlite.so" }
json_api = { bid = "./apis/json.yaml" }
crypto_api = { bid = "./apis/crypto.yaml", library = "./libs/openssl.so" }
# === api_server.nyash ===
# === api_server.hako ===
using nyashstd
using http_server_api
using sqlite_api
@ -342,7 +342,7 @@ libc_api = { bid = "./apis/libc.yaml", library = "system" }
inotify_api = { bid = "./apis/inotify.yaml", library = "system" }
filesystem_api = { bid = "./apis/filesystem.yaml" }
# === file_monitor.nyash ===
# === file_monitor.hako ===
using nyashstd
using libc_api
using inotify_api

View File

@ -55,15 +55,15 @@ opencv = { bid = "./apis/opencv.yaml", library = "./libs/opencv.so" }
sqlite = { bid = "./apis/sqlite.yaml", library = "./libs/sqlite.so" }
# === Nyashモジュール従来通り ===
mylib = { path = "./src/mylib.nyash" }
utils = { path = "./src/utils.nyash" }
mylib = { path = "./src/mylib.hako" }
utils = { path = "./src/utils.hako" }
models = { path = "./src/models/" }
# === 将来の外部パッケージ ===
# http_client = { version = "1.0.0", registry = "nyash-pkg" }
[build]
entry_point = "./src/main.nyash"
entry_point = "./src/main.hako"
backends = ["vm", "wasm", "aot"] # 対象バックエンド指定
```
@ -207,7 +207,7 @@ impl UniversalNamespaceRegistry {
}
// Nyashモジュール
if self.nyash_modules.contains_key(namespace_name) {
if self.hako_modules.contains_key(namespace_name) {
if !context.module_imports.contains(&namespace_name.to_string()) {
context.module_imports.push(namespace_name.to_string());
}
@ -249,7 +249,7 @@ impl UniversalNamespaceRegistry {
// 3. Nyashモジュール検索
for namespace in &context.module_imports {
if let Some(module) = self.nyash_modules.get(namespace) {
if let Some(module) = self.hako_modules.get(namespace) {
if let Some(target) = module.resolve_method(box_name, method_name) {
return Ok(CallTarget::NyashModule(target));
}
@ -520,7 +520,7 @@ impl AotCompiler {
### 基本統合テスト
```nyash
# test_universal_integration.nyash
# test_universal_integration.hako
using nyashstd
using console_api
using mylib
@ -533,7 +533,7 @@ assert(mylib.process("data") == "processed") # Nyash
### FFI-ABI統合テスト
```nyash
# test_ffi_abi_integration.nyash
# test_ffi_abi_integration.hako
using canvas_api
# Canvas API経由での描画

View File

@ -217,14 +217,14 @@ echo 'static box Main {
return me.server.isServer()
}
}' > test_arc_fix.nyash
}' > test_arc_fix.hako
```
### 実行・検証
```bash
# ビルド・実行
cargo build --release
./target/release/nyash test_arc_fix.nyash
./target/release/nyash test_arc_fix.hako
# 期待される結果:
# === Before bind ===
@ -251,7 +251,7 @@ cargo build --release
## 🎯 修正完了条件
### ✅ 成功条件
1. **テスト成功**: `test_arc_fix.nyash``isServer: true` が表示される
1. **テスト成功**: `test_arc_fix.hako``isServer: true` が表示される
2. **コンパイル成功**: `cargo build --release` でエラーなし
3. **既存テスト成功**: `cargo test` でテスト通過
4. **デバッグログ確認**: 同一SocketBox IDが維持される