faculty
authorMart Lubbers <mart@martlubbers.net>
Thu, 26 May 2016 14:40:56 +0000 (16:40 +0200)
committerMart Lubbers <mart@martlubbers.net>
Thu, 26 May 2016 14:40:56 +0000 (16:40 +0200)
examples/test.spl
gen.icl

index 4a4ec5c..f2b86b8 100644 (file)
@@ -25,4 +25,6 @@ times(x, y){
 main(){
        [Int] l1 = 1 : 2 : 3 : 4 : 5 : [];
        foldr(times, 1, l1);
+       print("faculty of 5 is: ");
+       print(foldr(times, 1, l1));
 }
diff --git a/gen.icl b/gen.icl
index dad680f..48ec099 100644 (file)
--- a/gen.icl
+++ b/gen.icl
@@ -199,8 +199,9 @@ funnyStuff k es fs = getAdressbook >>= \ab->case 'Map'.get k ab of
                (       mapM_ g es
                        >>| getAdressbook >>= \ab->(case 'Map'.get k ab of
                                Nothing = liftT (Left $ Error $ concat ["PANIC: ", k, " not found as function"])
-                               Just (LAB t _ _) = tell [Instr instr [L t] (k +++"()")]
-                               Just (ADDR t arity) = lift (Left $ Error "NO ADDRESS JUMPING FFS")
+                               Just (LAB t _ _) = tell [Instr "bsr" [L t] (k +++"()")]
+                               Just (ADDR t arity) = liftT (Left $ Error "NO ADDRESS JUMPING FFS")
+                       )
                >>| tell 
                                [Instr "ajs" [Lit $ ~(length es)] "Clean arguments"
                                ,Instr "ldr" [Raw "RR"] ""])