-
Notifications
You must be signed in to change notification settings - Fork 0
/
AbsCinnabar.hs
71 lines (55 loc) · 1.41 KB
/
AbsCinnabar.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
module AbsCinnabar where
-- Haskell module generated by the BNF converter
newtype Ident = Ident String deriving (Eq, Ord, Show, Read)
data Program = Prog [Stmt]
deriving (Eq, Ord, Show, Read)
data Block = SBlock [Stmt]
deriving (Eq, Ord, Show, Read)
data Stmt
= SWhile Expr Block
| SCond Expr Block
| SCondElse Expr Block Block
| SAssign LVal Expr
| SReturn Expr
| SPrint Expr
| SAssert Expr
| SExpr Expr
deriving (Eq, Ord, Show, Read)
data LVal
= ATuple [LVal] | AAt Expr Expr | AMember Expr Ident | AVar Ident
deriving (Eq, Ord, Show, Read)
data Expr
= ELambda [Ident] Expr
| EFun [Ident] Block
| EIf Expr Expr Expr
| EOr Expr Expr
| EAnd Expr Expr
| ERel Expr RelOp Expr
| EAdd Expr AddOp Expr
| EMul Expr MulOp Expr
| EPow Expr Expr
| ENot Expr
| ENeg Expr
| ECall Expr [Expr]
| EMember Expr Ident
| EAt Expr Expr
| EExtend Expr Expr
| ENew Expr
| EChar Char
| EString String
| ELitInt Integer
| ELitTrue
| ELitFalse
| EVar Ident
| EList [Expr]
| EListComp Expr LVal Expr
| EDict [DictMap]
deriving (Eq, Ord, Show, Read)
data DictMap = EDictMap Expr Expr
deriving (Eq, Ord, Show, Read)
data RelOp = Lt | Le | Gt | Ge | Eq | Ne
deriving (Eq, Ord, Show, Read)
data AddOp = Add | Sub
deriving (Eq, Ord, Show, Read)
data MulOp = Mul | Div | Mod
deriving (Eq, Ord, Show, Read)