Reid/src/main.rs

30 lines
724 B
Rust

mod compiler;
mod errors;
mod file_io;
mod parser;
use compiler::Compiler;
use file_io::open_file;
use parser::Parser;
use std::path::Path;
fn main() {
let path = Path::new("reid_src/test.reid");
let parsed = Parser::from(open_file(&path).ok().unwrap()).parse();
match parsed {
Err(error) => {
eprintln!("Syntax error: {}", error);
std::process::exit(1);
}
Ok(parsed) => {
dbg!(&parsed);
let compiled = Compiler::from(parsed).compile();
if let Err(error) = compiled {
eprintln!("Compilation error: {}", error);
std::process::exit(1);
}
dbg!(compiled);
}
}
}