Skip to content

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 ​

FeatureDescriptionStatus
OOPClasses, inheritance, constructors, super() / super.method()✅ Implemented
Traitsimplements, default methods, trait extends✅ Implemented
ClosuresUpvalue capture, first-class functions✅ Implemented
Pattern MatchingLiterals, ranges, or-patterns, guards, array/tuple destructure, postfix expr match { }✅ Implemented
Error HandlingResult/Option + ? propagation✅ Implemented
Default Params / Destructuringfn f(a, b = 10); let (x, y) = …✅ Implemented
GenericsGeneric-function monomorphization (turbofish); field-erased generic classes✅ Implemented
UTF-8 NativeIdentifiers support any Unicode script✅ Implemented
Bytecode VMStack 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
GCRc + collect_cycles() + mark-sweep heap✅ Implemented
Package RegistryFilesystem / static HTTP: publish/install/search/yank✅ Implemented
C FFI12-language binding support✅ Implemented
WebAssemblyBrowser/edge runtime✅ Implemented
CLI + REPLCommand-line tool✅ Implemented

Project Resources ​

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:

LevelMemoryTypical DevicesFeatures
no_std64KBARM Cortex-M0Stack-only values
no_std + alloc128KBRISC-V, ESP32Reference counting, no GC
std256KB+Raspberry Pi, ServersFull 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 ​

FeatureMaìLangRhaiRuneRustPython
Execution ModelRegister VM (default) + stack VMTree WalkStack VMStack VM
OOP Support✅ Full❌ Limited❌ Limited✅ Full
Embedded Support✅ 64KB+✅❌❌
FFI✅ 12 Languages✅ Rust❌✅ Python
Type SystemHybridDynamicDynamicDynamic
Pattern Matching✅❌✅❌
Async SupportNot 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 ​

bash
# Install
cargo install mailang-cli

# REPL
mailang

# Run a file
mailang run hello.mai

# Inline execution
mailang eval 'println("Hello, MaìLang!")'

Next Steps ​