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() + } } }