Files
hakorune/Cargo.toml

294 lines
8.0 KiB
TOML
Raw Normal View History

[package]
name = "nyash-rust"
version = "0.1.0"
edition = "2021"
authors = ["Claude Code <claude@anthropic.com>"]
description = "Everything is Box in Rust - Ultimate Memory Safe Nyash Implementation"
license = "MIT"
repository = "https://github.com/user/nyash"
keywords = ["language", "interpreter", "box", "memory-safe", "rust"]
categories = ["development-tools::parsing", "interpreters"]
# Default features - minimal CLI only
[features]
default = ["cli", "plugins"]
# Legacy features removed - archive cleaned up
e2e = []
cli = []
legacy-tests = [] # Legacy/phi-off test suites (pre-JoinIR). Disabled by default.
plugins-only = []
builtin-core = []
FileBox SSOT設計移行完了: Provider Pattern実装 ## 🎯 目的 FileBoxをSSOT(Single Source of Truth)設計に移行し、 static/dynamic/builtin providerを統一的に扱える基盤を構築。 ## ✅ 実装完了(7タスク) ### 1. Provider Lock Global **File**: `src/runtime/provider_lock.rs` - `FILEBOX_PROVIDER: OnceLock<Arc<dyn FileIo>>` 追加 - `set_filebox_provider()` / `get_filebox_provider()` 実装 ### 2. VM初期化時のProvider選択 **File**: `src/runner/modes/vm.rs` - `execute_vm_mode()` 冒頭でprovider選択・登録 - ENV(`NYASH_FILEBOX_MODE`, `NYASH_DISABLE_PLUGINS`)対応 ### 3. CoreRoFileIo完全実装 **File**: `src/boxes/file/core_ro.rs` (NEW) - Read-onlyファイルI/O実装 - Thread-safe: `RwLock<Option<File>>` - Newline正規化(CRLF→LF) ### 4. FileBox委譲化 **File**: `src/boxes/file/mod.rs` - 直接`std::fs::File`使用 → `Arc<dyn FileIo>` provider委譲 - 全メソッドをprovider経由に変更 - Fail-Fast: write/delete等の非対応操作は明確エラー ### 5. basic/file_box.rs Deprecate **File**: `src/boxes/file/basic/file_box.rs` - 120行 → 12行に削減 - `#[deprecated]` マーク + 再エクスポート - 後方互換性維持 ### 6. Feature Flag追加 **File**: `Cargo.toml` - `builtin-filebox = []` feature追加 ### 7. Provider抽象・選択ロジック **Files**: - `src/boxes/file/provider.rs` (NEW) - FileIo trait定義 - `src/boxes/file/box_shim.rs` (NEW) - 薄いラッパー - `src/runner/modes/common_util/provider_registry.rs` (NEW) - 選択ロジック ## 📊 アーキテクチャ進化 **Before**: ``` FileBox (mod.rs) ──直接使用──> std::fs::File FileBox (basic/) ──直接使用──> std::fs ``` **After**: ``` FileBox ──委譲──> Arc<dyn FileIo> ──実装──> CoreRoFileIo ├──> PluginFileIo (future) └──> BuiltinFileIo (future) ``` ## 🔧 技術的成果 1. **Thread Safety**: `RwLock<Option<File>>` で並行アクセス安全 2. **Fail-Fast**: 非対応操作は明確エラー(silent failure無し) 3. **後方互換性**: deprecated re-exportで既存コード維持 4. **環境制御**: `NYASH_FILEBOX_MODE` でランタイム切替 ## 📝 環境変数 - `NYASH_FILEBOX_MODE=auto|core-ro|plugin-only` - `auto`: プラグインあれば使用、なければCoreRoにフォールバック - `core-ro`: 強制的にCoreRo(read-only) - `plugin-only`: プラグイン必須(なければFail-Fast) - `NYASH_DISABLE_PLUGINS=1`: 強制的にcore-roモード ## 🎯 次のステップ(Future) - [ ] Dynamic統合(plugin_loaderとの連携) - [ ] BuiltinFileIo実装(feature builtin-filebox) - [ ] Write/Delete等の操作対応(provider拡張) ## 📚 ドキュメント - 詳細仕様: `docs/development/runtime/FILEBOX_PROVIDER.md` 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-08 15:13:22 +09:00
builtin-filebox = [] # Enable built-in FileBox provider (SSOT)
## Silence check-cfg warnings for historical cfg guards (kept off by default)
vm-legacy = []
phi-legacy = []
## JIT-direct only mode: disable legacy VM-arg fallback and plugin-builtins branches
## (keeps code compiling; VM-integrated JIT paths remain but are inert)
jit-direct-only = []
gui = ["dep:egui", "dep:eframe", "dep:egui_extras", "dep:image"]
gui-examples = ["gui"]
all-examples = ["gui-examples"]
dynamic-file = []
wasm-backend = ["dep:wasmtime", "dep:wabt"]
Phase 22.1 WIP: SSOT resolver + TLV infrastructure + Hako MIR builder setup Setup infrastructure for Phase 22.1 (TLV C shim & Resolver SSOT): Core changes: - Add nyash_tlv, nyash_c_core, nyash_kernel_min_c crates (opt-in) - Implement SSOT resolver bridge (src/using/ssot_bridge.rs) - Add HAKO_USING_SSOT=1 / HAKO_USING_SSOT_HAKO=1 env support - Add HAKO_TLV_SHIM=1 infrastructure (requires --features tlv-shim) MIR builder improvements: - Fix using/alias consistency in Hako MIR builder - Add hako.mir.builder.internal.{prog_scan,pattern_util} to nyash.toml - Normalize LLVM extern calls: nyash.console.* → nyash_console_* Smoke tests: - Add phase2211 tests (using_ssot_hako_parity_canary_vm.sh) - Add phase2220, phase2230, phase2231 test structure - Add phase2100 S3 backend selector tests - Improve test_runner.sh with quiet/timeout controls Documentation: - Add docs/ENV_VARS.md (Phase 22.1 env vars reference) - Add docs/development/runtime/C_CORE_ABI.md - Update de-rust-roadmap.md with Phase 22.x details Tools: - Add tools/hakorune_emit_mir.sh (Hako-first MIR emission wrapper) - Add tools/tlv_roundtrip_smoke.sh placeholder - Improve ny_mir_builder.sh with better backend selection Known issues (to be fixed): - Parser infinite loop in static method parameter parsing - Stage-B output contamination with "RC: 0" (needs NYASH_JSON_ONLY=1) - phase2211/using_ssot_hako_parity_canary_vm.sh fork bomb (needs recursion guard) Next steps: Fix parser infinite loop + Stage-B quiet mode for green tests
2025-11-09 15:11:18 +09:00
# TLV C shim wiring (default OFF): enables optional dependency `nyash-tlv`
tlv-shim = ["dep:nyash-tlv"]
# Core C shims (design-stage; default OFF)
c-core = ["dep:nyash-c-core"]
# プラグイン機構の有効化(ネイティブ環境のみ推奨)
plugins = ["dep:libloading"]
# MIR instruction diet PoC flags (scaffolding only; off by default)
mir_typeop_poc = []
mir_refbarrier_unify_poc = []
# LLVM features split
# - llvm-harness: Python/llvmlite harness onlyinkwell不要
# - llvm-inkwell-legacy: historical Rust/inkwell backend参照用
# keep `llvm` as a compatibility alias to `llvm-harness`
llvm-harness = []
llvm-inkwell-legacy = ["dep:inkwell"]
llvm = ["llvm-harness"]
# Legacy AST interpreter (off by default). Gates NyashInterpreter usage in runner/tests.
interpreter-legacy = []
# Cranelift JIT cfg guard (ARCHIVED): keep feature empty to silence check-cfg warnings.
cranelift-jit = []
# (removed) Optional modular MIR builder feature
# cranelift-jit = [ # ARCHIVED: Moved to archive/jit-cranelift/ during Phase 15
# "dep:cranelift-codegen",
# "dep:cranelift-frontend",
# "dep:cranelift-module",
# "dep:cranelift-jit",
# "dep:cranelift-object",
# "dep:cranelift-native"
# ]
aot-plan-import = []
[lib]
name = "nyash_rust"
path = "src/lib.rs"
crate-type = ["cdylib", "rlib"]
# Bin layout (Stage0/Stage1)
# - Stage0: Rust bootstrap CLI (`nyash`) — OS entry, VM/LLVM core, minimal runner.
# - Stage1: Hakorune selfhost binary (`hakorune-selfhost`) is built via tools/selfhost/build_stage1.sh
# and lives under target/selfhost/, not as a Cargo [[bin]] (Phase 25.1 design).
# Main CLI binary - always available (Stage0 bootstrap)
[[bin]]
name = "nyash"
path = "src/main.rs"
# Test binary for multi-box plugin loader
[[bin]]
name = "test-plugin-loader-v2"
path = "src/bin/test_plugin_loader_v2.rs"
required-features = ["dynamic-file"]
[[bin]]
name = "ny_mir_builder"
path = "src/bin/ny_mir_builder.rs"
# Examples for development - only available as examples, not bins
[[example]]
name = "gui_simple_notepad"
path = "examples/simple_notepad.rs"
required-features = ["gui-examples"]
[[example]]
name = "gui_simple_notepad_v2"
path = "examples/simple_notepad_v2.rs"
required-features = ["gui-examples"]
[[example]]
name = "gui_simple_notepad_ascii"
path = "examples/simple_notepad_ascii.rs"
required-features = ["gui-examples"]
[[example]]
name = "gui_debug_notepad"
path = "examples/debug_notepad.rs"
required-features = ["gui-examples"]
[[example]]
name = "gui_nyash_notepad_jp"
path = "examples/nyash_notepad_jp.rs"
required-features = ["gui-examples"]
[[example]]
name = "gui_nyash_explorer"
path = "examples/nyash_explorer.rs"
required-features = ["gui-examples"]
[[example]]
name = "gui_nyash_explorer_with_icons"
path = "examples/nyash_explorer_with_icons.rs"
required-features = ["gui-examples"]
[[example]]
name = "gui_test_icon_extraction"
path = "examples/test_icon_extraction.rs"
required-features = ["gui-examples"]
# [[example]]
# name = "gui_visual_node_prototype"
# path = "development/egui_research/experiments/visual_node_prototype.rs"
# required-features = ["gui-examples"]
🎨 feat: EguiBox GUI開発基盤完成 + パーサー無限ループバグ修正 ## 🚀 主要機能追加 ### EguiBox - GUI開発基盤 - Windows版GUIメモ帳アプリ (simple_notepad.rs, nyash_notepad_jp.rs) - 日本語フォント対応 (NotoSansJP-VariableFont_wght.ttf) - BMPアイコン表示システム (c_drive_icon.bmp) - Windowsエクスプローラー風アプリ (nyash_explorer.rs) - アイコン抽出システム (test_icon_extraction.rs) ### ビジュアルプログラミング準備 - NyashFlow プロジェクト設計完成 (NYASHFLOW_PROJECT_HANDOVER.md) - ビジュアルノードプロトタイプ基盤 - WebAssembly対応準備 ## 🔧 重大バグ修正 ### パーサー無限ループ問題 (3引数メソッド呼び出し) - 原因: メソッドパラメータ解析ループの予約語処理不備 - 修正: src/parser/mod.rs - 非IDENTIFIERトークンのエラーハンドリング追加 - 効果: "from"等の予約語で適切なエラー報告、ハング→瞬時エラー ### MapBoxハング問題調査 - MapBox+3引数メソッド呼び出し組み合わせ問題特定 - バグレポート作成 (MAPBOX_HANG_BUG_REPORT.md) - 事前評価vs必要時評価の設計問題明確化 ## 🧹 コード品質向上 - box_methods.rs を8モジュールに機能分離 - 一時デバッグコード全削除 (eprintln\!, unsafe等) - 構文チェック通過確認済み ## 📝 ドキュメント整備 - CLAUDE.md にGUI開発セクション追加 - Gemini/ChatGPT先生相談ログ保存 (sessions/) - 段階的デバッグ手法確立 ## 🎯 次の目標 - must_advance\!マクロ実装 (無限ループ早期検出) - コマンド引数でデバッグ制御 (--debug-fuel) - MapBox問題の根本修正 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-10 07:54:03 +09:00
[dependencies]
# エラーハンドリング
thiserror = "2.0"
anyhow = "1.0"
# 開発時のスタックオーバーフロー診断用
backtrace-on-stack-overflow = "0.3"
# シリアライゼーション将来のAST永続化用
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
# コマンドライン(将来の CLI用
clap = { version = "4.0", features = ["derive"] }
# 並行処理GlobalBox用
lazy_static = "1.5"
once_cell = "1.20"
# デバッグ・ログ
log = "0.4"
env_logger = "0.11"
libloading = { version = "0.8", optional = true }
toml = "0.8"
which = "6"
Phase 22.1 WIP: SSOT resolver + TLV infrastructure + Hako MIR builder setup Setup infrastructure for Phase 22.1 (TLV C shim & Resolver SSOT): Core changes: - Add nyash_tlv, nyash_c_core, nyash_kernel_min_c crates (opt-in) - Implement SSOT resolver bridge (src/using/ssot_bridge.rs) - Add HAKO_USING_SSOT=1 / HAKO_USING_SSOT_HAKO=1 env support - Add HAKO_TLV_SHIM=1 infrastructure (requires --features tlv-shim) MIR builder improvements: - Fix using/alias consistency in Hako MIR builder - Add hako.mir.builder.internal.{prog_scan,pattern_util} to nyash.toml - Normalize LLVM extern calls: nyash.console.* → nyash_console_* Smoke tests: - Add phase2211 tests (using_ssot_hako_parity_canary_vm.sh) - Add phase2220, phase2230, phase2231 test structure - Add phase2100 S3 backend selector tests - Improve test_runner.sh with quiet/timeout controls Documentation: - Add docs/ENV_VARS.md (Phase 22.1 env vars reference) - Add docs/development/runtime/C_CORE_ABI.md - Update de-rust-roadmap.md with Phase 22.x details Tools: - Add tools/hakorune_emit_mir.sh (Hako-first MIR emission wrapper) - Add tools/tlv_roundtrip_smoke.sh placeholder - Improve ny_mir_builder.sh with better backend selection Known issues (to be fixed): - Parser infinite loop in static method parameter parsing - Stage-B output contamination with "RC: 0" (needs NYASH_JSON_ONLY=1) - phase2211/using_ssot_hako_parity_canary_vm.sh fork bomb (needs recursion guard) Next steps: Fix parser infinite loop + Stage-B quiet mode for green tests
2025-11-09 15:11:18 +09:00
nyash-tlv = { path = "crates/nyash_tlv", optional = true, features = ["c-shim"] }
nyash-c-core = { path = "crates/nyash_c_core", optional = true }
tempfile = "3.10"
# 日時処理
chrono = "0.4"
# HTTP通信HttpClientBox用
# reqwest = { version = "0.11", features = ["blocking"] } # Temporarily disabled
# 正規表現RegexBox用
regex = "1.0"
# WebAssembly対応
wasm-bindgen = "0.2"
console_error_panic_hook = "0.1"
js-sys = "0.3"
# Cranelift JIT (ARCHIVED: moved to archive/jit-cranelift/ during Phase 15)
# cranelift-codegen = { version = "0.103", optional = true }
# cranelift-frontend = { version = "0.103", optional = true }
# cranelift-module = { version = "0.103", optional = true }
# cranelift-jit = { version = "0.103", optional = true }
# cranelift-object = { version = "0.103", optional = true }
# cranelift-native = { version = "0.103", optional = true }
# WASM backend dependencies (Phase 8) - optional for faster builds
wabt = { version = "0.10", optional = true }
wasmtime = { version = "35.0.0", optional = true }
# GUI フレームワーク - only when gui feature is enabled
egui = { version = "0.29", optional = true }
eframe = { version = "0.29", default-features = false, features = ["default_fonts", "glow"], optional = true }
egui_extras = { version = "0.29", features = ["image"], optional = true }
image = { version = "0.25", features = ["png", "ico"], optional = true }
🎨 feat: EguiBox GUI開発基盤完成 + パーサー無限ループバグ修正 ## 🚀 主要機能追加 ### EguiBox - GUI開発基盤 - Windows版GUIメモ帳アプリ (simple_notepad.rs, nyash_notepad_jp.rs) - 日本語フォント対応 (NotoSansJP-VariableFont_wght.ttf) - BMPアイコン表示システム (c_drive_icon.bmp) - Windowsエクスプローラー風アプリ (nyash_explorer.rs) - アイコン抽出システム (test_icon_extraction.rs) ### ビジュアルプログラミング準備 - NyashFlow プロジェクト設計完成 (NYASHFLOW_PROJECT_HANDOVER.md) - ビジュアルノードプロトタイプ基盤 - WebAssembly対応準備 ## 🔧 重大バグ修正 ### パーサー無限ループ問題 (3引数メソッド呼び出し) - 原因: メソッドパラメータ解析ループの予約語処理不備 - 修正: src/parser/mod.rs - 非IDENTIFIERトークンのエラーハンドリング追加 - 効果: "from"等の予約語で適切なエラー報告、ハング→瞬時エラー ### MapBoxハング問題調査 - MapBox+3引数メソッド呼び出し組み合わせ問題特定 - バグレポート作成 (MAPBOX_HANG_BUG_REPORT.md) - 事前評価vs必要時評価の設計問題明確化 ## 🧹 コード品質向上 - box_methods.rs を8モジュールに機能分離 - 一時デバッグコード全削除 (eprintln\!, unsafe等) - 構文チェック通過確認済み ## 📝 ドキュメント整備 - CLAUDE.md にGUI開発セクション追加 - Gemini/ChatGPT先生相談ログ保存 (sessions/) - 段階的デバッグ手法確立 ## 🎯 次の目標 - must_advance\!マクロ実装 (無限ループ早期検出) - コマンド引数でデバッグ制御 (--debug-fuel) - MapBox問題の根本修正 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-10 07:54:03 +09:00
# LLVM backend deps (optional)
# Move to LLVM 18.1.x toolchains
inkwell = { version = "0.6.0", features = ["llvm18-1"], optional = true }
🎨 feat: EguiBox GUI開発基盤完成 + パーサー無限ループバグ修正 ## 🚀 主要機能追加 ### EguiBox - GUI開発基盤 - Windows版GUIメモ帳アプリ (simple_notepad.rs, nyash_notepad_jp.rs) - 日本語フォント対応 (NotoSansJP-VariableFont_wght.ttf) - BMPアイコン表示システム (c_drive_icon.bmp) - Windowsエクスプローラー風アプリ (nyash_explorer.rs) - アイコン抽出システム (test_icon_extraction.rs) ### ビジュアルプログラミング準備 - NyashFlow プロジェクト設計完成 (NYASHFLOW_PROJECT_HANDOVER.md) - ビジュアルノードプロトタイプ基盤 - WebAssembly対応準備 ## 🔧 重大バグ修正 ### パーサー無限ループ問題 (3引数メソッド呼び出し) - 原因: メソッドパラメータ解析ループの予約語処理不備 - 修正: src/parser/mod.rs - 非IDENTIFIERトークンのエラーハンドリング追加 - 効果: "from"等の予約語で適切なエラー報告、ハング→瞬時エラー ### MapBoxハング問題調査 - MapBox+3引数メソッド呼び出し組み合わせ問題特定 - バグレポート作成 (MAPBOX_HANG_BUG_REPORT.md) - 事前評価vs必要時評価の設計問題明確化 ## 🧹 コード品質向上 - box_methods.rs を8モジュールに機能分離 - 一時デバッグコード全削除 (eprintln\!, unsafe等) - 構文チェック通過確認済み ## 📝 ドキュメント整備 - CLAUDE.md にGUI開発セクション追加 - Gemini/ChatGPT先生相談ログ保存 (sessions/) - 段階的デバッグ手法確立 ## 🎯 次の目標 - must_advance\!マクロ実装 (無限ループ早期検出) - コマンド引数でデバッグ制御 (--debug-fuel) - MapBox問題の根本修正 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-10 07:54:03 +09:00
# Windows API
[target.'cfg(windows)'.dependencies]
windows = { version = "0.60", features = [
"Win32_Foundation",
"Win32_Storage_FileSystem",
"Win32_UI_Shell",
"Win32_UI_WindowsAndMessaging",
"Win32_System_Com",
"Win32_Graphics_Gdi",
] }
[dependencies.web-sys]
version = "0.3"
features = [
"console",
"Document",
"Element",
"HtmlElement",
"Window",
"DomTokenList",
"CssStyleDeclaration",
"HtmlCanvasElement",
"CanvasRenderingContext2d",
"ImageData",
"TextMetrics",
"CanvasGradient",
"CanvasPattern",
"Path2d",
"Performance",
"MouseEvent",
"TouchEvent",
"KeyboardEvent",
"AudioContext",
"AudioContextState",
"AudioBuffer",
"AudioBufferSourceNode",
"GainNode",
"AnalyserNode",
"AudioDestinationNode",
"PeriodicWave",
"OscillatorNode",
]
[dev-dependencies]
# テスト・ベンチマークツール
criterion = "0.5"
tempfile = "3"
[build-dependencies]
once_cell = "1.20"
# Benchmark configuration (will be added later)
# [[bench]]
# name = "box_performance"
# harness = false
[workspace]
members = [
"crates/*",
"plugins/*",
]
exclude = [
"plugins/nyash-file",
"plugins/nyash-test-multibox",
# Exclude placeholder/missing crates to keep workspace buildable
"plugins/nyash-aot-plugin",
"plugins/nyash-mirjsonbuildermin-plugin",
"plugins/nyash-set-plugin",
]
[profile.release]
# 最適化設定
opt-level = 3
lto = true
codegen-units = 1
panic = "abort"
[profile.dev]
# 開発用設定
opt-level = 0
debug = true
[profile.release.package."nyash-net-plugin"]
opt-level = "z"
strip = true
[[bin]]
name = "hakorune-rust"
path = "src/main.rs"
[[bin]]
name = "hakorune"
path = "src/main.rs"