1
1
mirror of https://github.com/kanaka/mal.git synced 2024-09-20 10:07:45 +03:00
mal/haxe/Step0_repl.hx

37 lines
736 B
Haxe

import Compat;
class Step0_repl {
// READ
static function READ(str:String) {
return str;
}
// EVAL
static function EVAL(ast:String, env:String) {
return ast;
}
// PRINT
static function PRINT(exp:String) {
return exp;
}
// repl
static function rep(line:String) {
return PRINT(EVAL(READ(line), ""));
}
public static function main() {
while (true) {
try {
var line = Compat.readline("user> ");
Compat.println(rep(line));
} catch (exc:haxe.io.Eof) {
Compat.exit(0);
} catch (exc:Dynamic) {
Compat.println(exc);
}
}
}
}