about summary refs log blame commit diff
path: root/users/tazjin/rlox/src/bytecode/mod.rs
blob: de04d7b06f4d0f419325bb393304635609c2642d (plain) (tree)
1
2
3
4
5
6
7
8
9



                                                            
          
           

           
       



                   
               


                                              

                                                  
 
                                                  
 
//! Bytecode interpreter for Lox.
//!
//! https://craftinginterpreters.com/chunks-of-bytecode.html

mod chunk;
mod errors;
mod opcode;
mod value;
mod vm;

use chunk::Chunk;
use opcode::OpCode;

pub fn main() {
    let mut chunk: Chunk = Default::default();

    let constant = chunk.add_constant(1.2);
    chunk.add_op(OpCode::OpConstant(constant), 1);
    chunk.add_op(OpCode::OpReturn, 1);

    vm::interpret(chunk).expect("it should work");
}