-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAbsAssignment.hs
75 lines (61 loc) · 1.21 KB
/
AbsAssignment.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
module AbsAssignment where
-- Haskell module generated by the BNF converter
newtype Ident = Ident String deriving (Eq,Ord,Show,Read)
data Program =
PBlocks [Block]
deriving (Eq,Ord,Show,Read)
data Block =
BStm1 Stm
| BStms [Stm]
deriving (Eq,Ord,Show,Read)
data Par =
Para Type Ident
deriving (Eq,Ord,Show,Read)
data Fun =
Func Type Ident [Par] Block
deriving (Eq,Ord,Show,Read)
data Stm =
SFunc Fun
| SExp Exp
| SValDec Type [Ident]
| SValInit Type [Exp]
| SReturn Exp
| SReturnE
| SWhile Exp Block
| SIfElse Exp Block Block
| SPrint Exp
deriving (Eq,Ord,Show,Read)
data Type =
TypeBool
| TypeInt
| TypeDouble
| TypeString
| TypeVoid
deriving (Eq,Ord,Show,Read)
data Exp =
EAssign Ident Exp
| EDisjunction Exp Exp
| EConjunction Exp Exp
| EEq Exp Exp
| ENeq Exp Exp
| EGt Exp Exp
| ELt Exp Exp
| EGte Exp Exp
| ELte Exp Exp
| EAdd Exp Exp
| ESub Exp Exp
| EMul Exp Exp
| EDiv Exp Exp
| ENeg Exp
| EPreInc Exp
| EPreDec Exp
| EPostInc Exp
| EPostDec Exp
| EId Ident
| EInt Integer
| ETrue
| EFalse
| EDouble Double
| EString String
| EFunc Ident [Exp]
deriving (Eq,Ord,Show,Read)