desugar: Add primitive constant folding

This commit is contained in:
2025-05-05 04:18:16 -04:00
parent cd2e3c3e32
commit 2d706ff582
3 changed files with 94 additions and 0 deletions

View File

@@ -124,6 +124,9 @@ fn live_desugar() -> Result<(), RlError> {
let code = Parser::new("", Lexer::new(line)).parse::<Stmt>()?;
println!("Raw, as parsed:\n{C_LISTING}{code}\x1b[0m");
let code = ConstantFolder.fold_stmt(code);
println!("ConstantFolder\n{C_LISTING}{code}\x1b[0m");
let code = SquashGroups.fold_stmt(code);
println!("SquashGroups\n{C_LISTING}{code}\x1b[0m");