Haxe: add C++, JS, Neko targets. Make neko default.
[jackhill/mal.git] / haxe / Step3_env.hx
index 1976c4b..8f39832 100644 (file)
@@ -1,3 +1,4 @@
+import Compat;
 import types.Types.MalType;
 import types.Types.*;
 import reader.*;
@@ -80,25 +81,21 @@ class Step3_env {
     }
 
     public static function main() {
-        #if js
-            #error "JS not supported yet"
-        #end
         repl_env.set(MalSymbol("+"), NumOp(function(a,b) {return a+b;}));
         repl_env.set(MalSymbol("-"), NumOp(function(a,b) {return a-b;}));
         repl_env.set(MalSymbol("*"), NumOp(function(a,b) {return a*b;}));
         repl_env.set(MalSymbol("/"), NumOp(function(a,b) {return Std.int(a/b);}));
         while (true) {
             try {
-                Sys.print("user> ");
-                var line = Sys.stdin().readLine();
+                var line = Compat.readline("user> ");
                 if (line == "") { continue; }
-                Sys.println(rep(line));
+                Compat.println(rep(line));
             } catch (exc:BlankLine) {
                 continue;
             } catch (exc:haxe.io.Eof) {
-                Sys.exit(0);
+                Compat.exit(0);
             } catch (exc:Dynamic) {
-                Sys.println(exc);
+                Compat.println(exc);
             }
         }
     }