aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sjit.icl4
1 files changed, 3 insertions, 1 deletions
diff --git a/sjit.icl b/sjit.icl
index 7a01d2e..6b94745 100644
--- a/sjit.icl
+++ b/sjit.icl
@@ -145,6 +145,7 @@ where
Just i -> ([PushRef (i-cs.sp)], {cs & sp=cs.sp+1, pc=cs.pc+1})
Nothing -> abort "undefined variable\n"
expr (App f args) cs
+ # args = if (args=:[]) [Int 0] args
# (iss,cs) = mapSt expr args {cs & sp=cs.sp+1}
= case get f cs.funs of
Just f -> ([Pop (length args-1):Call f:flatten iss], {cs & sp=cs.sp+2-length args, pc=cs.pc+2})
@@ -267,5 +268,6 @@ where
comp_state =: compile_all Nothing
[ {fun_name="id", fun_args=["x"], fun_expr=Var "x"}
, {fun_name="const", fun_args=["x","y"], fun_expr=Var "x"}
- , {fun_name="main", fun_args=[], fun_expr=App "+" [App "const" [Int 37, Int 10], App "const" [Int 5, Int 10]]}
+ , {fun_name="seven", fun_args=[], fun_expr=App "const" [Int 7, Int 10]}
+ , {fun_name="main", fun_args=[], fun_expr=App "+" [App "seven" [], App "const" [Int 5, Int 10]]}
]