//! Bytecode interpreter for Lox. //! //! https://craftinginterpreters.com/chunks-of-bytecode.html mod chunk; mod compiler; mod errors; mod opcode; mod value; mod vm; use chunk::Chunk; pub struct Interpreter {} impl crate::Lox for Interpreter { type Error = errors::Error; type Value = value::Value; fn create() -> Self { Interpreter {} } fn interpret( &mut self, code: String, ) -> Result> { let chunk = compiler::compile(&code)?; vm::interpret(chunk).map_err(|e| vec![e]) } }