Bytecode execution
Emit operations for arithmetic, comparisons, conditional jumps, locals and calls, then run the compiled instruction stream through the VM API.
MVM is a standalone C11 stack-based virtual machine that a language implementation can embed. Build your own lexer, parser and compiler, translate your language into MVM bytecode, and use the runtime to execute it without coupling your language syntax to the VM.
MVM handles bytecode execution and runtime values. The language developer remains responsible for the source syntax, lexer, parser, compiler and language-specific semantics. A frontend can emit bytecode and register native C callbacks for services implemented by its host.
Emit operations for arithmetic, comparisons, conditional jumps, locals and calls, then run the compiled instruction stream through the VM API.
Use null, boolean, number, string, array, map, function and closure values with collection and function-call operations.
Register native callbacks so a language can expose built-ins or bridge to its own I/O, file, networking or application APIs.
Use the VM's text and JSON profiling support to inspect runtime activity while developing or optimizing a language implementation.
MVM uses a Makefile and a C11 compiler. The following commands build and run its test program.
git clone https://github.com/MacoraOne/MVM.git cd MVM make clean test
The test program reports MACORAONE_VM_ALL_TESTS_PASS when the complete test suite succeeds. The repository's GitHub Actions test workflow is manually triggered from the Actions tab.
Define your own syntax and build the lexer, parser, and semantic checks independently of MVM.
Use the public declarations in vm.h and the API reference to emit bytecode for your language's expressions, control flow, values and calls.
Register C callbacks for built-ins and host services, while keeping language-specific behavior in your own code.
Run the VM, handle errors and lifecycle according to the API documentation, then use profiling output to inspect performance.
mvm_free is called; it does not currently provide a tracing garbage collector. Strings passed to the API must follow the lifetime requirements in the API documentation. The VM is not a security sandbox: native C callbacks execute with the host process's permissions.