-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAST.hs
41 lines (32 loc) · 1.06 KB
/
AST.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
module AST where
import Data.Either
type Refine = Either String Exp
data Statement = VarStatement [(String, Maybe Exp)]
| Statements Statements
type Statements = [(Maybe String, LStatement)]
data LStatement = Exp Exp
| Disrupt Disrupter
| IfStmt Exp Statements Statements
-- put switch in
| While Exp Statements
| ForIn String Exp Statements
| For (Maybe Exp) (Maybe Exp) (Maybe Exp) Statements
| Do Statements Exp
data Disrupter = Break (Maybe String)
| Return Exp
| Throw Exp
data Exp = NumLit Double
| StrLit String
| ObjLit [(String,Exp)]
| Var String
| Unop Unop Exp
| Binop Exp Binop Exp
| Refine Exp Refine
| Application Exp [Exp]
| New Exp [Exp]
| Delete Exp Refine
data Unop = TypeOf
| ToNum
| Negate
| Not
data Binop = Times | Div | Mod | Add | Sub | GEq | LEq | GE | LE | Eq | Or | And