Moe Charm 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

🐱 Nyash Programming Language

Next-Generation Browser-Native Programming Experience

🇯🇵 日本語版はこちら / Japanese Version

Build Status Everything is Box WebAssembly Try Now MIT License


🚀 Try Nyash Right Now!

No installation, no setup - just open and code!

👉 🎮 Launch Nyash Browser Playground 👈

Experience features like:

  • 🎨 Artist Collaboration Demo - Multiple Box instances working together
  • Async Computing - Parallel processing made simple
  • 🎮 Canvas Game Graphics - Direct browser graphics programming
  • 🔍 Live Debug Visualization - See your program's memory in real-time

Why Nyash Changes Everything

🎯 Memory Safety Revolution

// Traditional languages: manual memory management, crashes, security issues
// Nyash: Everything is Box - automatic, safe, elegant

static box Main {
    init { player, enemies, canvas }
    
    main() {
        me.player = new PlayerBox("Hero", 100)
        me.canvas = new WebCanvasBox("game", 800, 600)
        
        // Memory automatically managed - no crashes, no leaks!
        me.player.render(me.canvas)
        return "Game running safely!"
    }
}

🌐 Browser-First Design

  • Zero Installation: Runs directly in web browsers via WebAssembly
  • Web APIs Built-in: Canvas, DOM, storage - all native language features
  • Real-time Collaboration: Share code instantly, run anywhere
  • Mobile Ready: Works on phones, tablets, any modern device

🎨 Creative Programming Made Easy

// Create art with code - naturally!
box Artist {
    init { name, color }
    
    paintMasterpiece(canvas) {
        canvas.fillCircle(100, 100, 50, me.color)
        canvas.fillText("Art by " + me.name, 10, 200, "24px Arial", me.color)
    }
}

// Multiple artists collaborate
picasso = new Artist("Picasso", "red")
monet = new Artist("Monet", "blue")
// Each Box maintains its own state and behavior!

Async Simplicity

// Parallel processing without complexity
nowait future1 = heavyComputation(10000)
nowait future2 = renderGraphics()

// Do other work while they run...
setupUI()

// Get results when ready
result1 = await future1
result2 = await future2

🏗️ Revolutionary Architecture

Everything is Box Philosophy

Every value in Nyash is a Box - a unified, memory-safe container:

Traditional Languages Nyash
int x = 42; x = new IntegerBox(42)
string name = "Hello"; name = new StringBox("Hello")
Complex canvas setup canvas = new WebCanvasBox("game", 800, 600)
Manual memory management Automatic Box lifecycle management

Static Box Main Pattern

// Clean, predictable program structure
static box Main {
    init { database, ui, gameState }  // Declare all fields upfront
    
    main() {
        // Initialize in logical order
        me.database = new DatabaseBox("save.db")
        me.ui = new UIManagerBox()
        me.gameState = new GameStateBox()
        
        // Your program logic here
        return runGameLoop()
    }
}

Visual Debug Integration

debug = new DebugBox()
debug.startTracking()

player = new PlayerBox("Hero")
debug.trackBox(player, "Main Character")

// Real-time memory visualization in browser!
print(debug.memoryReport())  // Live stats, no debugging hell

🎮 Perfect for Creative Coding

Game Development

  • Built-in Canvas API: Graphics without external libraries
  • Input Handling: Mouse, keyboard, touch - all native
  • Audio Support: SoundBox for music and effects
  • Physics Ready: Mathematical operations optimized

Educational Programming

  • Visual Feedback: See your code's effects immediately
  • Memory Visualization: Understand how programs work
  • No Setup Barriers: Students code instantly in browser
  • Progressive Learning: From simple scripts to complex applications

Web Applications

  • Direct DOM Control: WebDisplayBox manipulates HTML
  • No Framework Needed: Language handles web interaction natively
  • Real-time Updates: Changes reflect immediately
  • Cross-Platform: Same code, everywhere

📖 Language Highlights

Clean, Expressive Syntax

// Object-oriented programming made natural
box Player {
    init { name, health, inventory }
    
    Player(playerName) {
        me.name = playerName
        me.health = 100
        me.inventory = new ArrayBox()
    }
    
    takeDamage(amount) {
        me.health = me.health - amount
        if me.health <= 0 {
            me.respawn()
        }
    }
    
    respawn() {
        me.health = 100
        print(me.name + " respawned!")
    }
}

Powerful Operators

// Natural language operators for clarity
isAlive = health > 0 and not poisoned
canCast = mana >= spellCost or hasItem("Magic Ring")
gameOver = playerDead or timeUp

// Mathematical operations built-in
distance = sqrt((x2 - x1)^2 + (y2 - y1)^2)
angle = atan2(deltaY, deltaX)

Generic Programming

// Type-safe generic containers
box Container<T> {
    init { value }
    
    Container(item) { me.value = item }
    getValue() { return me.value }
}

numbers = new Container<IntegerBox>(42)
texts = new Container<StringBox>("Hello")

🛠️ Getting Started

# 1. Clone repository
git clone https://github.com/moe-charm/nyash.git
cd nyash

# 2. Build WebAssembly version
cd projects/nyash-wasm
./build.sh

# 3. Open playground in browser
# Open nyash_playground.html in any modern browser

Native Development

Linux/WSL

# Build native version
cargo build --release

# Run programs locally
./target/release/nyash program.nyash

# Try examples
./target/release/nyash test_async_demo.nyash
./target/release/nyash app_dice_rpg.nyash

🪟 Windows (Cross-compile)

# Install cross-compiler
cargo install cargo-xwin

# Build Windows executable
cargo xwin build --target x86_64-pc-windows-msvc --release

# Generated executable (916KB)
target/x86_64-pc-windows-msvc/release/nyash.exe

🤝 Contributing

Nyash is open source and welcomes contributions!

  • Issues: Report bugs, request features
  • Pull Requests: Code improvements, new examples
  • Documentation: Help improve guides and examples
  • Community: Share your Nyash creations!

📄 License

MIT License - Free for personal and commercial use.


👨‍💻 Creator

Moe Charm - Programming Language Designer & Developer

Creating innovative programming languages with AI assistance and dedication 🤖


🤖 Support the Project

Nyash is developed with cutting-edge AI collaboration!

If you enjoy Nyash and want to support continued development:

Support Development - Help fuel innovation!

Powered by Claude Code - Advanced AI development tools aren't free! 🤖

Your support helps maintain the project, develop new features, and continue pushing the boundaries of programming language design. Every contribution makes a difference! 🙏


Built with ❤️, 🤖 Claude Code, and the Everything is Box philosophy

Nyash - Where every value is a Box, and every Box tells a story.

Description
No description provided
Readme 1.2 GiB
Languages
Rust 73.6%
Shell 13.5%
C 6.5%
Python 4%
HTML 1%
Other 1.4%