-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathptree.mli
63 lines (48 loc) · 1.06 KB
/
ptree.mli
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
type loc = Lexing.position * Lexing.position
type ident = { id: string; id_loc: loc }
type typ =
| Tint
| Tstructp of ident
type unop =
| Unot | Uminus
type binop =
| Beq | Bneq | Blt | Ble | Bgt | Bge | Badd | Bsub | Bmul | Bdiv
| Band | Bor
type expr =
{ expr_node: expr_node;
expr_loc : loc }
and expr_node =
| Econst of int32
| Eright of lvalue
| Eassign of lvalue * expr
| Eunop of unop * expr
| Ebinop of binop * expr * expr
| Ecall of ident * expr list
| Esizeof of ident
and lvalue =
| Lident of ident
| Larrow of expr * ident
type decl_var = typ * ident
type stmt =
{ stmt_node: stmt_node;
stmt_loc : loc }
and stmt_node =
| Sskip
| Sexpr of expr
| Sif of expr * stmt * stmt
| Swhile of expr * stmt
| Sblock of block
| Sreturn of expr
and block =
decl_var list * stmt list
type decl_struct = ident * decl_var list
type decl_fun = {
fun_typ : typ;
fun_name : ident;
fun_formals : decl_var list;
fun_body : block
}
type decl =
| Dstruct of decl_struct
| Dfun of decl_fun
type file = decl list