From d756b309068eaf991290c39963462efec27ebe6f Mon Sep 17 00:00:00 2001
From: David Li
Date: Sat, 4 Nov 2017 19:11:55 -0400
Subject: Add a simple REPL to show parsing
---
src/main.rs | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
(limited to 'src')
diff --git a/src/main.rs b/src/main.rs
index bd4659b..2564011 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,6 +1,19 @@
pub mod ast;
pub mod taiga;
+use std::io::{self, BufRead};
+
fn main() {
- println!("{:?}", taiga::parse_Program("(3 + 5) * 7"));
+ let stdin = io::stdin();
+ let mut handle = stdin.lock();
+ loop {
+ let mut input = String::new();
+ if let Ok(n) = handle.read_line(&mut input) {
+ if n == 0 { break; }
+ println!("{:?}", taiga::parse_Program(&input));
+ }
+ else {
+ break;
+ }
+ }
}
--
cgit v1.2.3