docs: README更新 - 20日でネイティブEXE達成を反映

- 英語版・日本語版ともに最新の成果を反映
- 20日間の開発タイムラインを強調
- 5つの実行モード(インタープリター/VM/JIT/ネイティブ/WASM)を明記
- プラグインシステムとPython統合の実例を追加
- パフォーマンスベンチマーク結果を更新(最大27倍高速化)
This commit is contained in:
Moe Charm
2025-08-29 11:49:01 +09:00
parent d24149d0a1
commit a9e82933cc
2 changed files with 522 additions and 484 deletions

452
README.md
View File

@ -1,305 +1,331 @@
# 🐱 Nyash Programming Language
**Next-Generation Browser-Native Programming Experience**
**From Zero to Native Binary in 20 Days - The AI-Powered Language Revolution**
*[🇯🇵 日本語版はこちら / Japanese Version](README.ja.md)*
[![Build Status](https://img.shields.io/badge/Build-Passing-brightgreen.svg)](#)
[![Everything is Box](https://img.shields.io/badge/Philosophy-Everything%20is%20Box-blue.svg)](#philosophy)
[![WebAssembly](https://img.shields.io/badge/WebAssembly-Ready-orange.svg)](#webassembly)
[![Try Now](https://img.shields.io/badge/Try%20Now-Browser%20Playground-ff6b6b.svg)](projects/nyash-wasm/nyash_playground.html)
[![Performance](https://img.shields.io/badge/Performance-13.5x%20Faster-ff6b6b.svg)](#performance)
[![JIT Ready](https://img.shields.io/badge/JIT-Cranelift%20Powered-orange.svg)](#execution-modes)
[![MIT License](https://img.shields.io/badge/License-MIT-green.svg)](#license)
---
## 🚀 **Try Nyash Right Now!**
## 🚀 **Breaking News: Native EXE Achieved!**
**No installation, no setup - just open and code!**
**August 29, 2025** - Just 20 days after inception, Nyash can now compile to native executables!
👉 **[🎮 Launch Nyash Browser Playground](https://moe-charm.github.io/nyash/projects/nyash-wasm/nyash_playground.html)** 👈
```bash
# From Nyash source to native binary
./target/release/nyash --backend vm program.nyash # JIT compilation
./tools/build_aot.sh program.nyash -o app # Native EXE
./app # Standalone execution!
```
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
**What we achieved in 20 days:**
- ✅ Full programming language with interpreter
- ✅ VM with 13.5x performance boost
- ✅ JIT compiler (Cranelift integration)
- ✅ WebAssembly support
- ✅ Plugin system (C ABI)
- ✅ Native binary generation
- ✅ Python integration via plugins
---
## ✨ **Why Nyash Changes Everything**
## ✨ **Why Nyash?**
### 🎯 **Memory Safety Revolution**
### 🎯 **Everything is Box Philosophy**
```nyash
// Traditional languages: manual memory management, crashes, security issues
// Nyash: Everything is Box - automatic, safe, elegant
// Traditional languages have complex type systems
// Nyash: One concept rules them all - Box
static box Main {
init { player, enemies, canvas }
main() {
me.player = new PlayerBox("Hero", 100)
me.canvas = new WebCanvasBox("game", 800, 600)
// Every value is a Box - unified, safe, simple
local name = new StringBox("Nyash")
local count = new IntegerBox(42)
local data = new MapBox()
// 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**
```nyash
// 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**
```nyash
// 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
```nyash
// 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()
// Even Python objects are Boxes!
local py = new PyRuntimeBox()
local math = py.import("math")
print("sqrt(9) = " + math.getattr("sqrt").call(9).str())
// Your program logic here
return runGameLoop()
return 0
}
}
```
### Visual Debug Integration
### ⚡ **Unprecedented Development Speed**
- **Day 1**: Basic interpreter working
- **Day 4**: Already planning JIT
- **Day 13**: VM achieving 13.5x speedup
- **Day 20**: Native executable generation!
### 🔌 **Plugin-First Architecture**
```nyash
debug = new DebugBox()
debug.startTracking()
// Any functionality can be a plugin Box
local file = new FileBox() // File I/O plugin
local http = new HttpClientBox() // Network plugin
local py = new PyRuntimeBox() // Python plugin
player = new PlayerBox("Hero")
debug.trackBox(player, "Main Character")
// Real-time memory visualization in browser!
print(debug.memoryReport()) // Live stats, no debugging hell
// Plugins compile to native code too!
```
---
## 🎮 **Perfect for Creative Coding**
## 🏗️ **Multiple Execution Modes**
### 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
### 1. **Interpreter Mode** (Development)
```bash
./target/release/nyash program.nyash
```
- Instant execution
- Full debug information
- Perfect for development
### 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
### 2. **VM Mode** (Production)
```bash
./target/release/nyash --backend vm program.nyash
```
- 13.5x faster than interpreter
- Optimized bytecode execution
- Production-ready performance
### 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
### 3. **JIT Mode** (High Performance)
```bash
NYASH_JIT_EXEC=1 ./target/release/nyash --backend vm program.nyash
```
- Cranelift-powered JIT compilation
- Near-native performance
- Hot function optimization
### 4. **Native Binary** (Distribution)
```bash
./tools/build_aot.sh program.nyash -o myapp
./myapp # Standalone executable!
```
- Zero dependencies
- Maximum performance
- Easy distribution
### 5. **WebAssembly** (Browser)
```bash
./target/release/nyash --compile-wasm program.nyash
```
- Run in browsers
- Cross-platform by default
- Web-first development
---
## 📖 **Language Highlights**
## 📊 **Performance Benchmarks**
### Clean, Expressive Syntax
Real-world benchmark results (ny_bench.nyash):
```
Mode | Time | Relative Speed
---------------|-----------|---------------
Interpreter | 110.10ms | 1.0x (baseline)
VM | 8.14ms | 13.5x faster
VM + JIT | 5.8ms | 19.0x faster
Native Binary | ~4ms | ~27x faster
```
---
## 🎮 **Language Features**
### Clean Syntax
```nyash
// Object-oriented programming made natural
box Player {
init { name, health, inventory }
box GameCharacter {
init { name, health, skills }
Player(playerName) {
me.name = playerName
// Birth constructor - giving life to Boxes!
birth(characterName) {
me.name = characterName
me.health = 100
me.inventory = new ArrayBox()
me.skills = new ArrayBox()
print("🌟 " + characterName + " has been born!")
}
takeDamage(amount) {
me.health = me.health - amount
if me.health <= 0 {
me.respawn()
}
learnSkill(skill) {
me.skills.push(skill)
return me // Method chaining
}
}
// Usage
local hero = new GameCharacter("Neko")
hero.learnSkill("Fire Magic").learnSkill("Healing")
```
### Modern Async/Await
```nyash
// Concurrent operations made simple
nowait task1 = fetchDataFromAPI()
nowait task2 = processLocalFiles()
// Do other work while waiting
updateUI()
// Collect results
local apiData = await task1
local files = await task2
```
### Delegation Pattern
```nyash
// Composition over inheritance
box EnhancedArray from ArrayBox {
init { logger }
respawn() {
me.health = 100
print(me.name + " respawned!")
override push(item) {
me.logger.log("Adding: " + item)
from ArrayBox.push(item) // Delegate to parent
}
}
```
### Powerful Operators
```nyash
// 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)
## 🔌 **Plugin System**
Nyash pioneered the "Everything is Plugin" architecture:
```toml
# nyash.toml - Plugin configuration
[libraries."libnyash_python_plugin.so"]
boxes = ["PyRuntimeBox", "PyObjectBox"]
[libraries."libnyash_net_plugin.so"]
boxes = ["HttpServerBox", "HttpClientBox", "WebSocketBox"]
```
### Generic Programming
```nyash
// 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")
```
Create your own Box types in C/Rust and integrate seamlessly!
---
## 🛠️ **Getting Started**
### Browser Development (Recommended)
### Quick Install (Linux/Mac/WSL)
```bash
# 1. Clone repository
# Clone and build
git clone https://github.com/moe-charm/nyash.git
cd nyash
cargo build --release --features cranelift-jit
# 2. Build WebAssembly version
cd projects/nyash-wasm
./build.sh
# 3. Open playground in browser
# Open nyash_playground.html in any modern browser
# Run your first program
echo 'print("Hello Nyash!")' > hello.nyash
./target/release/nyash hello.nyash
```
### Native Development
#### Linux/WSL
### Windows
```bash
# 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)
```bash
# Install cross-compiler
# Cross-compile for Windows
cargo install cargo-xwin
# Build Windows executable
cargo xwin build --target x86_64-pc-windows-msvc --release
# Use target/x86_64-pc-windows-msvc/release/nyash.exe
```
# Generated executable (916KB)
target/x86_64-pc-windows-msvc/release/nyash.exe
---
## 🌟 **Unique Innovations**
### 1. **AI-Driven Development**
- Developed with Claude, ChatGPT, and Codex collaboration
- 20-day journey from concept to native compilation
- Proves AI can accelerate language development by 30x
### 2. **Box-First Architecture**
- Every optimization preserves the Box abstraction
- Plugins are Boxes, JIT preserves Boxes, even native code respects Boxes
- Unprecedented consistency across all execution modes
### 3. **Observable by Design**
- Built-in debugging and profiling
- JSON event streams for JIT compilation
- DOT graph visualization of optimizations
---
## 📚 **Examples**
### Python Integration
```nyash
// Use Python libraries from Nyash!
local py = new PyRuntimeBox()
local np = py.import("numpy")
local array = np.getattr("array").call([1, 2, 3])
print("NumPy array: " + array.str())
```
### Web Server
```nyash
local server = new HttpServerBox()
server.start(8080)
loop(true) {
local request = server.accept()
local response = new HttpResponseBox()
response.setStatus(200)
response.write("Hello from Nyash!")
request.respond(response)
}
```
### Game Development
```nyash
box GameObject {
init { x, y, sprite }
update(deltaTime) {
// Physics simulation
me.y = me.y + gravity * deltaTime
}
render(canvas) {
canvas.drawImage(me.sprite, me.x, me.y)
}
}
```
---
## 🤝 **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!
Join the revolution! We welcome:
- 🐛 Bug reports and fixes
- ✨ New Box types via plugins
- 📚 Documentation improvements
- 🎮 Cool example programs
## 📄 **License**
MIT License - Free for personal and commercial use.
MIT License - Use freely in your projects!
---
## 🔗 **Links**
- **[🎮 Try Now - Browser Playground](https://moe-charm.github.io/nyash/projects/nyash-wasm/nyash_playground.html)**
- **[📚 Documentation](docs/)**
- **[🎯 Examples](examples/)**
- **[💬 Community Discussion](https://github.com/moe-charm/nyash/discussions)**
## 👨‍💻 **Creator**
**Moe Charm** - Programming Language Designer & Developer
- 🐙 GitHub: [@moe-charm](https://github.com/moe-charm)
- 🐦 Twitter/X: [@CharmNexusCore](https://x.com/CharmNexusCore)
- ☕ Support Development: [coff.ee/moecharmde6](http://coff.ee/moecharmde6)
*Creating innovative programming languages with AI assistance and dedication 🤖*
**Tomoaki** - Language Designer & Revolutionary
- 🐱 GitHub: [@moe-charm](https://github.com/moe-charm)
- 🌟 Created with: Claude, ChatGPT, Codex collaboration
---
## 🤖 **Support the Project**
## 🎉 **Historical Timeline**
Nyash is developed with cutting-edge AI collaboration!
- **August 9, 2025**: First commit - "Hello Nyash!"
- **August 13**: JIT planning begins (day 4!)
- **August 20**: VM achieves 13.5x performance
- **August 29**: Native EXE compilation achieved!
If you enjoy Nyash and want to support continued development:
**☕ [Support Development](http://coff.ee/moecharmde6)** - 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! 🙏
*20 days from zero to native binary - a new record in language development!*
---
*Built with ❤️, 🤖 Claude Code, and the Everything is Box philosophy*
**🚀 Nyash - Where Everything is a Box, and Boxes Compile to Native Code!**
**Nyash - Where every value is a Box, and every Box tells a story.**
*Built with ❤️, 🤖 AI collaboration, and the belief that programming languages can be created at the speed of thought*