haskell_RUNSTEP = ../$(2) $(3)
java_RUNSTEP = mvn -quiet exec:java -Dexec.mainClass="mal.$($(1))" -Dexec.args="--raw$(if $(3), $(3),)"
js_RUNSTEP = node ../$(2) $(3)
-lua_RUNSTEP = ../$(2) $(3)
+lua_RUNSTEP = ../$(2) --raw $(3)
make_RUNSTEP = make -f ../$(2) $(3)
mal_RUNSTEP = $(call $(MAL_IMPL)_RUNSTEP,$(1),$(call $(MAL_IMPL)_STEP_TO_PROG,stepA),../$(2),") #"
ocaml_RUNSTEP = ../$(2) $(3)
of iterations per second
- redefine (defmacro!) as (def! (macro*))
- runtest expect fixes:
+ - fix C#, VB and Lua
* stop using expect, so we can drop --raw option
- fix long line splitting in runtest
- regular expression matching in runtest
function prn(...)
print(table.concat(
utils.map(function(e) return _pr_str(e, true) end, arg), " "))
+ io.flush()
return Nil
end
function println(...)
print(table.concat(
utils.map(function(e) return _pr_str(e, false) end, arg), " "))
+ io.flush()
return Nil
end
local history_loaded = false
local history_file = os.getenv("HOME") .. "/.mal-history"
+M.raw = false
+
function M.readline(prompt)
if not history_loaded then
history_loaded = true
end
end
- line = LN.linenoise(prompt)
+ if M.raw then
+ io.write(prompt); io.flush();
+ line = io.read()
+ else
+ line = LN.linenoise(prompt)
+ end
if line then
LN.historyadd(line)
local f = io.open(history_file, "a")
return PRINT(EVAL(READ(str),""))
end
+if #arg > 0 and arg[1] == "--raw" then
+ readline.raw = true
+end
+
while true do
line = readline.readline("user> ")
if not line then break end
return PRINT(EVAL(READ(str),repl_env))
end
+if #arg > 0 and arg[1] == "--raw" then
+ readline.raw = true
+end
+
while true do
line = readline.readline("user> ")
if not line then break end
repl_env:set(types.Symbol:new('*'), function(a,b) return a*b end)
repl_env:set(types.Symbol:new('/'), function(a,b) return math.floor(a/b) end)
+if #arg > 0 and arg[1] == "--raw" then
+ readline.raw = true
+end
+
while true do
line = readline.readline("user> ")
if not line then break end
-- core.mal: defined using mal
rep("(def! not (fn* (a) (if a false true)))")
+if #arg > 0 and arg[1] == "--raw" then
+ readline.raw = true
+end
+
while true do
line = readline.readline("user> ")
if not line then break end
-- core.mal: defined using mal
rep("(def! not (fn* (a) (if a false true)))")
+if #arg > 0 and arg[1] == "--raw" then
+ readline.raw = true
+end
+
while true do
line = readline.readline("user> ")
if not line then break end
rep("(def! not (fn* (a) (if a false true)))")
rep("(def! load-file (fn* (f) (eval (read-string (str \"(do \" (slurp f) \")\")))))")
+if #arg > 0 and arg[1] == "--raw" then
+ readline.raw = true
+ table.remove(arg,1)
+end
+
if #arg > 0 then
rep("(load-file \""..arg[1].."\")")
os.exit(0)
rep("(def! not (fn* (a) (if a false true)))")
rep("(def! load-file (fn* (f) (eval (read-string (str \"(do \" (slurp f) \")\")))))")
+if #arg > 0 and arg[1] == "--raw" then
+ readline.raw = true
+ table.remove(arg,1)
+end
+
if #arg > 0 then
rep("(load-file \""..arg[1].."\")")
os.exit(0)
rep("(defmacro! cond (fn* (& xs) (if (> (count xs) 0) (list 'if (first xs) (if (> (count xs) 1) (nth xs 1) (throw \"odd number of forms to cond\")) (cons 'cond (rest (rest xs)))))))")
rep("(defmacro! or (fn* (& xs) (if (empty? xs) nil (if (= 1 (count xs)) (first xs) `(let* (or_FIXME ~(first xs)) (if or_FIXME or_FIXME (or ~@(rest xs))))))))")
+if #arg > 0 and arg[1] == "--raw" then
+ readline.raw = true
+ table.remove(arg,1)
+end
+
if #arg > 0 then
rep("(load-file \""..arg[1].."\")")
os.exit(0)
rep("(defmacro! cond (fn* (& xs) (if (> (count xs) 0) (list 'if (first xs) (if (> (count xs) 1) (nth xs 1) (throw \"odd number of forms to cond\")) (cons 'cond (rest (rest xs)))))))")
rep("(defmacro! or (fn* (& xs) (if (empty? xs) nil (if (= 1 (count xs)) (first xs) `(let* (or_FIXME ~(first xs)) (if or_FIXME or_FIXME (or ~@(rest xs))))))))")
+function print_exception(exc)
+ if exc then
+ if types._malexception_Q(exc) then
+ exc = printer._pr_str(exc.val, true)
+ end
+ print("Error: " .. exc)
+ print(debug.traceback())
+ end
+end
+
+if #arg > 0 and arg[1] == "--raw" then
+ readline.raw = true
+ table.remove(arg,1)
+end
+
if #arg > 0 then
- rep("(load-file \""..arg[1].."\")")
+ xpcall(function() rep("(load-file \""..arg[1].."\")") end,
+ print_exception)
os.exit(0)
end
while true do
line = readline.readline("user> ")
if not line then break end
- xpcall(function()
- print(rep(line))
- end, function(exc)
- if exc then
- if types._malexception_Q(exc) then
- exc = printer._pr_str(exc.val, true)
- end
- print("Error: " .. exc)
- print(debug.traceback())
- end
- end)
+ xpcall(function() print(rep(line)) end,
+ print_exception)
end
end
end
+if #arg > 0 and arg[1] == "--raw" then
+ readline.raw = true
+ table.remove(arg,1)
+end
+
if #arg > 0 then
xpcall(function() rep("(load-file \""..arg[1].."\")") end,
print_exception)