-
Notifications
You must be signed in to change notification settings - Fork 1
/
TigerTree.hs
43 lines (36 loc) · 847 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
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 (Eq,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 (Eq,Show)
data BOp = Plus | Minus | Mul | Div | And | Or | LShift | RShift
| ARShift | XOr
deriving (Eq,Show)
data Relop = EQ | NE | LT | GT | LE | GE | ULT | ULE | UGT | UGE
deriving (Eq,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