diff options
| author | Joel Martin <github@martintribe.org> | 2014-10-25 11:42:07 -0500 |
|---|---|---|
| committer | Joel Martin <github@martintribe.org> | 2015-01-06 21:58:35 -0600 |
| commit | abdd56ebc0e01cd92f694ef2bcafcc394453d055 (patch) | |
| tree | d1ace96ac90e5d888e4d4d05dd4ca0c0445a856e /rust/src/step0_repl.rs | |
| parent | f41866dbe99080f0916512261f0412c5bc65f190 (diff) | |
| download | mal-abdd56ebc0e01cd92f694ef2bcafcc394453d055.tar.gz mal-abdd56ebc0e01cd92f694ef2bcafcc394453d055.zip | |
Rust: step0_repl and step1_read_print
Diffstat (limited to 'rust/src/step0_repl.rs')
| -rw-r--r-- | rust/src/step0_repl.rs | 25 |
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())))); + } +} |
