aboutsummaryrefslogtreecommitdiff
path: root/rust/src/step0_repl.rs
diff options
context:
space:
mode:
Diffstat (limited to 'rust/src/step0_repl.rs')
-rw-r--r--rust/src/step0_repl.rs25
1 files changed, 25 insertions, 0 deletions
diff --git a/rust/src/step0_repl.rs b/rust/src/step0_repl.rs
new file mode 100644
index 0000000..ac9cf24
--- /dev/null
+++ b/rust/src/step0_repl.rs
@@ -0,0 +1,25 @@
+use readline::mal_readline;
+mod readline;
+
+// read
+fn read(str: String) -> String {
+ str
+}
+
+// eval
+fn eval(ast: String) -> String {
+ ast
+}
+
+// print
+fn print(exp: String) -> String {
+ exp
+}
+
+fn main() {
+ loop {
+ let line = mal_readline("user> ");
+ match line { None => break, _ => () }
+ println!("{}", print(eval(read(line.unwrap()))));
+ }
+}