parse blocks

This commit is contained in:
2025-05-29 20:32:54 +02:00
parent 01cc38f31d
commit 47fd9a36a4
4 changed files with 199 additions and 26 deletions

View File

@@ -83,6 +83,21 @@ section .note.GNU-stack
env.locals.insert(name.lexeme, offset);
writeln!(&mut self.output, " mov QWORD [rbp-{}], rax", offset)?;
}
Stmt::Block(statements) => {
let mut env = Env::new();
for stmt in statements {
self.compile_stmt(&mut env, stmt)?;
}
}
Stmt::If {
condition: _,
then_branch: _,
else_branch: _,
} => todo!(),
Stmt::While {
condition: _,
body: _,
} => todo!(),
}
Ok(())
}