This commit is contained in:
nora 2022-06-27 12:44:38 +02:00
parent 72687d4167
commit e4f0dee8a9
6 changed files with 48 additions and 33 deletions

View file

@ -232,7 +232,9 @@ impl InterpretCtx {
}
}
pub fn interpret(stmts: Vec<Stmt>, _spans: Vec<Span>) -> Result<()> {
// tag::interpret[]
pub fn interpret(stmts: Vec<Stmt>) -> Result<()> {
// end::interpret[]
let mut ctx = InterpretCtx {
memory: vec![0; MEMORY_SIZE],
registers: [0; 16],

View file

@ -16,7 +16,7 @@ fn main() -> Result<(), io::Error> {
let stmts = ir::compile(ast.into_iter()).unwrap_or_else(|e| report_and_exit(&file, e));
dbg_pls::color!(&stmts.0);
interpret::interpret(stmts.0, stmts.1).unwrap_or_else(|e| report_and_exit(&file, e));
interpret::interpret(stmts.0).unwrap_or_else(|e| report_and_exit(&file, e));
Ok(())
}

View file

@ -294,7 +294,9 @@ where
}
}
// tag::parse[]
pub fn parse(src: &str) -> Result<Vec<Stmt>> {
// end::parse[]
let lexer = lex(src).spanned();
let mut parser = Parser {
iter: lexer.peekable(),