Hyle is a high-performance, stack-based Virtual Machine and dynamic programming language implemented in Rust. It features a hand-written single-pass compiler, a Mark-and-Sweep Garbage Collector, and robust Object-Oriented capabilities.
- Fast & Lightweight: Stack-based bytecode execution model for efficient performance.
- Memory Managed: Custom Mark-and-Sweep Garbage Collector handles memory automatically, detecting cycles and stress.
- First-Class Functions: Full support for Closures, higher-order functions, and lexical scoping.
- Object-Oriented: Classes, Instances, Inheritance (single), Methods, and
thisbinding. - Robust Compilation: Single-pass Pratt Parser that compiles directly to bytecode.
- Zero-Dependency: Written in pure Rust with standard libraries only.
- Rust (latest stable)
Run Hyle scripts using cargo run. For best performance, always use the --release flag.
cargo run --release <script.hyle>// fib.hyle
fun fib(n) {
if (n < 2) return n;
return fib(n - 1) + fib(n - 2);
}
print fib(28);For full language documentation, check out LANGUAGE.md.
Benchmarks were run on a standard Linux environment using release builds.
| Benchmark | Description | Result |
|---|---|---|
| Fibonacci | Recursive calculation of fib(28) |
~1.04s |
| Zoo | Creation of 10,000 objects + 60k field accesses | ~0.21s |
Note: These benchmarks measure pure VM execution overhead including method dispatch, stack manipulation, and garbage collection pressure.
- Compiler: Converts source code to Bytecode (
Chunk) in a single pass. - Virtual Machine: Executes bytecode instructions in a tight loop.
- Stack: Stores temporary values and call frames (
ObjClosure). - Heap: Stores dynamically allocated objects (
ObjString,ObjInstance,ObjClass) managed by the GC.
This project is open source and available for educational and performance research purposes.