Introduction
Project Links: GitHub · Online Playground · Issue Tracker
MaìLang is a modern programming language designed for IoT and cross-platform development, written in Rust. It combines the best features of multiple languages to provide a simple, efficient, and safe programming experience.
Key Features
| Feature | Description | Status |
|---|---|---|
| OOP | Classes, inheritance, constructors, super() / super.method() | ✅ Implemented |
| Traits | implements, default methods, trait extends | ✅ Implemented |
| Closures | Upvalue capture, first-class functions | ✅ Implemented |
| Pattern Matching | Literals, ranges, or-patterns, guards, array/tuple destructure, postfix expr match { } | ✅ Implemented |
| Error Handling | Result/Option + ? propagation | ✅ Implemented |
| Default Params / Destructuring | fn f(a, b = 10); let (x, y) = … | ✅ Implemented |
| Generics | Generic-function monomorphization (turbofish); field-erased generic classes | ✅ Implemented |
| UTF-8 Native | Identifiers support any Unicode script | ✅ Implemented |
| Bytecode VM | Stack bytecode with slot locals, or lowered to three-address register IR | ✅ Implemented |
| Default backend (since M5) | Register VM; --vm=stack / MAILANG_VM=stack selects the stack VM | ✅ Implemented |
| GC | Rc + collect_cycles() + mark-sweep heap | ✅ Implemented |
| Package Registry | Filesystem / static HTTP: publish/install/search/yank | ✅ Implemented |
| C FFI | 12-language binding support | ✅ Implemented |
| WebAssembly | Browser/edge runtime | ✅ Implemented |
| CLI + REPL | Command-line tool | ✅ Implemented |
Project Resources
- Source Code: github.com/Maicarons/mailang
- Releases: Releases
- Tags: Tags
- Contributing: CONTRIBUTING.md
- Roadmap: ROADMAP.md
- Report: REPORT.md
Design Philosophy
Simple and Easy to Learn
MaìLang uses a hybrid syntax style, borrowing from Rust, Python, and JavaScript:
- Rust-like variable declarations and type system
- Python-like concise function syntax
- JavaScript-like object operations
High Performance
The default backend is the register VM (stack bytecode is lowered to three-address IR at run time); the stack VM with slot locals is still selectable with --vm=stack. Both are faster than tree-walk interpreters (like Rhai):
- Bytecode can be serialized and cached for faster startup
- Locals use slot indices (no hash lookup), suitable for IoT scenarios
- Hot-path specialization and CallDirect calls
Universal Platform Support
Through three-tier feature gating, MaìLang can run on all platforms from 64KB IoT chips to desktop servers:
| Level | Memory | Typical Devices | Features |
|---|---|---|---|
no_std | 64KB | ARM Cortex-M0 | Stack-only values |
no_std + alloc | 128KB | RISC-V, ESP32 | Reference counting, no GC |
std | 256KB+ | Raspberry Pi, Servers | Full features |
UTF-8 Native Support
MaìLang enforces UTF-8 encoding, identifiers support any Unicode script:
let 中文变量 = "支持中文"
let مرحبا = "支持阿拉伯文"
let 🔥 = "支持emoji"Safe and Reliable
- Strong type system with optional type inference
- Result/Option error handling, no exceptions
- Optional ownership system
Comparison with Other Languages
| Feature | MaìLang | Rhai | Rune | RustPython |
|---|---|---|---|---|
| Execution Model | Register VM (default) + stack VM | Tree Walk | Stack VM | Stack VM |
| OOP Support | ✅ Full | ❌ Limited | ❌ Limited | ✅ Full |
| Embedded Support | ✅ 64KB+ | ✅ | ❌ | ❌ |
| FFI | ✅ 12 Languages | ✅ Rust | ❌ | ✅ Python |
| Type System | Hybrid | Dynamic | Dynamic | Dynamic |
| Pattern Matching | ✅ | ❌ | ✅ | ❌ |
| Async Support | Not supported (no async runtime) | ❌ | ✅ | ❌ |
Use Cases
IoT and Embedded
- Sensor data processing
- Device configuration scripts
- Edge computing logic
Game Development
- Game logic scripting
- AI behavior trees
- Configuration file parsing
Automation
- Data processing pipelines
- System administration scripts
- Test automation
Education
- Programming introduction
- Language design learning
- Compiler theory practice
Quick Start
# Install
cargo install mailang-cli
# REPL
mailang
# Run a file
mailang run hello.mai
# Inline execution
mailang eval 'println("Hello, MaìLang!")'Next Steps
- Getting Started - Installation and first program
- Syntax Guide - Complete syntax reference
- OOP - Classes, inheritance, traits
- Standard Library - Built-in modules
- Package Registry - Publish, install, search packages
- FFI - Language integration guide
- WASM - Browser and edge integration
- IoT - Embedded compilation and deployment
- Real Hardware - ESP32-C3 / Cortex-M4
- ESP32 Blink - First firmware walkthrough
- Footprint - Measuring artifact sizes
- Playground - Run MaìLang in the browser