added repl, eof token, and a parser with a AST producer

This commit is contained in:
2026-07-08 23:44:39 -05:00
parent a0a7b85e11
commit 7ee19e4ab7
7 changed files with 288 additions and 5 deletions
+28
View File
@@ -0,0 +1,28 @@
use std::process;
use crate::parser::{self, Parser};
pub fn repl() {
// Read-Eval-Print Loop
use std::io::{self, Write};
println!("Welcome to the Riv Lang REPL! Type 'exit' to quit.");
loop {
print!("> ");
io::stdout().flush().unwrap();
let mut input = String::new();
io::stdin().read_line(&mut input).unwrap();
let input = input.trim().to_string();
if input == "exit" {
process::exit(0);
}
let program = Parser::new(input).produce_ast();
println!("{:#?}", program);
}
}