3 releases (breaking)

Uses new Rust 2024

new 0.3.0 Mar 25, 2025
0.2.0 Mar 23, 2025
0.1.0 Mar 10, 2025

#206 in Programming languages

Download history 86/week @ 2025-03-06 29/week @ 2025-03-13 164/week @ 2025-03-20

279 downloads per month

MIT license

32KB
760 lines

ci docs crates license-mit-badge

ByteVM

ByteVM is a bytecode virtual machine written in Rust. It is designed to execute programs written in a custom bytecode format. The VM is designed to be fast, efficient, and easy to use. It is intended to be used as a platform for implementing programming languages, interpreters, and compilers.

Status

ByteVM is currently in the early stages of development. The VM is not yet feature complete, and the API is subject to change. The VM is not yet suitable for production use.

Examples

    let program = Program {
    instructions: vec![
        // main
        Instruction::Push(Variant::Integer(1)),
        Instruction::SetLocal(0),
        Instruction::Push(Variant::Integer(2)),
        Instruction::SetLocal(1),
        Instruction::Push(Variant::FunctionPointer(9)),
        Instruction::GetLocal(0),
        Instruction::GetLocal(1),
        Instruction::FunctionCall(2),
        Instruction::Halt,
    
        // add
        Instruction::GetLocal(1),
        Instruction::GetLocal(0),
        Instruction::Add,
        Instruction::Return
    ],
    ..Default::default()
    };
    
    Vm::new(program, VmOptions::default()).run();

License

ByteVM is distributed under the terms of the MIT license. See LICENSE for details.

Dependencies

~90KB