lovm2
Is a lightweight virtual machine with a focus on simplicity and extendability.
lovm2 = "0.4.7"
Features
- dynamic typing
- generate bytecode using highlevel intermediate representation
- call into shared objects: lovm2_extend
- python bindings: pylovm2
- define own callbacks for interrupts
Examples
Projects
Source Code References
Generating Bytecode
use *;
use Vm;
let mut module = new;
// a module needs a code object called `main`
// if you want to make it runnable
let mut main_hir = module.entry;
// set the local variable n to 10
main_hir.step;
// `print` is a builtin function. the `lv2_var!` macro
// ensures that the given identifier is not confused
// with a string.
main_hir.step;
// ... this is equivalent to the developer-friendly version:
main_hir.step;
// creates a `Module` from the `ModuleBuilder`
let module = module.build.unwrap;
println!;
// load the module and run it
let mut vm = with_std;
vm.add_main_module.expect;
vm.run.expect;
Customer Reviews
This Thing Fast - Sonic
And I thought I was simple... - Pythagorean Theorem