mirror of
https://github.com/Noratrieb/uwucc.git
synced 2026-01-16 01:25:07 +01:00
a bunch of stuff mostly
This commit is contained in:
parent
56e7f77a0d
commit
b9a2f939c4
29 changed files with 734 additions and 345 deletions
21
src/main.rs
21
src/main.rs
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue