Separate out backends in main

This commit is contained in:
Alex Bethel 2022-08-05 11:49:06 -05:00
parent 1044939b32
commit 38a90cf1fa

View file

@ -258,10 +258,26 @@ fn main() {
typeck(&ast)?; typeck(&ast)?;
let ir = ast2ir(ast); let ir = ast2ir(ast);
match args.target {
Target::CSource => {
let c = backends::c::generate_c(&ir); let c = backends::c::generate_c(&ir);
let mut out_file = File::create("out.c")?; let mut out_file = File::create("out.c")?;
write!(out_file, "{}", 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(()) Ok(())
} }