mute/src/main.rs

36 lines
625 B
Rust
Raw Normal View History

2023-09-12 11:21:51 +00:00
use std::io::{self, Write};
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 ast = read(&input);
let res = eval(&ast);
println!("{res}");
input.clear();
}
}
fn read(input: &str) -> String {
input.to_owned()
}
fn eval(input: &str) -> String {
input.to_owned()
}