Crates.io | ivm-vm |
lib.rs | ivm-vm |
version | 0.1.0 |
source | src |
created_at | 2022-07-08 07:16:27.305426 |
updated_at | 2022-07-08 07:16:27.305426 |
description | The virtual machine for ivm bytecode. |
homepage | |
repository | |
max_upload_size | |
id | 621663 |
size | 8,526 |
The official virtual machine/instruction set for ivm.
See the ivm wiki on GitHub for more information.
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.
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();