2016-11-14 01:21:44 +03:00
|
|
|
import 'dart:io';
|
|
|
|
|
|
|
|
import 'printer.dart' as printer;
|
|
|
|
import 'reader.dart' as reader;
|
|
|
|
import 'types.dart';
|
|
|
|
|
|
|
|
MalType READ(String x) => reader.read_str(x);
|
|
|
|
|
|
|
|
MalType EVAL(MalType x) => x;
|
|
|
|
|
|
|
|
String PRINT(MalType x) => printer.pr_str(x);
|
|
|
|
|
|
|
|
String rep(String x) {
|
Test uncaught throw, catchless try* . Fix 46 impls.
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*.
2018-12-03 22:20:44 +03:00
|
|
|
return PRINT(EVAL(READ(x)));
|
2016-11-14 01:21:44 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
const prompt = 'user> ';
|
|
|
|
main() {
|
|
|
|
while (true) {
|
|
|
|
stdout.write(prompt);
|
|
|
|
var input = stdin.readLineSync();
|
|
|
|
if (input == null) return;
|
|
|
|
var output;
|
|
|
|
try {
|
|
|
|
output = rep(input);
|
Test uncaught throw, catchless try* . Fix 46 impls.
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*.
2018-12-03 22:20:44 +03:00
|
|
|
} on reader.ParseException catch (e) {
|
|
|
|
stdout.writeln("Error: '${e.message}'");
|
|
|
|
continue;
|
2016-11-14 01:21:44 +03:00
|
|
|
} on reader.NoInputException {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
stdout.writeln(output);
|
|
|
|
}
|
|
|
|
}
|