-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAbsshl.hs
93 lines (74 loc) · 1.57 KB
/
Absshl.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
module Absshl where
-- Haskell module generated by the BNF converter
newtype Ident = Ident String deriving (Eq,Ord,Show,Read)
data Prog =
Program Blk
deriving (Eq,Ord,Show,Read)
data Blk =
Block [Dec] [Stm]
deriving (Eq,Ord,Show,Read)
data Stm =
ForLoop Ident Exp Blk
| IfStmt Exp Blk
| IfElseStmt Exp Blk Blk
| ReturnStmt Exp
| PrintStmt Exp
| ExpStmt Exp
| AssignMultiple [AssM] [Exp]
deriving (Eq,Ord,Show,Read)
data AssM =
AssignVar Ident
| AssignArr Ident Exp
deriving (Eq,Ord,Show,Read)
data AssE =
AssignExp Exp
deriving (Eq,Ord,Show,Read)
data Dec =
Declaration Typ Ident
| DeclarationAssing Typ Ident Exp
| DeclarationFunc Typ Ident [FArg] Blk
| DeclarationArray Typ Ident Exp
deriving (Eq,Ord,Show,Read)
data FArg =
FArgument Typ Ident
| FArgumentAssing Typ Ident Exp
| FArgumentFunc Typ Ident [FArg]
| FArgumentRef Typ Ident
| FArgumentArr Typ Ident
deriving (Eq,Ord,Show,Read)
data Typ =
TInt
| TBool
| TString
deriving (Eq,Ord,Show,Read)
data Exp =
Eeq Exp Exp
| Eneq Exp Exp
| Elthen Exp Exp
| Egrthen Exp Exp
| Ele Exp Exp
| Ege Exp Exp
| Eplus Exp Exp
| Eminus Exp Exp
| Etimes Exp Exp
| Ediv Exp Exp
| Einc Ident
| Edec Ident
| Einvok Ident [IParam]
| Evar Ident
| Econst Constraint
| Elmb [FArg] Exp
| Earr Ident Exp
deriving (Eq,Ord,Show,Read)
data Constraint =
Eint Integer
| Ebool BoolT
| Estring String
deriving (Eq,Ord,Show,Read)
data BoolT =
Constraint_True
| Constraint_False
deriving (Eq,Ord,Show,Read)
data IParam =
InvokeParamater Exp
deriving (Eq,Ord,Show,Read)