[rlox] Use fewer files

This commit is contained in:
ctsk
2023-03-29 20:07:31 +02:00
parent ff67071f5b
commit d6e6b1d3ab
3 changed files with 9 additions and 14 deletions

View File

@@ -1,5 +0,0 @@
#[repr(u8)]
#[derive(Debug)]
pub enum Op {
Return
}

View File

@@ -1,11 +1,7 @@
mod chunk; mod vm;
mod bytecode;
use chunk::Chunk;
use bytecode::Op;
fn main() { fn main() {
let mut chunk = Chunk::new("TEST".to_string()); let mut chunk = vm::Chunk::new("TEST".to_string());
chunk.add(Op::Return); chunk.add(vm::Op::Return);
println!("{:?}", chunk); println!("{:?}", chunk);
} }

View File

@@ -1,7 +1,11 @@
use crate::Op;
use std::fmt; use std::fmt;
#[repr(u8)]
#[derive(Debug)]
pub enum Op {
Return
}
pub struct Chunk { pub struct Chunk {
code: Vec<Op>, code: Vec<Op>,
name: String name: String