From: pimjager Date: Sun, 8 May 2016 16:46:26 +0000 (+0200) Subject: Added generationf or expressions, how to deal with lists and tuples? X-Git-Url: https://git.martlubbers.net/?a=commitdiff_plain;h=5b98614f91d22a47f6e089329336acd727d56fb5;p=cc1516.git Added generationf or expressions, how to deal with lists and tuples? --- diff --git a/gen.icl b/gen.icl index 06d2b13..d0ec628 100644 --- a/gen.icl +++ b/gen.icl @@ -65,6 +65,11 @@ instance g Expr where g (BoolExpr _ True) = loadP (LDC TRUE) >>= \instr-> tell [instr] g (BoolExpr _ False) = loadP (LDC FALSE) >>= \instr-> tell [instr] g (Op2Expr _ e1 op e2) = g e1 >>| g e2 >>| tell [Instr (op2ins op) [] ""] + g (Op1Expr _ UnNegation e) = g e >>| tell [Instr "not" [] ""] + g (Op1Expr _ UnMinus e) = g e >>| tell [Instr "neg" [] ""] + g (EmptyListExpr _) = abort "Shit, empty list expr" + g (TupleExpr p (e1,e2)) = abort "How to deal with tuples?" + g (FunExpr _ k es fs) = mapM g es >>| jump "bra" k >>= \instr-> tell [instr] op2ins :: Op2 -> String op2ins op = case op of