From 5b98614f91d22a47f6e089329336acd727d56fb5 Mon Sep 17 00:00:00 2001 From: pimjager Date: Sun, 8 May 2016 18:46:26 +0200 Subject: [PATCH] Added generationf or expressions, how to deal with lists and tuples? --- gen.icl | 5 +++++ 1 file changed, 5 insertions(+) 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 -- 2.20.1