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

23 lines
426 B
Io
Raw Normal View History

2016-02-18 18:24:26 +03:00
MalTypes
MalReader
READ := method(str, MalReader read_str(str))
EVAL := method(ast, env, ast)
PRINT := method(exp, exp malPrint(true))
RE := method(str, EVAL(READ(str), nil))
REP := method(str, PRINT(RE(str)))
loop(
line := MalReadline readLine("user> ")
if(line isNil, break)
if(line isEmpty, continue)
e := try(REP(line) println)
e catch(Exception,
2016-03-03 23:03:06 +03:00
("Error: " .. (e error)) println
2016-02-18 18:24:26 +03:00
)
)