mirror of
https://github.com/teo3300/rust-mal.git
synced 2026-01-13 01:35:31 +01:00
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:
19
src/main.rs
Normal file
19
src/main.rs
Normal 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));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user