use std::io::{self, Write}; mod lexer; mod parser; fn main() { let mut input = String::new(); println!("MAL -- REPL"); loop { print!("> "); io::stdout().flush().expect("failed to write to stdout"); let bytes_read = io::stdin() .read_line(&mut input) .expect("failed to read from stdin"); if bytes_read == 0 { break; } let tokens = lexer::read(&input).unwrap(); let ast = parser::parse(tokens).unwrap(); let res = eval(ast); println!("{res}"); input.clear(); } } fn eval(input: Vec) -> String { format!("{input:?}") }