From 84ccd167f74959e105586810785988d6f066121b Mon Sep 17 00:00:00 2001 From: flameyosflow Date: Tue, 16 Dec 2025 10:46:58 +0200 Subject: [PATCH] Implement missing CStmts --- src/codegen/transpiler.rs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/codegen/transpiler.rs b/src/codegen/transpiler.rs index d652322..639432f 100644 --- a/src/codegen/transpiler.rs +++ b/src/codegen/transpiler.rs @@ -225,7 +225,21 @@ impl Transpiler { output.push_str(" }\n"); output } - _ => "// TODO: unimplemented stmt\n".to_string(), + + CStmt::For(init, cond, incr, body) => { + let mut output = format!("for ({}, {}, {}) {{", self.generate_var_decl(init), self.generate_expr(cond), self.generate_expr(incr)); + for stmt in body { + output.push_str(&format!(" {}", self.generate_stmt(stmt))); + } + output.push_str(" }\n"); + output + } + CStmt::Break => { + "break;\n".to_string() + } + CStmt::Continue => { + "continue;\n".to_string() + } } }