diff options
| author | Joel Martin <github@martintribe.org> | 2015-03-03 22:46:09 -0600 |
|---|---|---|
| committer | Joel Martin <github@martintribe.org> | 2015-03-03 22:46:09 -0600 |
| commit | 2b0fa48326927683fa19f399b3edb8aae3dbcd36 (patch) | |
| tree | 4f0d2b3b6b9e397f968f977cc38ec9a5b8b200f1 /nim/step1_read_print.nim | |
| parent | 58ba5af4704c4539ee7d3814dfeff8672577f86a (diff) | |
| parent | a2cd0a3adae2ccf2566122bcd90230d905ab59dc (diff) | |
| download | mal-2b0fa48326927683fa19f399b3edb8aae3dbcd36.tar.gz mal-2b0fa48326927683fa19f399b3edb8aae3dbcd36.zip | |
Merge pull request #20 from def-/master
Add Nim
Diffstat (limited to 'nim/step1_read_print.nim')
| -rw-r--r-- | nim/step1_read_print.nim | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/nim/step1_read_print.nim b/nim/step1_read_print.nim new file mode 100644 index 0000000..4be5898 --- /dev/null +++ b/nim/step1_read_print.nim @@ -0,0 +1,14 @@ +import rdstdin, types, reader, printer + +proc read(str: string): MalType = str.read_str + +proc eval(ast: MalType): MalType = ast + +proc print(exp: MalType): string = exp.pr_str + +while true: + try: + let line = readLineFromStdin("user> ") + echo line.read.eval.print + except: + echo getCurrentExceptionMsg() |
