180 lines
5.6 KiB
Markdown
180 lines
5.6 KiB
Markdown
|
|
# 🐱 Nyash Programming Language
|
||
|
|
|
||
|
|
**Everything is Box** - Revolutionary Programming Language
|
||
|
|
|
||
|
|
[](#)
|
||
|
|
[](#philosophy)
|
||
|
|
[](#webassembly)
|
||
|
|
[](#license)
|
||
|
|
|
||
|
|
## ✨ Key Features
|
||
|
|
|
||
|
|
- **Everything is Box Philosophy**: Every value is a unified Box object
|
||
|
|
- **WebAssembly Ready**: Run natively in browsers with zero setup
|
||
|
|
- **Web Integration**: Control HTML5 Canvas, DOM elements directly from code
|
||
|
|
- **Self-Hosting**: Written in itself using revolutionary Box architecture
|
||
|
|
- **Modern Syntax**: Clean, expressive syntax with powerful abstractions
|
||
|
|
|
||
|
|
## 🚀 Quick Start
|
||
|
|
|
||
|
|
### Try in Browser (No Installation Required!)
|
||
|
|
|
||
|
|
Open [Nyash Playground](projects/nyash-wasm/nyash_playground.html) in your browser and start coding immediately!
|
||
|
|
|
||
|
|
### Local Development
|
||
|
|
|
||
|
|
```bash
|
||
|
|
# Clone the repository
|
||
|
|
git clone https://github.com/user/nyash.git
|
||
|
|
cd nyash
|
||
|
|
|
||
|
|
# Build with Cargo
|
||
|
|
cargo build --release
|
||
|
|
|
||
|
|
# Run your first program
|
||
|
|
./target/release/nyash examples/hello_world.nyash
|
||
|
|
```
|
||
|
|
|
||
|
|
## 💡 Philosophy: Everything is Box
|
||
|
|
|
||
|
|
Nyash revolutionizes programming by treating **everything** as a Box:
|
||
|
|
|
||
|
|
```nyash
|
||
|
|
// Traditional languages: different types, complex syntax
|
||
|
|
// Nyash: unified Box approach
|
||
|
|
|
||
|
|
greeting = new StringBox("Hello!") // Text is a Box
|
||
|
|
number = new IntegerBox(42) // Numbers are Boxes
|
||
|
|
display = new WebDisplayBox("output") // Even web elements are Boxes!
|
||
|
|
|
||
|
|
// Everything works the same way
|
||
|
|
display.print(greeting.toString())
|
||
|
|
display.print("The answer is: " + number)
|
||
|
|
```
|
||
|
|
|
||
|
|
## 🎮 Examples
|
||
|
|
|
||
|
|
### Hello World
|
||
|
|
```nyash
|
||
|
|
print("🐱 Hello, Nyash World!")
|
||
|
|
greeting = new StringBox("Welcome to Everything is Box!")
|
||
|
|
print(greeting.toString())
|
||
|
|
```
|
||
|
|
|
||
|
|
### Web Canvas Graphics
|
||
|
|
```nyash
|
||
|
|
canvas = new WebCanvasBox("my-canvas", 400, 300)
|
||
|
|
canvas.setFillStyle("red")
|
||
|
|
canvas.fillRect(50, 50, 100, 75)
|
||
|
|
canvas.fillText("Nyash WebCanvas", 150, 200)
|
||
|
|
```
|
||
|
|
|
||
|
|
### Game of Life (Conway)
|
||
|
|
```nyash
|
||
|
|
game = new GameOfLifeBox(50, 30)
|
||
|
|
game.randomize()
|
||
|
|
loop (game.generation < 100) {
|
||
|
|
game.step()
|
||
|
|
game.display()
|
||
|
|
}
|
||
|
|
```
|
||
|
|
|
||
|
|
## 📚 Documentation
|
||
|
|
|
||
|
|
- **[Getting Started](docs/GETTING_STARTED_2025.md)** - Your first steps with Nyash
|
||
|
|
- **[Language Guide](docs/LANGUAGE_OVERVIEW_2025.md)** - Complete language reference
|
||
|
|
- **[Technical Architecture](docs/TECHNICAL_ARCHITECTURE_2025.md)** - Deep dive into Box philosophy
|
||
|
|
- **[Philosophy](PHILOSOPHY.md)** - Everything is Box explained
|
||
|
|
|
||
|
|
## 🌐 Web Integration
|
||
|
|
|
||
|
|
Nyash provides seamless browser integration:
|
||
|
|
|
||
|
|
```nyash
|
||
|
|
// Control web page elements directly
|
||
|
|
display = new WebDisplayBox("output")
|
||
|
|
display.setHTML("<h1>Generated by Nyash!</h1>")
|
||
|
|
|
||
|
|
// Draw on HTML5 Canvas
|
||
|
|
canvas = new WebCanvasBox("graphics", 800, 600)
|
||
|
|
canvas.drawScene()
|
||
|
|
|
||
|
|
// Interactive web apps in pure Nyash
|
||
|
|
button = new WebButtonBox("click-me")
|
||
|
|
button.onClick = new MethodBox(app, "handleClick")
|
||
|
|
```
|
||
|
|
|
||
|
|
## 🎯 Sample Projects
|
||
|
|
|
||
|
|
Explore our curated examples:
|
||
|
|
|
||
|
|
- **[Hello World](examples/hello_world.nyash)** - Basic syntax and philosophy
|
||
|
|
- **[Simple Calculator](examples/simple_calculator.nyash)** - Math operations with Boxes
|
||
|
|
- **[Conway's Game of Life](examples/game_of_life.nyash)** - Complex algorithms made simple
|
||
|
|
- **[2048 Game](examples/simple_2048.nyash)** - Complete game implementation
|
||
|
|
- **[Dice RPG](examples/app_dice_rpg.nyash)** - Turn-based battle system
|
||
|
|
- **[Maze Generator](examples/maze_generator.nyash)** - Procedural generation
|
||
|
|
- **[Web Canvas Demo](examples/web_canvas_demo.nyash)** - HTML5 Canvas control
|
||
|
|
- **[Web Display Demo](examples/web_display_demo.nyash)** - DOM manipulation
|
||
|
|
- **[Text Adventure](examples/text_adventure/)** - Multi-file project structure
|
||
|
|
- **[Lisp Interpreter](examples/lisp/)** - Meta-programming capabilities
|
||
|
|
|
||
|
|
## ⚡ Performance & Architecture
|
||
|
|
|
||
|
|
- **Rust Backend**: High-performance native execution
|
||
|
|
- **WebAssembly Target**: Zero-overhead browser deployment
|
||
|
|
- **Box Unification**: Simplified memory model, optimized for speed
|
||
|
|
- **Self-Hosting**: Bootstrap compiler written in Nyash itself
|
||
|
|
|
||
|
|
## 🛠 Building from Source
|
||
|
|
|
||
|
|
### Prerequisites
|
||
|
|
- Rust 1.70+
|
||
|
|
- wasm-pack (for WebAssembly builds)
|
||
|
|
|
||
|
|
### Commands
|
||
|
|
```bash
|
||
|
|
# Native build
|
||
|
|
cargo build --release
|
||
|
|
|
||
|
|
# WebAssembly build
|
||
|
|
wasm-pack build --target web --out-dir projects/nyash-wasm/pkg
|
||
|
|
|
||
|
|
# Run tests
|
||
|
|
cargo test
|
||
|
|
|
||
|
|
# Generate documentation
|
||
|
|
cargo doc --open
|
||
|
|
```
|
||
|
|
|
||
|
|
## 🤝 Contributing
|
||
|
|
|
||
|
|
We welcome contributions! Here's how to get started:
|
||
|
|
|
||
|
|
1. **Fork** the repository
|
||
|
|
2. **Create** a feature branch (`git checkout -b feature/amazing-feature`)
|
||
|
|
3. **Add** your changes and tests
|
||
|
|
4. **Ensure** all tests pass (`cargo test`)
|
||
|
|
5. **Commit** your changes (`git commit -m 'Add amazing feature'`)
|
||
|
|
6. **Push** to your branch (`git push origin feature/amazing-feature`)
|
||
|
|
7. **Open** a Pull Request
|
||
|
|
|
||
|
|
See our [Contributing Guidelines](CONTRIBUTING.md) for detailed information.
|
||
|
|
|
||
|
|
## 📄 License
|
||
|
|
|
||
|
|
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
||
|
|
|
||
|
|
## 🌟 Why Nyash?
|
||
|
|
|
||
|
|
- **Unified Philosophy**: No more juggling different types and paradigms
|
||
|
|
- **Web-First**: Built for the modern web development ecosystem
|
||
|
|
- **Self-Documenting**: Everything is Box makes code naturally readable
|
||
|
|
- **Performance**: Rust backend ensures native-level speed
|
||
|
|
- **Innovation**: Revolutionary approach to programming language design
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
**Everything is Box. Everything is Simple. Everything is Nyash.** 🐱
|
||
|
|
|
||
|
|
[Website](https://nyash-lang.org) • [Documentation](docs/) • [Examples](examples/) • [Community](https://discord.gg/nyash)
|