Commit Graph

53 Commits

Author SHA1 Message Date
77d4fd72b3 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 2025-11-06 15:41:52 +09:00
40489a3c97 feat(debug): Add debug logging to console.log_handle for plugin investigation
- Added eprintln! debug messages to trace handle values
- Helps investigate why plugin return values display as blank
- Part of ongoing LLVM backend plugin return value investigation

Related to issue where print(c.get()) shows blank output

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-11 06:03:21 +09:00
1e735d7717 runner: split modes (mir/vm/llvm/bench) and extract plugin init; interpreter: split objects into ops/methods/fields; VM logs gated; Phi selection minimal fix; CURRENT_TASK updated; remove legacy backups 2025-08-26 04:34:14 +09:00
b8e416fb03 refactor: MIR builder modularization complete - ready for handoff
- MIRビルダーのモジュール化完了(1,547行→6モジュール)
  - core.rs (205行): MirBuilder本体
  - expressions.rs (621行): 式変換処理
  - statements.rs (165行): 文変換処理
  - control_flow.rs (194行): 制御フロー
  - box_handlers.rs (73行): Box処理
- 現在builder_modularizedに退避(MIR命令構造変更により調整必要)
- フルビルド可能な状態を維持
- CURRENT_TASK.mdに引き継ぎポイント記載

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-25 19:33:07 +09:00
63749b683e feat: Add VM statistics and fix compilation errors for plugin tests
- Add VM instruction statistics (--vm-stats, --vm-stats-json)
- Fix missing fields in ast.rs test code (public_fields, private_fields)
- Add CliConfig fields for VM statistics
- Enable TLV debug logging in plugin_loader_v2
- Successfully test FileBox handle passing and HTTP plugin creation

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-23 04:51:24 +09:00
69a07cbb1f fix: fini後のアクセスエラーを削除(ユーザー要求対応)
ユーザーからの明確な要求「finiは何回呼ばれてもエラーにならないしよう」に従い、
fini後のインスタンスアクセスを禁止するエラーチェックをすべて削除しました。

変更内容:
- interpreter/statements.rs: is_finalized()チェック削除(3箇所)
- interpreter/field_access.rs: is_finalized()チェック削除
- interpreter/expressions/calls.rs: is_finalized()チェック削除
- interpreter/expressions/access.rs: is_finalized()チェック削除

動作確認:
- test_fini_multiple_calls.nyash: finiを3回呼んでもエラーなし
- fini後のフィールドアクセスも正常動作
- CHIP-8エミュレータも正常動作

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-20 14:34:46 +09:00
8f82437c58 feat: Windows GUI development with egui - simple notepad example
- Fixed EguiBox Send+Sync trait bounds for thread safety
- Added missing Arc import for EguiBox implementation
- Simplified font setup in Windows notepad example
- Successfully built 4.5MB Windows GUI executable
- Nyash can now create native Windows desktop applications! 🎉
2025-08-20 08:03:36 +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
9eb52982b5 fix: Phase 9.78e+: Fix birth constructor and builtin Box method inheritance
🌟 Major fixes:
- Fix birth constructor lookup (was searching for 'init/N', now 'birth/N')
- Fix builtin Box method inheritance via __builtin_content field
- Remove InstanceBox wrapping for builtin Boxes
- Update execute_builtin_birth_method to properly store builtin content
- Update method resolution to check __builtin_content for builtin methods

 All tests pass:
- Birth constructors work correctly
- User-to-user Box delegation works
- User-to-builtin Box delegation works (toString() properly inherited)
- Apps folder tested (chip8, kilo editor run successfully)

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-20 02:19:59 +09:00
164f1079ec 🏆 LEGENDARY: birth構文革命+デリゲーション完全勝利!
🌟 **birth構文完全修復** - Everything is Boxの究極実現
- objects.rs 2箇所の重要修正: init → birth統一完了
- 引数付きコンストラクタ完全動作: birth(args) 
- 統一レジストリとの完全連携: InstanceBox統合 
- テスト結果: 🌟 TestBox誕生完全成功!

🔄 **デリゲーション透過完全成功** - 美しい継承システム実現
- box Child from Parent: デリゲーション宣言 
- from Parent.birth(args): 親コンストラクタ透過呼び出し 
- override + from Parent.method(): 完璧な継承階層 
- テスト結果: 親子デリゲーション完全動作確認!

🎮 **実用アプリ動作確認完了**
- CHIP-8エミュレーター: パース成功+実行開始 
- Kiloテキストエディター: birth構文で初期化成功 
- Proxyサーバー: デリゲーション機能動作確認 

🎯 **Phase 9.78e PLUS達成**
- instance_v2移行 100% 完了
- birth構文革命 100% 完了
- デリゲーション透過 100% 完了
- Everything is Box哲学完全実現

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-20 00:58:35 +09:00
e5e381aa83 feat: Implement Phase 9.78e instance_v2 migration with unified registry
Major achievements:
-  UserDefinedBoxFactory implementation with unified registry integration
-  Constructor execution for user-defined boxes (Person init working)
-  Import path fixes across interpreter modules
-  unwrap_instance helper function for InstanceBox operator support

Technical details:
- Modified UnifiedBoxRegistry to handle empty box_types() factories
- Implemented constructor execution in execute_new for InstanceBox
- Added unwrap_instance helper to handle InstanceBox wrapping in operators
- Updated CURRENT_TASK.md with detailed progress tracking

Next: Fix 4 operator functions to complete InstanceBox operator support

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-20 00:21:20 +09:00
5582ad45c0 feat: Phase 9.78e complete - instance_v2 migration with legacy compatibility
- instance_v2 now includes legacy compatibility layer
- All interpreter code migrated to use instance_v2
- Added legacy field access methods (get_fields, set_field_legacy, etc.)
- Fixed type conversion issues (NyashValue vs SharedNyashBox)
- instance.rs still exists but no longer used in interpreter
- TODO: Remove instance.rs completely in next phase
- TODO: Implement proper SharedNyashBox -> NyashValue conversion

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-19 22:35:34 +09:00
03e4de6ad7 feat: Phase 9.78d完全達成 - InstanceBox統合 + type_name委譲実装成功
🎉 Phase 9.78d 主要マイルストーン達成!

主要成果:
 Rustスコープ問題完全解決 - use crate::instance_v2::InstanceBox;
 StringBox → InstanceBox統合完成 - BuiltinBoxFactory経由で成功
 type_name()委譲実装 - 内包Boxの型名を正しく返す修正完了
 基本機能完全動作 - 文字列作成・連結・基本操作すべて正常
 統一レジストリ確認 - 🏭 Unified registry created動作確認
 デバッグ情報改善 - type_name='StringBox'正確表示

技術的達成:
- InstanceBox::from_any_box()によるビルトインBox統合
- 内包Boxへの透過的type_name()委譲実装
- BuiltinBoxFactory経由での統一Box生成確立
- 全体Progress: 44% → 85%完了に大幅進展

次期課題:
⚠️ メソッド呼び出し統合 - str.type_name()等の動的ディスパッチ
🎯 Phase 9.78e - Gemini提案のcall_method設計実装予定

ファイル変更:
- src/instance_v2.rs: type_name()内包Box委譲実装
- src/box_factory/builtin.rs: InstanceBox統合実装
- docs/CURRENT_TASK.md: 進捗85%完了に更新
- local_tests/: Gemini設計相談ファイル追加

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-19 20:00:16 +09:00
5f1a50e4af feat: Phase 9.78d部分達成 - InstanceBox統合でBuiltinBox作成成功
🎯 Phase 9.78d: InstanceBox簡素化統一実装の主要マイルストーン達成

主要成果:
 Rustスコープ問題をシンプル解決 - `use crate::InstanceBox;`
 StringBox → InstanceBox統合完了 - BuiltinBoxFactory経由
 統一レジストリ経由での動的Box作成が動作
 基本機能テスト成功(文字列作成・連結)

技術詳細:
- BuiltinBoxFactory内でInstanceBox::from_any_box()による統合実装
- lib.rsのpub useを活用した最軽量import戦略
- 🏭 Unified registry created: StringBoxログで統合動作確認
- StringBox基本機能(連結演算子等)は正常動作

次の課題:
⚠️ メソッド呼び出し統合(str.type_name()等)は別途対応

ファイル変更:
- src/box_factory/builtin.rs: StringBoxのInstanceBox統合実装
- src/lib.rs: コメント整理
- docs/CURRENT_TASK.md: 進捗状況更新
- local_tests/: 統合動作テスト追加

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-19 19:48:35 +09:00
b0a1e69d05 feat: Phase 9.78bテスト完了 - UnifiedBoxRegistry実動検証成功
🏭 **統合ファクトリ完全動作確認**

**検証結果:**
-  ビルトインBox統合: StringBox, IntegerBox, BoolBox, ArrayBox, MathBox, ConsoleBox
-  統合レジストリ経由で全Box生成(レガシーmatch文回避)
-  デバッグ出力: "🏭 Unified registry created" 20+回確認

**技術的達成:**
- 600+行match文 → 30行統合レジストリ呼び出し移行成功
- ビルド時間最適化(4分→43秒)維持
- Everything is Box哲学の実装レベル体現

**残存タスク:**
-  ユーザー定義Box統合(Phase 9.78d)- InstanceBox連携必要
- ⚠️ プラグインBox統合(Phase 9.78c)- v2システム経由で部分対応済み

**次のステップ:** Phase 9.78d開始準備完了

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-19 17:01:10 +09:00
fbb94aea17 WIP: Phase 9.78b - Unified registry integration (import issues pending)
Progress made:
- Add unified registry call to objects.rs execute_new() method
- Initialize unified registry in runner.rs on startup
- Create global registry management in runtime/unified_registry.rs
- Add test case for unified registry validation
- Implement fallback to legacy match statement for compatibility

Current issue:
- Module import errors in runtime/unified_registry.rs preventing build
- Need to resolve box_factory module path visibility from runtime context

Next steps:
- Fix import paths for box_factory modules
- Test unified registry functionality
- Remove legacy match statement after validation

Technical details:
- execute_new() now tries unified registry first, falls back to legacy
- Registry initialized with BuiltinBoxFactory and PluginBoxFactory
- Maintains backward compatibility during transition

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-19 16:48:45 +09:00
519560b64b 🎉 FileBox v2 plugin system fully working with TLV encoding fix
Major achievements:
- Fixed TLV encoding format to match plugin expectations
  - Header: version(2 bytes) + argc(2 bytes)
  - Entry: tag(1) + reserved(1) + size(2) + data
- Removed duplicate implementation in method_dispatch.rs
- All FileBox methods working: open/read/write/close
- Successfully tested file I/O operations

This completes the v2 plugin system integration for FileBox.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-19 13:57:17 +09:00
4be49c794d 🎉 BREAKTHROUGH: FileBox v2 plugin system working - birth() error code -4
- Fixed segmentation fault issue (was actually birth() method error)
- Added comprehensive debug logging throughout the execution chain
- v2 plugin integration fully functional:
   Plugin loading and init() successful
   Type configuration resolution working (type_id: 6)
   FFI communication established
   birth() method called with correct parameters
   birth() returns error code -4 (needs investigation)

Key discoveries:
- plugin-tester shows birth() works in isolation
- v2 integration architecture is sound
- Issue is likely parameter/context mismatch in birth() call

Next: Investigate error code -4 meaning and parameter differences

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-19 10:37:33 +09:00
e8b1ccaeaf feat: Complete v2 plugin system migration with compilation fixes
🎉 Phase 9.75g-1: v2プラグインシステム移行完成

###  修正完了項目
- bid/mod.rs: 古いregistryモジュールの無効化
- generic_plugin_box.rs: registry依存の削除、簡易clone実装
- objects.rs: 古いBIDレジストリ呼び出しを無効化、v2システム用コメント追加
- main.rs, runner.rs: import修正(nyash_rust::cli::CliConfigへ)
- lib.rs: CLI モジュール export追加

### 🚀 達成事項
-  全コンパイルエラー修正完了
-  v2プラグインシステム正常起動確認
-  nyash.toml読み込み・設定統合成功
-  BoxFactoryRegistry + PluginLoaderV2連携実装
-  test_filebox_v2.nyash テストファイル追加

### 📊 実行結果
```
🔌 v2 plugin system initialized from nyash.toml
 v2 plugin system fully configured
📦 Registering plugin provider for FileBox
```

### 🔧 次のステップ (Phase 9.75g-2)
- BoxFactoryRegistry統合: new FileBox() → v2プラグインBox生成
- TLV通信実装: 実際のプラグインメソッド呼び出し

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-19 05:36:01 +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
cc8553380c feat: Add multi-box plugin support (v2) with test implementation
- Extend plugin-tester to support multi-box plugins with v2 API
- Add nyash_plugin_get_box_count/get_box_info/get_type_id functions
- Create test multi-box plugin providing TestBoxA and TestBoxB
- Update plugin-system.md documentation for v2 format
- Add nyash.toml v2 specification for multi-box support
- Successfully tested multi-box plugin lifecycle and type resolution

This enables one plugin to provide multiple Box types, solving the
dependency issue where HTTPServerBox needs SocketBox.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-19 01:13:48 +09:00
9a1e44e5c8 Merge branch 'main' of github.com-moecharm:moe-charm/nyash 2025-08-18 23:42:56 +09:00
840c1b85ef feat: Fix VM SSA loop execution with proper phi node handling
Fixed infinite loop issue in VM by addressing phi node caching problem.
The phi node was caching the initial value and returning it for all
subsequent iterations, preventing loop variable updates.

Changes:
- Created vm_phi.rs module to separate loop execution logic (similar to mir/loop_builder.rs)
- Disabled phi node caching to ensure correct value selection each iteration
- Added LoopExecutor to track block transitions and handle phi nodes properly
- Fixed VM to correctly track previous_block for phi input selection

The VM now correctly executes SSA-form loops with proper variable updates:
- Loop counter increments correctly
- Phi nodes select the right input based on control flow
- Test case now completes successfully (i=1,2,3,4)

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-18 23:36:40 +09:00
54f7d6eb63 WIP: Add Store instruction to MIR for variable assignments
- Added Store instruction generation in build_assignment()
- This partially addresses the VM infinite loop issue
- However, the loop still uses old values (%0) instead of updated values
- Need to implement proper SSA phi nodes for loop variables

The root cause: MIR generation doesn't properly track variable updates
in loops. Current SSA implementation lacks phi nodes.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-18 22:04:50 +09:00
901890521c Complete: Enhanced plugin migration guide v2 with comprehensive implementation details
Co-authored-by: moe-charm <217100418+moe-charm@users.noreply.github.com>
2025-08-18 12:40:26 +00:00
012fc1930f feat: Extract BID converter from Copilot and prepare plugin migration
- Extract Copilot's BID converter code to src/bid-converter-copilot/ for future use
- Create comprehensive plugin migration request document for Copilot
- Target 13 built-in boxes for plugin conversion (HTTP, GUI, Audio, etc.)
- Preserve existing nyash.toml-based plugin system
- Reorganize docs/説明書/reference/ structure for better organization
2025-08-18 20:53:48 +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
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
75868a5a96 feat(phase-9.75g-0): Implement BID-FFI Day 5 - FileBox plugin library and transparent switching (90% complete)
Day 5 achievements:
- Created independent FileBox plugin crate with C FFI exports
- Integrated plugin loading into Nyash interpreter startup
- Implemented transparent builtin/plugin Box switching via nyash.toml
- Successfully loaded plugin library (385KB .so) at runtime
- Confirmed PluginBox proxy creation for FileBox instances

Architecture changes:
- Added plugins/ directory with .gitignore for build artifacts
- Modified runner.rs to load plugins from nyash.toml on startup
- Updated objects.rs to use BoxFactoryRegistry for FileBox creation
- Fixed bid module visibility between lib.rs and main.rs

Remaining work (10%):
- Complete PluginBox proxy method implementations (toString, etc.)
- Test actual file operations through plugin interface
- Finalize error handling and edge cases

Build status: All tests passing, plugin loading confirmed
2025-08-18 00:33:01 +09:00
72b63546b0 feat(phase-9.75g-0): Add simple nyash.toml parser for plugin configuration
-  Simple TOML parser for [plugins] section
-  Maps Box names to plugin names (e.g., FileBox => filebox)
-  Handles comments and empty lines
-  Complete test coverage
- 🎯 Minimal implementation for transparent Box replacement!

Part of Day 4 FileBox plugin implementation (60% → 70%)

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-17 22:05:47 +09:00
a5ff3ecafe feat(phase-9.75g-0): Implement BID-FFI Day 3 - Box type integration
- Implement BID Box Bridge interface for Nyash Box <-> BID Handle conversion
- Add StringBox BID bridge implementation with handle/TLV support
- Add IntegerBox BID bridge implementation with handle/TLV support
- Implement BoxRegistry for managing Box instances and handles
- Add comprehensive tests for StringBox/IntegerBox BID round-trip
- Extract helper functions for string/integer value extraction

Everything is Box philosophy shines through unified BID integration! 🎉

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-17 19:54:57 +09:00
75d09a89a8 feat(phase-9.75g-0): Start BID-FFI type-first implementation strategy
- Create comprehensive type definitions for all future features
- Adopt FFI ABI v0 compliance with platform-aware pointers (usize)
- Implement 8-byte alignment for cross-platform compatibility
- Design single entry point: nyash_plugin_invoke
- Target Linux x86-64 for initial implementation
- Use unimplemented!() for gradual feature addition

Key decisions from AI review:
- Pointer width: platform-dependent (not fixed 32-bit)
- Early addition of Option/Result types
- Clear ownership rules for strings/arrays
- Extensible BoxHeader with magic number

Phase 9.75g-0: Build it simple, make it work, then extend!
2025-08-17 17:31:46 +09:00
3acd2f9566 feat(phase-5.5): Complete MIR 35→26 instruction reduction project! 🎉
Phase 5-5 Final Verification Complete:
- All deprecated instructions marked and backends updated
- Test files updated for new instruction format
- Documentation fully updated with MIR 26 specification
- RefNew still appears in some outputs (recorded as future task)
- Overall functionality confirmed working

Amazing achievement:
- Original estimate: 5 weeks
- Actual completion: 1 day (24 hours)
- 35 instructions reduced to 26 (25.7% reduction)
- All ChatGPT5 specifications implemented

Future work:
- Complete removal of RefNew from all code paths
- Investigate alternative MIR builders or special cases

This marks the successful completion of the MIR instruction reduction project!
2025-08-17 15:20:14 +09:00
b88918d347 feat(phase-5.5): Begin final verification and cleanup
- Phase 5-5 started with lib build successful (only deprecated warnings)
- Discovered issue: RefNew still being generated in MIR output
- Need to investigate where RefNew is still being produced

Progress: MIR 35→26 reduction 95% complete
2025-08-17 14:48:59 +09:00
7b56f45852 feat(phase-5.3): Complete frontend cleanup - stop generating deprecated instructions
Phase 5.3 of MIR 35→26 reduction project:
- Replace RefNew with NewBox in MIR builder
- Remove unnecessary Const generation for box types
- Process arguments properly for NewBox instruction
- StringBox special handling maintained with NewBox

Frontend now generates only 26-instruction set compliant MIR.
Build successful with expected deprecation warnings.
2025-08-17 14:11:51 +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
2b2dcc5647 feat(phase-9.75f-1): Complete FileBox dynamic library implementation
- Implement C ABI plugin system with workspace configuration
- Create FileBox plugin with full read/write/exists/toString support
- Fix critical memory management issues (double free) with Arc
- Add comprehensive test suite for dynamic FileBox functionality
- Achieve 98% build time improvement for plugin (2.87s vs 2-3min)
- Maintain full backward compatibility with feature flags

FileBox now loads dynamically, drastically reducing build times while
maintaining all functionality. Next: Math/Time dynamic migration.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-17 09:31:35 +09:00
bd20c91b67 feat(9.75f-1): Implement plugin loader and interpreter integration
- Add plugin_loader.rs with FileBoxProxy implementation
- Integrate dynamic FileBox into interpreter (execute_new, method calls)
- Add feature flag 'dynamic-file' support throughout
- Create test program test_dynamic_filebox.nyash
- Plugin builds in 2.86s (vs main build 2+ minutes\!)

Build time improvement confirmed:
- Plugin-only build: 2.86s 
- Main build: 2+ minutes (timeout)

Next: Complete testing once main build finishes
2025-08-17 04:23:09 +09:00
1493ad7e94 cleanup: Remove temporary file ExternCall test code
- Remove file static box from stdlib/mod.rs
- Remove file.read/write/exists ExternCall handling from MIR builder
- Delete test_file_ffi.nyash test file
- Clean build successful
2025-08-17 03:50:06 +09:00
d396c0ed8c feat(phase-9.75f): ビルトインBox動的ライブラリ分離アーキテクチャ設計
- Gemini先生のアドバイスに基づく実装計画策定
- C ABI + libloading による安定した動的ライブラリ実装
- 段階的移行戦略:インタープリターExternCall → プラグイン化
- FFI-ABI file実装(stdlib方式)完了
- MIRビルダーにfile.read/write/exists追加
- ビルド時間2分→15秒、バイナリ15MB→2MBを目標
- docs/予定/native-plan/issues/phase_9_75f_dynamic_library_architecture.md作成
- CURRENT_TASK.md更新

次のステップ:
- インタープリターでExternCall直接実行実装
- 元のFileBox実装を探して置き換え
- プラグインアーキテクチャ基盤構築
2025-08-17 03:40:00 +09:00
a8e77f6411 docs: WASM Canvas研究とFFI-ABI実装戦略の追加
- CURRENT_TASK.mdにWASM研究メモセクション追加
- MIR→WAT→WASM実行フローの確認
- Canvas実装の3つの選択肢を文書化
  - CanvasBox実装(推奨)
  - グローバルcanvasオブジェクト
  - 標準ライブラリ拡張
- FFI-ABI仕様に基づくFileBox実装戦略を検討
- 純粋FFI-ABI方式でのfile.read/write実装計画策定
2025-08-17 02:54:05 +09:00
95bbb50886 feat: Apply Copilot's WASM UTF-8 fix manually
- Change from compile_module() to compile_to_wat() to fix UTF-8 error
- WASM compilation now outputs WAT text format directly
- Successfully generates WAT file for simple test case
- Note: Debug build still has issues (separate bug)

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-17 00:03:49 +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
fa1a3ad644 feat(Phase 9.75j): Complete warning elimination - 106→0 warnings (100% improvement)
 Major code quality improvements:
• Fixed all unused variable and parameter warnings
• Added appropriate #[allow(dead_code)] annotations
• Renamed constants to follow Rust naming conventions
• Achieved completely warning-free codebase

🔧 Key changes:
• Parser expressions: Fixed arg_count and statement_count usage
• MIR modules: Added dead_code allows for future-use code
• Backend modules: Prefixed unused parameters with underscore
• Effect constants: Renamed 'read' to 'READ_ALIAS' for conventions

📊 Results:
• Before: 106 warnings (noisy build output)
• After: 0 warnings (clean build)
• Improvement: 100% warning reduction

🎯 This continues the bug fixing initiative "つづきのしゅうせいおねがいにゃ!"
from Phase 9.75i (birth() fixes, static methods, Copilot apps).

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-16 17:39:04 +09:00
ef7a0de3b0 feat: Prepare for code modularization and cleanup
- Archive old documentation and test files to `docs/archive/` and `local_tests/`.
- Remove various temporary and old files from the project root.
- Add `nekocode-rust` analysis tool and its output files (`nekocode/`, `.nekocode_sessions/`, `analysis.json`).
- Minor updates to `apps/chip8_nyash/chip8_emulator.nyash` and `local_tests` files.

This commit cleans up the repository and sets the stage for further code modularization efforts, particularly in the `src/interpreter` and `src/parser` modules, based on recent analysis.
2025-08-16 01:30:39 +09:00
42379a3694 docs: update Phase 7 planning and add correct Nyash philosophy test files
- Update CLAUDE.md with 32-thread build option
- Enhance phase7_async_mir.md with detailed implementation plan
- Add Obj class definition to phase6_ref_set_get.nyash
- Create phase6_ref_set_get_correct.nyash following Everything is Box philosophy
2025-08-13 21:06:37 +09:00
c5e784ca38 test(local): add Phase 6 VM sample (ref set/get) for acceptance run 2025-08-13 19:33:34 +09:00
621bf7cc3d docs: reorganize into 説明書/予定/archive; update docs/README.md and CLAUDE.md; move root .nyash to local_tests; consolidate native-plan notes into README + archive 2025-08-13 18:54:02 +09:00
cd0039e083 Implement Phase 5.2: Static box Main lowering for MIR compilation
Co-authored-by: moe-charm <217100418+moe-charm@users.noreply.github.com>
2025-08-13 07:54:56 +00:00
3082c77ecd Implement Phase 5.2: static box Main lowering to MIR
Co-authored-by: moe-charm <217100418+moe-charm@users.noreply.github.com>
2025-08-13 07:53:14 +00:00