mirror of
https://github.com/kanaka/mal.git
synced 2024-11-11 00:52:44 +03:00
dd7a4f55f3
Fixes made to: ada, c, chuck, clojure, coffee, common-lisp, cpp, crystal, d, dart, elm, erlang, es6, factor, fsharp, gnu-smalltalk, groovy, guile, haxe, hy, js, livescript, matlab, miniMAL, nasm, nim, objc, objpascal, ocaml, perl, perl6, php, plsql, ps, python, r, rpython, ruby, scheme, swift3, tcl, ts, vb, vimscript, wasm, yorick. Catchless try* test is an optional test. Not all implementations support catchless try* but a number were fixed so they at least don't crash on catchless try*.
37 lines
748 B
Haxe
37 lines
748 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("Error: " + exc);
|
|
}
|
|
}
|
|
}
|
|
}
|