aboutsummaryrefslogtreecommitdiff
path: root/rust/src/bin/step0_repl.rs
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2015-03-05 00:22:43 -0800
committerAlex Crichton <alex@alexcrichton.com>2015-03-05 00:40:57 -0800
commitbbeb1b87c2b848189c0f71c93cf4b70b32d45a4d (patch)
tree257ac1a8a70f7f981be440c22763dd9ec7e1e562 /rust/src/bin/step0_repl.rs
parenta551bd4cd4d802173057ed124b911abed4ec530b (diff)
downloadmal-bbeb1b87c2b848189c0f71c93cf4b70b32d45a4d.tar.gz
mal-bbeb1b87c2b848189c0f71c93cf4b70b32d45a4d.zip
Update Rust code to the current Rust nightly
Lots of changes! Hopefully everything is still semantically equivalent (tests still pass)
Diffstat (limited to 'rust/src/bin/step0_repl.rs')
-rw-r--r--rust/src/bin/step0_repl.rs26
1 files changed, 26 insertions, 0 deletions
diff --git a/rust/src/bin/step0_repl.rs b/rust/src/bin/step0_repl.rs
new file mode 100644
index 0000000..030c551
--- /dev/null
+++ b/rust/src/bin/step0_repl.rs
@@ -0,0 +1,26 @@
+extern crate mal;
+
+use mal::readline::mal_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()))));
+ }
+}