repositories
/
cc1516.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
a704ddf
)
Added generationf or expressions, how to deal with lists and tuples?
author
pimjager
<pim@pimjager.nl>
Sun, 8 May 2016 16:46:26 +0000
(18:46 +0200)
committer
pimjager
<pim@pimjager.nl>
Sun, 8 May 2016 16:46:26 +0000
(18:46 +0200)
gen.icl
patch
|
blob
|
history
diff --git
a/gen.icl
b/gen.icl
index
06d2b13
..
d0ec628
100644
(file)
--- 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 (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
op2ins :: Op2 -> String
op2ins op = case op of