mirror of
https://github.com/kanaka/mal.git
synced 2024-11-11 00:52:44 +03:00
034e82adc5
See http://skew-lang.org/ for details on the Skew language. Currently Mal only compiles to Javascript, as there are some issues with the C# backend for Skew (https://github.com/evanw/skew/issues/19). Tested with Skew 0.7.42.
30 lines
479 B
Plaintext
30 lines
479 B
Plaintext
def READ(str string) MalVal {
|
|
return read_str(str)
|
|
}
|
|
|
|
def EVAL(ast MalVal, env StringMap<string>) MalVal {
|
|
return ast
|
|
}
|
|
|
|
def PRINT(exp MalVal) string {
|
|
return exp?.print(true)
|
|
}
|
|
|
|
def REP(str string) string {
|
|
return PRINT(EVAL(READ(str), {}))
|
|
}
|
|
|
|
@entry
|
|
def main {
|
|
var line string
|
|
while (line = readLine("user> ")) != null {
|
|
if line == "" { continue }
|
|
try {
|
|
printLn(REP(line))
|
|
}
|
|
catch e MalError {
|
|
printLn("Error: \(e.message)")
|
|
}
|
|
}
|
|
}
|