1
1
mirror of https://github.com/kanaka/mal.git synced 2024-11-10 12:47:45 +03:00
mal/nim/step1_read_print.nim
2015-02-28 14:23:19 +01:00

15 lines
311 B
Nim

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()