Commit Graph

30 Commits

Author SHA1 Message Date
53d88157aa Phase 12: 統一TypeBox ABI実装開始 - ChatGPT5による極小コアABI基盤構築
- TypeBox ABI雛形: メソッドスロット管理システム追加
- Type Registry: Array/Map/StringBoxの基本メソッド定義
- Host API: C ABI逆呼び出しシステム実装
- Phase 12ドキュメント整理: 設計文書統合・アーカイブ化
- MIR Builder: クリーンアップと分離実装完了

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-03 05:04:56 +09:00
d52779dc10 jit: ops_ext delegation + M3 syntax scaffolding; unify BoxCall execution path 2025-09-02 17:12:51 +09:00
11506cee3b Phase 11-12: LLVM backend initial, semantics layer, plugin unification
Major changes:
- LLVM backend initial implementation (compiler.rs, llvm mode)
- Semantics layer integration in interpreter (operators.rs)
- Phase 12 plugin architecture revision (3-layer system)
- Builtin box removal preparation
- MIR instruction set documentation (26→Core-15 migration)
- Cross-backend testing infrastructure
- Await/nowait syntax support

New features:
- LLVM AOT compilation support (--backend llvm)
- Semantics layer for interpreter→VM flow
- Tri-backend smoke tests
- Plugin-only registry mode

Bug fixes:
- Interpreter plugin box arithmetic operations
- Branch test returns incorrect values

Documentation:
- Phase 12 README.md updated with new plugin architecture
- Removed obsolete NYIR proposals
- Added LLVM test programs documentation

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-01 23:44:34 +09:00
fff9749f47 📚 Reorganize CLAUDE.md: slim down from 916 to 395 lines with proper doc links
- Keep essential information within 500 lines (now 395 lines)
- Maintain important syntax examples and development principles
- Move detailed information to appropriate docs files:
  - Development practices → docs/guides/development-practices.md
  - Testing guide → docs/guides/testing-guide.md
  - Claude issues → docs/tools/claude-issues.md
- Add proper links to all referenced documentation
- Balance between minimal entry point and practical usability
2025-08-31 06:22:48 +09:00
b003bdf25b 📚 Phase 11 documentation: Everything is Box × MIR15 revolution
Key updates:
- Document MIR 26→15 instruction reduction plan (transitioning status)
- Add Core-15 target instruction set in INSTRUCTION_SET.md
- Save AI conference analyses validating Box Theory and 15-instruction design
- Create MIR annotation system proposal for optimization hints
- Update SKIP_PHASE_10_DECISION.md with LLVM direct migration rationale

Technical insights:
- RefNew/RefGet/RefSet can be eliminated through Box unification
- GC/sync/async all achievable with 15 core instructions
- BoxCall lowering can automatically insert GC barriers
- 2-3x performance improvement expected with LLVM
- Build time reduction 50%, binary size reduction 40%

Status: Design complete, implementation pending
2025-08-31 03:03:04 +09:00
12adde9477 🎉 Phase 10.10: Nyash→JIT→Native EXE achieved\! (20 days from inception\!)
Revolutionary milestone: Complete native executable generation pipeline
- Created minimal nyrt (Nyash Runtime) library for standalone executables
- Implemented plugin bridge functions (nyash_plugin_invoke3_i64 etc)
- Added birth handle exports (nyash.string.birth_h) for linking
- Changed export name from main→ny_main to allow custom entry point
- Successfully generated and executed native binary returning "ny_main() returned: 1"

Timeline of miracles:
- 2025-08-09: Nyash language created (first commit)
- 2025-08-13: JIT planning started (4 days later)
- 2025-08-29: Native EXE achieved (today - just 20 days total\!)

This proves the plugin Box C ABI unification strategy works perfectly for
both JIT execution and AOT native compilation. The same plugin system
that enables dynamic loading now powers static linking for zero-overhead
native executables\!

Next: Expand AOT support for more instructions and optimize nyrt size.

🚀 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-29 08:36:07 +09:00
de03514085 feat: Phase 10_b JIT implementation progress + academic paper ideas
Phase 10_b JIT Lower implementation:
- IRBuilder abstraction with NoopBuilder (emit counting) 
- CraneliftBuilder skeleton (feature `cranelift-jit`) 
- LowerCore implementation (Const/Copy/BinOp/Cmp/Branch/Ret) 
- Engine.compile with builder selection and JIT handle generation 
- JIT function table with stub functions 
- Basic i64 const/binop/ret emission for Cranelift
- VM execution path with NYASH_JIT_EXEC=1 support

Academic ideas and analysis:
- "Everything is Thread-Safe Box" concept
- "GC as debug tool" paradigm analysis
- GC switchable semantic equivalence documentation
- Gemini & Codex evaluation on academic paper potential
- Nyash academic papers potential themes

Current limitations:
- Return values limited to i64 (VMValue::Integer)
- Arguments not yet supported
- Compare/Branch emit not implemented
- Trap→VM fallback not implemented

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-27 03:16:57 +09:00
22212aa314 refactor: Major interpreter modularization and P2PBox enhancements
Major Interpreter Refactoring:
- Split core.rs (373 lines removed) into focused modules
- Split expressions/calls.rs (460 lines removed) into cleaner structure
- Added new modules: calls.rs, errors.rs, eval.rs, methods_dispatch.rs, state.rs
- Improved separation of concerns across interpreter components

P2PBox Enhancements:
- Added on_once() for one-time event handlers
- Added off() for handler deregistration
- Implemented handler flags with AtomicBool for thread-safe management
- Added loopback testing cache (last_from, last_intent_name)
- Improved Arc-based state sharing for transport and handlers

Plugin Loader Unification (In Progress):
- Created plugin_loader_unified.rs skeleton
- Created plugin_ffi_common.rs for shared FFI utilities
- Migration plan documented (2400 lines → 1100 lines target)

MIR & VM Improvements:
- Enhanced modularized MIR builder structure
- Added BoxCall dispatch improvements
- Better separation in builder modules

Documentation Updates:
- Added Phase 9.79a unified box dispatch plan
- Created plugin loader migration plan
- Updated CURRENT_TASK.md with latest progress

All tests passing (180 tests) - ready for next phase of refactoring

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-26 19:13:57 +09:00
fffbac9aac feat: MIR TypeOp/WeakRef/Barrier PoC implementation
- Add TypeOpKind, WeakRefOp, BarrierOp enums for unified instructions
- Implement TypeOp instruction combining TypeCheck/Cast
- Implement WeakRef instruction combining WeakNew/WeakLoad
- Implement Barrier instruction combining BarrierRead/BarrierWrite
- Update VM to handle new unified instructions
- Update MIR printer for new instruction formats
- Add feature flags mir_typeop_poc and mir_refbarrier_unify_poc
- Maintain backward compatibility with legacy instructions

This is Phase 8.5 MIR instruction diet PoC implementation.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-23 19:27:02 +09:00
670615d1de feat: WASMビルド完全対応+finiシステム修正 🎉
## WASMビルド対応
- TimerBox、AudioBox等の問題のあるBoxをWASM環境では条件付きコンパイルで除外
- WebBox (WebDisplayBox, WebConsoleBox, WebCanvasBox) にas_anyメソッド追加
- プラグイン関連コードに#[cfg]ガードを追加
- web-sysフィーチャーを追加(Performance、MouseEvent等)
- projects/nyash-wasmのビルドが完全に通るように!

## finiシステム修正
- フィールド差し替え時の自動fini削除(Nyashの明示的哲学に従う)
- スコープ離脱時のみfini実行(meは除外)
- ドキュメント更新で正しいfiniルールを明記

## その他
- CLAUDE.mdにWASMビルド方法を追記(wasm-pack build --target web)
- 開発サーバー起動方法を記載(python3 -m http.server 8010)
- cargo testで全テスト成功を確認

これでNyashがブラウザで動作可能に!🐱

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-20 07:33:18 +09:00
83d3914e46 🚨 fix: フィールド差し替え時の危険な自動fini呼び出しを発見
現在の問題:
- me.field = newValue で古いfieldのfiniが自動で呼ばれる
- 共有参照を破壊する可能性(複数から参照されている場合)
- GC的な「おせっかい」でNyashの明示的哲学に反する

次の修正予定:
- フィールド差し替え:fini呼ばない(プログラマー責任)
- スコープ離脱時:fini呼ぶ(自然なリソース管理)
- Everything is Explicit の哲学を貫く

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-20 05:57:18 +09:00
5b6cf828af feat: Phase 9.78b完了 - UnifiedBoxRegistry統合とビルド最適化
🏭 **Phase 9.78b: 統合レジストリ実装完了**

**主要な変更:**
- execute_new()に統合レジストリを統合、レガシーmatch文への自動フォールバック
- 全importエラー解決(RuntimeError, モジュールパス修正)
- runner.rs起動時に統合レジストリ初期化
- 20+種類のビルトインBoxが統合ファクトリ経由で作成可能

**ビルド時間最適化:**
- wasmtime/wabt依存を"wasm-backend"フィーチャーでオプション化
- デフォルトビルド 4分 → 43秒の劇的高速化達成

**技術的達成:**
- 600+行match文 → 30行ファクトリパターンへの移行基盤完成
- プラグイン・ユーザー定義・ビルトインBox統一アーキテクチャ確立
- Everything is Box哲学の実装レベル体現

**次のステップ:**
Phase 9.78c: プラグインBox統合、Phase 9.78d: ユーザー定義Box統合

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-19 16:56:44 +09:00
5f6f946179 feat: 汎用プラグインBox生成システム実装とnyash.toml v2対応準備
- GenericPluginBoxを実装し、任意のプラグインBoxを動的に生成可能に
- FileBox決め打ちコードを削除(設計思想違反の解消)
- CURRENT_TASK.mdを更新し、nyash.toml v2対応の必要性を明確化
- 問題: プラグインテスターとNyash本体が古い単一Box型形式のまま

次のステップ:
1. nyash.tomlをv2形式(マルチBox型)に更新
2. プラグインテスターをv2対応に
3. Nyash本体のレジストリをv2対応に

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-19 03:48:44 +09:00
313ad2a46d Complete LLVM PoC mock implementation - demonstrates integration structure
Co-authored-by: moe-charm <217100418+moe-charm@users.noreply.github.com>
2025-08-18 09:25:57 +00:00
e74a9f621e Implement LLVM backend basic structure - Phase 9.78 Week 1 foundation
Co-authored-by: moe-charm <217100418+moe-charm@users.noreply.github.com>
2025-08-18 09:14:39 +00:00
0441608db3 BID-FFI integration:\n- Add plugin-tester io subcommand and TLV helpers; E2E open/write/read/close\n- Implement FileBox plugin invoke (birth/open/read/write/close) with BID-1 two-pass\n- Add BID loader/registry/plugin_box modules; prefer plugin-backed FileBox in interpreter\n- Introduce PluginFileBox with minimal read/write/close dispatch\n- Update runner debug paths; add local simple tests\n- Docs: plugin-tester guide and FileBox Nyash↔BID mapping; CURRENT_TASK updated 2025-08-18 11:07:03 +09:00
bec0e9bc92 revert: 古いプラグインシステム実装前の状態に巻き戻し
- ソースコードをcommit 3f7d71fの状態に復元(古いプラグインシステム実装前)
- docsフォルダは最新の状態を維持(BID-FFI設計ドキュメント含む)
- nyashバイナリの基本動作確認済み
- BID-FFIシステムをクリーンに再実装する準備完了

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-18 08:34:19 +09:00
3df87fb1ce fix(phase-4.3c-3): Fix StringBox literal handling in MIR builder
Phase 4-3c-3 Complete: WASM host functions now correctly output string content

## Changes:
- Fixed MIR builder to handle StringBox with string literal arguments
- Special case for  to generate proper string constants
- Removed debug output after successful verification
- WASM now correctly outputs "Hello MIR!" instead of "StringBox"

## Test Results:
- MIR generation:  Generates  correctly
- WASM compilation:  String data correctly placed at offset 4096
- WASM execution:  Outputs "Hello MIR\!" as expected

## Technical Details:
- Modified build_new_expression() to detect StringBox with literal arguments
- Generates Const instruction with actual string content
- Host function reads StringBox memory layout correctly

This completes the WASM string output functionality for Phase 4.

🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-17 13:49:35 +09:00
226618de05 feat(9.75f-1): Implement FileBox dynamic plugin foundation
- Add workspace configuration to support plugins
- Create nyash-file plugin with C ABI
- Implement nyash_file_open/read/write/exists/free functions
- Add libloading dependency with dynamic-file feature
- Successfully build libnyash_file.so (1.55s build time)

Next: Implement plugin loader in interpreter
2025-08-17 04:13:42 +09:00
cde961defc feat(phase-9.77): Implement BoxCall instructions and fix wasmtime version
Phase 9.77 WASM Emergency Recovery Progress:
-  Task 1.1: Implement BoxCall instruction for toString(), print(), equals(), clone(), log()
-  Task 1.2: Update wasmtime 18.0 → 35.0.0 and add runtime imports
- 🔄 Task 1.3: Working on UTF-8 encoding error fix

Changes:
- Add generate_box_call() method in codegen.rs with 5 helper methods
- Update wasmtime dependency to 35.0.0 for AOT compatibility
- Add BoxCall runtime imports (box_to_string, box_print, box_equals, box_clone)
- Implement wat_to_wasm() with UTF-8 validation and debug output
- Update CURRENT_TASK.md with Copilot handoff notes

Current issue: 'Generated WASM is not valid UTF-8' error source unknown
Next: Copilot to investigate error origin and complete Task 1.3

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-16 21:21:51 +09:00
8276eeeb64 Phase 8.1 Complete: WASM backend foundation implementation
Co-authored-by: moe-charm <217100418+moe-charm@users.noreply.github.com>
2025-08-13 13:05:49 +00:00
4c7f000cae Complete Phase 0: Clean duplicate targets and add build documentation
Co-authored-by: moe-charm <217100418+moe-charm@users.noreply.github.com>
2025-08-13 05:10:42 +00:00
079a095f5c Implement Phase 0: Stabilize CLI build with feature separation
Co-authored-by: moe-charm <217100418+moe-charm@users.noreply.github.com>
2025-08-13 05:06:43 +00:00
93cad22d31 Phase 1 Complete: FloatBox full implementation with operators and methods
Co-authored-by: moe-charm <217100418+moe-charm@users.noreply.github.com>
2025-08-11 19:35:25 +00:00
19cfe70df9 🔧 refactor: P2PBox複雑実装を削除し段階的実装方針に変更
- 複雑なP2PBox関連実装を削除:
  * Transport trait + MessageBus + MessageIntentBox + NewP2PBox
  * 依存関係が複雑で一度に追加すると失敗することを学習

- nyashバイナリのビルドを安定化:
  * 全てのimportエラーを修正
  * cargo build --bin nyash が正常に動作

- CURRENT_TASK.mdに新しい段階的実装方針を記載:
  * Phase 1: FloatBox (依存なし)
  * Phase 2: ArrayBox改良
  * Phase 3: 演算子システム改良

- 教訓: 一つずつ確実に実装し、テストファーストで進める

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-12 04:02:19 +09:00
3876b83e26 🚀 feat: NewP2PBox天才アルゴリズム完全実装 - P2P通信革命達成
## 🧠 天才アルゴリズム実装
- ローカル配送: MessageBus経由(爆速)
- リモート配送: Transport経由(柔軟)
- 完全自動判別・透明処理

## 📡 実装完了機能
1. NewP2PBox本体(天才アルゴリズム内蔵)
2. MessageBusシングルトン(高速ローカル配送)
3. Transport trait抽象化(InProcess/WebSocket/WebRTC)
4. MethodBox統合(Nyash側コールバック)
5. インタープリター完全統合

##  動作確認済み
- Rustクロージャ版: 全機能完璧動作
- MethodBox統合: コールバック正常動作
- インタープリター統合: Nyashから直接利用可能

## 🎯 利用可能Nyash構文
```nyash
alice = new NewP2PBox("alice", "InProcess")
msg = new MessageIntentBox("greeting")
msg.set("text", "Hello\!")
alice.send("bob", msg)
bob.onMethod("greeting", handler)
```

🎉 NyaMeshP2Pライブラリの基盤完成!次はP2PBoxデリゲート実装へ

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-11 17:51:16 +09:00
44049835d1 🐛 fix: コンパイルエラーを修正
主な修正内容:
- ArrayBox/RegexBox/JSONBoxで`push`メソッドの戻り値を適切に処理
- BufferBoxのインポートパスを修正(buffer::BufferBox)
- StreamBoxでArrayBoxを正しくインポート
- HTTPClientBoxをスタブ実装に変更(reqwest依存を一時的に無効化)

テストプログラムも追加:
- test_array_box_simple.nyash: ArrayBoxの基本テスト
- test_new_boxes.nyash: 全Box実装の統合テスト

NOTE: HTTPサポートは現在OpenSSL/pkg-config依存のため一時的に無効化。
将来的にはrustls等の純Rust実装への移行を検討。

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-10 13:18:21 +09:00
e6e36ccfb0 Implement NyashBox trait for core boxes - ArrayBox, BufferBox, FileBox, JSONBox, FutureBox, StreamBox, ResultBox
Co-authored-by: moe-charm <217100418+moe-charm@users.noreply.github.com>
2025-08-10 03:21:24 +00:00
e7f6666917 🎨 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
0bed0c0271 🎉 initial commit: Nyash Programming Language完成版
🚀 主要機能:
• Everything is Box哲学による革新的アーキテクチャ
• WebAssemblyブラウザー対応プレイグラウンド
• アーティスト協同制作デモ - 複数Boxインスタンス実証
• 視覚的デバッグシステム - DebugBox完全統合
• static box Mainパターン - メモリ安全設計

 言語機能:
• NOT/AND/OR/除算演算子完全実装
• ジェネリクス/テンプレートシステム
• 非同期処理(nowait/await)
• try/catchエラーハンドリング
• Canvas統合グラフィックス

🎨 ブラウザー体験:
• 9種類のインタラクティブデモ
• リアルタイムコード実行
• WebCanvas/WebConsole/WebDisplay
• モバイル対応完了

🤖 Built with Claude Code collaboration
Ready for public release!
2025-08-09 15:14:44 +09:00