13 releases (8 stable)
Uses new Rust 2024
| 2.2.0 | Sep 24, 2026 |
|---|---|
| 2.1.0 | Sep 10, 2026 |
| 2.0.0 | Aug 25, 2026 |
| 1.2.1 | Aug 13, 2026 |
| 0.1.5 | Jul 14, 2026 |
#549 in Programming languages
42 downloads per month
Used in 3 crates
1.5MB
32K
SLoC
rl-vm
Bytecode virtual machine for the rl-lang programming language
Part of the rl-lang workspace. This is the bytecode execution engine of the toolchain - it compiles the AST to bytecode and runs it on a stack-based VM.
Pipeline
Vec<Statement> -> Compiler::compile() -> Chunk -> Vm::run() / Vm::run_and_return()
Modules
| Module | Contents |
|---|---|
compiler |
Compiler - compiles a resolved AST into a Chunk of bytecode |
bytecode |
serialize_chunk / deserialize_chunk - persisting compiled chunks to disk (used by rl-tooling's package/embed step) |
chunk |
Chunk and OpCode - the bytecode representation |
vm_logic |
Vm - the stack-based bytecode interpreter, plus VmError |
native |
Module and NativeFn - native function binding for the VM |
values |
VmValue and VmNativeFn - the VM's runtime value representation |
stdlib |
Standard library modules exposed to VM-compiled code |
Dependencies
Builds on rl-ast, rl-lexer, and zstd (for compressed bytecode serialization).
Usage
[dependencies]
rl-vm = { workspace = true }
use rl_vm::{Compiler, Vm};
let chunk = Compiler::new(&ast).compile(&statements)?;
let result = Vm::new().run_and_return(&chunk)?;
Note: the VM is the default (and only) execution backend of
rl-cli(thevmfeature is on by default).
License
Licensed under either of Apache License, Version 2.0 or MIT license at your option - see LICENSE.md for the full text and why both are offered.
Dependencies
~52–97MB
~2M SLoC