This commit is contained in:
2026-04-08 23:28:50 -04:00
parent edabc22431
commit bdf08ce52c
11 changed files with 417 additions and 158 deletions
+10 -8
View File
@@ -1,3 +1,6 @@
use crate::{io::CompilerOutput, parser::Nodes};
mod io;
mod parser;
fn main() {
@@ -6,12 +9,11 @@ fn main() {
println!("file expected");
return;
};
let code = match std::fs::read_to_string(path) {
Ok(code) => code,
Err(err) => {
println!("Failed to read input file: {err}");
return;
}
};
parser::parse(&code);
let mut output = CompilerOutput::new();
let nodes = Nodes::parse_root(&path, &mut output);
if let Some((nodes, root)) = nodes {
nodes.format(&mut std::io::stdout(), root).unwrap();
println!();
}
output.write(&mut std::io::stdout());
}