Separate out backends in main

main
Alex Bethel 2022-08-05 11:49:06 -05:00
parent 1044939b32
commit 38a90cf1fa
1 changed files with 19 additions and 3 deletions

View File

@ -258,10 +258,26 @@ fn main() {
typeck(&ast)?;
let ir = ast2ir(ast);
let c = backends::c::generate_c(&ir);
let mut out_file = File::create("out.c")?;
write!(out_file, "{}", c)?;
match args.target {
Target::CSource => {
let c = backends::c::generate_c(&ir);
let mut out_file = File::create("out.c")?;
write!(out_file, "{}", c)?;
}
Target::Assembly => todo!(),
Target::ObjectFile => todo!(),
Target::Executable => todo!(),
Target::SharedObject => todo!(),
Target::Spirv => todo!(),
Target::Wat => todo!(),
Target::Wasm => todo!(),
Target::Lua => todo!(),
Target::Python => todo!(),
Target::Go => todo!(),
Target::Ada => todo!(),
}
Ok(())
}