a bunch of stuff mostly

This commit is contained in:
nora 2023-05-22 20:44:18 +02:00
parent 56e7f77a0d
commit b9a2f939c4
29 changed files with 734 additions and 345 deletions

View file

@ -1,10 +1,19 @@
use std::error::Error;
fn main() -> Result<(), Box<dyn Error>> {
fn main() {
let input_file = std::env::args().nth(1).expect("first argument");
let src = std::fs::read_to_string(input_file)?;
let src = std::fs::read_to_string(&input_file).unwrap_or_else(|err| {
eprintln!("failed to read file {input_file}: {err}");
std::process::exit(1);
});
parser::parse_file(&src);
let ast = parser::parse_file(&src);
dbg_pls::color!(&ast);
let Ok(ast) = ast else {
std::process::exit(1);
};
let mut printer = parser::pretty::PrettyPrinter::new(std::io::stdout().lock(), false);
println!("// START CODE -------------------");
printer.translation_unit(&ast).unwrap();
println!("// END CODE -------------------");
Ok(())
let _ = analysis::lower_translation_unit(&ast);
}