Working codegen

This commit is contained in:
2026-04-13 15:18:53 +02:00
parent 9882626397
commit f4580aeaa2
4 changed files with 287 additions and 4 deletions
+4 -3
View File
@@ -1,5 +1,5 @@
pub mod codegen;
pub mod errors;
pub mod gogen;
pub mod parser;
use std::fs;
@@ -48,8 +48,9 @@ fn cmd_build(path: &str) {
match parser::parse(&source) {
Ok(ast) => {
println!("parsed {} top-level items", ast.statements.len());
println!("{:#?}", ast.statements)
// codegen will go here
let contents = gogen::generate(&ast);
fs::write(path.to_string() + ".go", contents).unwrap();
println!("build successful");
}
Err(e) => {
eprintln!("parse error:\n{}", e);