From: Mart Lubbers Date: Thu, 26 May 2016 14:40:56 +0000 (+0200) Subject: faculty X-Git-Url: https://git.martlubbers.net/?a=commitdiff_plain;h=c2880afc3725715c3a798634228cb6c01b8aec3d;p=cc1516.git faculty --- diff --git a/examples/test.spl b/examples/test.spl index 4a4ec5c..f2b86b8 100644 --- a/examples/test.spl +++ b/examples/test.spl @@ -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 --- 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"] ""])