-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTypesAST_for_Interpreter.fs
49 lines (44 loc) · 1.09 KB
/
TypesAST_for_Interpreter.fs
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
// This file implements a module where we define a data type "expr"
// to store represent arithmetic expressions
module TypesAST
type VarX = string
type AExp =
| Num of int
| TimesExpr of (AExp * AExp)
| DivExpr of (AExp * AExp)
| PlusExpr of (AExp * AExp)
| MinusExpr of (AExp * AExp)
| PowExpr of (AExp * AExp)
| UPlusExpr of (AExp)
| UMinusExpr of (AExp)
| Xval of (VarX)
| ArrayExpr of (string * AExp)
type BExp =
| BitAndB of BExp * BExp
| BitOrB of BExp * BExp
| LogAndB of BExp * BExp
| LogOrB of BExp * BExp
| LogNotB of BExp
| BEqual of AExp * AExp
| NotEqualB of AExp * AExp
| GThanB of AExp * AExp
| LThanB of AExp * AExp
| GEThanB of AExp * AExp
| LEThanB of AExp * AExp
| WutT // true
| WutF // false
type CExp =
|AssignC of (VarX * AExp)
|AssignArrayC of (VarX * AExp * AExp)
|SkipC
|StateC of (CExp *CExp)
|IfStateC of (GCExp)
|DoloopC of (GCExp)
and GCExp =
| ARROWGC of (BExp * CExp)
| StateGC of (GCExp *GCExp)
type LabelPG =
|MemUpdate of (VarX * AExp)
|SkipPG
|CheckBol of BExp
|MemUpdateArray of (VarX * AExp * AExp)