Project start: writing step step0_repl

Step 0 alone only act as an echo for the input, define the sructure of
the interpreter

Signed-off-by: teo3300 <matteo.rogora@live.it>
This commit is contained in:
teo3300
2023-06-01 23:33:27 +02:00
parent 679eb3867c
commit b30c7dd6fc
3 changed files with 55 additions and 0 deletions

19
src/main.rs Normal file
View File

@ -0,0 +1,19 @@
// io lib to read input and print output
use std::io::{self, Write};
mod step0_repl;
use step0_repl::rep;
fn main() -> io::Result<()> {
loop {
print!("user> ");
// Flush the prompt to appear before command
let _ = io::stdout().flush();
let mut input = String::new();
io::stdin().read_line(&mut input)?;
print!("{}", rep(&input));
}
}