1
1
mirror of https://github.com/kanaka/mal.git synced 2024-08-17 17:50:24 +03:00
mal/impls/sml/step1_read_print.sml
2021-05-02 17:35:40 -05:00

28 lines
479 B
Standard ML

fun read s =
readStr s
fun eval f =
f
fun print f =
prReadableStr f
fun rep s =
s |> read |> eval |> print
handle SyntaxError msg => "SYNTAX ERROR: " ^ msg
| Nothing => ""
fun repl () =
let open TextIO
in (
print("user> ");
case inputLine(stdIn) of
SOME(line) => (
print(rep(line) ^ "\n");
repl ()
)
| NONE => ()
) end
fun main () = repl ()