#![forbid(unsafe_code)] mod compiler; mod errors; mod file_io; mod parser; mod vm; use file_io::open_file; use std::path::Path; use compiler::Compiler; use parser::Parser; use vm::VirtualMachine; fn main() { let path = Path::new("reid_src/test.reid"); let parsed = Parser::from(open_file(&path).ok().unwrap()).parse(); if let Err(error) = parsed { eprintln!("Syntax error: {}", error); std::process::exit(1); } dbg!(&parsed); let compiled = Compiler::from(parsed.unwrap()).compile(); if let Err(error) = compiled { eprintln!("Compilation error: {}", error); std::process::exit(1); } dbg!(&compiled); let mut vm = VirtualMachine::from(compiled.unwrap()); if let Err(error) = vm.run() { eprintln!("Runtime panic: {:#?}", error); std::process::exit(1); } }