feat(tazjin/rlox): Initial bytecode representation

This is significantly simplified from the version in the book, since
I'm using Rust's Vec and not implementing dynamic arrays manually.

We'll see if I run into issues with that ...

Change-Id: Ie3446ac3884b850f3ba73a4b1a6ca14e68054188
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2413
Reviewed-by: tazjin <mail@tazj.in>
Tested-by: BuildkiteCI
This commit is contained in:
Vincent Ambo 2021-01-17 20:33:39 +03:00 committed by tazjin
parent 30a6fcccee
commit 49c4cc6c56
4 changed files with 80 additions and 1 deletions

View file

@ -2,6 +2,19 @@
//!
//! https://craftinginterpreters.com/chunks-of-bytecode.html
mod chunk;
mod opcode;
mod value;
use chunk::Chunk;
use opcode::OpCode;
pub fn main() {
unimplemented!()
let mut chunk: Chunk = Default::default();
let constant = chunk.add_constant(1.2);
chunk.add_op(OpCode::OpConstant(constant));
chunk.add_op(OpCode::OpReturn);
chunk::disassemble(&chunk, "test chunk");
}