-
Notifications
You must be signed in to change notification settings - Fork 0
/
TigerTree.hs
46 lines (39 loc) · 1009 Bytes
/
TigerTree.hs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
module TigerTree where
import qualified TigerTemp as Temp
import Prelude hiding ( EQ
, GT
, LT
)
data Exp
= Const Int
| Name Temp.Label
| Temp Temp.Temp
| Binop BOp Exp Exp
| Mem Exp
| Call Exp [Exp]
| Eseq Stm Exp
deriving Show
data Stm
= Move Exp Exp
| ExpS Exp
| Jump Exp Temp.Label
| CJump Relop Exp Exp Temp.Label Temp.Label
| Seq Stm Stm
| Label Temp.Label
deriving Show
data BOp = Plus | Minus | Mul | Div | And | Or | LShift | RShift
| ARShift | XOr
deriving Show
data Relop = EQ | NE | LT | GT | LE | GE | ULT | ULE | UGT | UGE
deriving Show
notRel :: Relop -> Relop
notRel EQ = NE
notRel NE = EQ
notRel LT = GE
notRel GE = LT
notRel GT = LE
notRel LE = GT
notRel ULT = UGE
notRel UGE = ULT
notRel ULE = UGT
notRel UGT = ULE