1 unstable release
0.1.0 | Jul 8, 2022 |
---|
#233 in Emulators
8KB
139 lines
The official virtual machine/instruction set for ivm.
See the ivm wiki on GitHub for more information.
What is ivm?
ivm is an experimental, well-documented, and expansion-ready virtual machine/instruction set written purely in Rust.
ivm provides a fairly medium level Instruction wrapper, which makes porting your language to ivm easier than imaginable.
Example
When combined with ivm-compile, we can achieve some pretty simple results with impressive ease.
let program_options = ProgramOptions::new(options::CCFV, MemoryPointerLength::X32b);
let instructions = [
Instruction::Push(ReadOperation::Local(b"Hello, world!\n".to_vec())),
Instruction::ExternCall(ivm_ext_x32::STDOUT_WRITE),
Instruction::ExternCall(ivm_ext_x32::STDOUT_FLUSH),
];
let bytecode = ivm_compile::compile_all(&program_options, instructions);
let mut vm = VmInstance::init(program_options);
vm.introduce(bytecode);
vm.continue_execution().unwrap();
Dependencies
~13KB