Commit | Line | Data |
---|---|---|
32d0a1cf JM |
1 | import Compat; |
2 | ||
6c4c14bd JM |
3 | class Step0_repl { |
4 | // READ | |
5 | static function READ(str:String) { | |
6 | return str; | |
7 | } | |
8 | ||
9 | // EVAL | |
10 | static function EVAL(ast:String, env:String) { | |
11 | return ast; | |
12 | } | |
13 | ||
14 | ||
15 | static function PRINT(exp:String) { | |
16 | return exp; | |
17 | } | |
18 | ||
19 | // repl | |
20 | static function rep(line:String) { | |
21 | return PRINT(EVAL(READ(line), "")); | |
22 | } | |
23 | ||
24 | public static function main() { | |
6c4c14bd JM |
25 | while (true) { |
26 | try { | |
32d0a1cf JM |
27 | var line = Compat.readline("user> "); |
28 | Compat.println(rep(line)); | |
6c4c14bd | 29 | } catch (exc:haxe.io.Eof) { |
32d0a1cf | 30 | Compat.exit(0); |
6c4c14bd | 31 | } catch (exc:Dynamic) { |
32d0a1cf | 32 | Compat.println(exc); |
6c4c14bd JM |
33 | } |
34 | } | |
35 | } | |
36 | } |