I've spent the last several months building Zamin, a scripting language with a Rust-based interpreter, a register-based bytecode VM, and a mark-and-sweep garbage collector. I wanted to share it here and get feedback from people who actually build languages and runtimes.
Repo: https://github.com/young-developer90/zamin (MIT licensed)
I wanted something in the same territory as Python for everyday scripting -- closures, pattern matching, string interpolation, a real module system -- but compiled to bytecode instead of tree-walked, with a project/CLI toolchain built in from day one rather than bolted on later.
func fibonacci(n) {
if n <= 1 { return n; }
return fibonacci(n - 1) + fibonacci(n - 2);
}
for i in 0..10 { print(f"fib({i}) = {fibonacci(i)}"); }
The pipeline is fairly conventional: lexer -> parser -> AST -> compiler -> bytecode -> VM. A few things I focused on:
OP_ADD_INT_IMM
) that skip boxing and type checks for the common case.Benchmarked against Python 3 (wall-clock, same machine):
| Benchmark | Zamin | Python 3 | Ratio |
|---|---|---|---|
| Recursive fib(32) | 1.51s | 0.35s | 4.3x slower |
| Integer loop (5M ops) | 0.47s | 0.53s | 0.9x -- faster than Python |
| String concat (100K) | 3.14s | 0.23s | 13.4x slower |
| List push (500K) | 0.13s | 0.09s | 1.5x slower |
Tight integer loops are Zamin's strongest case. String and list-heavy code still lags CPython -- that's an open problem I'm actively working on, not something I'm hiding.
luna
(Linux/GTK4) and sol
(Windows)cv
modulelinum
) with a small PyTorch-style API -- Sequential
, Linear
, Adam
, CrossEntropyLoss
-- that runs against CUDA when availablepy.import("numpy")
with automatic type marshalling)zamin::execute_source
, zamin::execute_file
)zamin run
, zamin repl
, zamin fmt
, zamin test
, zamin build
, zamin new
git clone https://github.com/young-developer90/zamin.git
cd zamin
cargo build --release
./target/release/zamin run examples/hello.zamin
Requires Rust 1.80+.
Docs (with a getting-started guide, full language reference, and stdlib reference) are at https://young-developer90.github.io/zamin/ -- also translated into Farsi and Japanese.
I'd genuinely appreciate feedback, especially on the VM design and where the string/list performance gap is likely coming from. Happy to answer questions in the comments.