1
1
mirror of https://github.com/kanaka/mal.git synced 2024-09-21 10:37:58 +03:00
mal/nim/step1_read_print.nim

15 lines
311 B
Nim
Raw Normal View History

2015-02-28 16:14:18 +03:00
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()