use passerine::{common::source::Source, compile, run};
pub fn main() {
let path = std::env::args_os().nth(1).expect("Usage: <path>");
let source = Source::path(path.as_ref())
.map_err(|_| "Error: File could not be read".to_string());
let bytecode = source.and_then(|s| compile(s).map_err(|e| e.to_string()));
let result = bytecode.and_then(|b| run(b).map_err(|e| e.to_string()));
if let Err(error) = result {
eprintln!("{}", error);
}
}