mirror of
https://github.com/kanaka/mal.git
synced 2024-09-19 17:47:53 +03:00
4eb88ef295
Tested on UCBLogo 6.0 with some minor tweaks (for performance and adding a `timems` function). The tweaks are performed during Docker image creation (see Dockerfile). Tests of step 5 are skipped because UCBLogo is too slow. Interop is available via `(logo-eval "logo code to run")`. The `examples` directory contains a Mal example of drawing a tree using turtle graphics.
42 lines
627 B
Plaintext
42 lines
627 B
Plaintext
load "../logo/readline.lg
|
|
load "../logo/reader.lg
|
|
load "../logo/printer.lg
|
|
|
|
to _read :str
|
|
output read_str :str
|
|
end
|
|
|
|
to _eval :ast :env
|
|
output :ast
|
|
end
|
|
|
|
to _print :exp
|
|
output pr_str :exp "true
|
|
end
|
|
|
|
to rep :str
|
|
output _print _eval _read :str []
|
|
end
|
|
|
|
to repl
|
|
localmake "running "true
|
|
while [:running] [
|
|
localmake "line readline word "user> :space_char
|
|
ifelse :line=[] [
|
|
print "
|
|
make "running "false
|
|
] [
|
|
if not emptyp :line [
|
|
catch "error [print rep :line]
|
|
localmake "exception error
|
|
if not emptyp :exception [
|
|
(print "Error: first butfirst :exception)
|
|
]
|
|
]
|
|
]
|
|
]
|
|
end
|
|
|
|
repl
|
|
bye
|