-
Notifications
You must be signed in to change notification settings - Fork 0
/
ast.mli
64 lines (48 loc) · 1.71 KB
/
ast.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
64
open Analysis
(* Arbres de syntaxe abstraite *)
type ('info, 'node) node = { info : 'info;
node : 'node }
type loc = Lexing.position * Lexing.position
type ident = (loc, string) node
type signedness = Signed | Unsigned
type num_type = Char | Short | Int | Long
type c_type =
| Tnull (* pour typer null *)
| Tvoid
| Tinteger of signedness * num_type
| Tdouble
| Tstruct of ident
| Tpointer of c_type
type constant =
| Cint of signedness * num_type * int64
| Cdouble of float
| Cstring of string
type binop = Add | Mult | Minus | Div | Mod | And | Or | Eq | Neq | Lt | Le | Gt | Ge | Dot | Arrow
type unop = Neg | Deref | Pos | Addr | PreInc | PreDec | PostInc | PostDec | Not
type 'info expr = ('info, 'info expr_node) node
and 'info expr_node =
| Econst of constant
| Eident of ident
| Esizeof of c_type
| Ebinop of 'info expr * binop * 'info expr
| Eunop of unop * 'info expr
| Ecall of ident * 'info expr list
| Egetarr of 'info expr * 'info expr
| Eassign of 'info expr * 'info expr
| Ecast of c_type * 'info expr
type var_decl = c_type * ident
type 'info statement = ('info, 'info statement_node) node
and 'info statement_node =
| Sskip
| Sexpr of ('info expr)
| Sblock of ('info block)
| Sif of ('info expr) * ('info statement) * ('info statement) option
| Sfor of ('info expr list) option * ('info expr option) * ('info expr list) option * ('info statement)
| Sreturn of ('info expr) option
and 'info block =
var_decl list * 'info statement list
type 'info decl =
| Dfun of c_type * ident * var_decl list * ('info block option) * fun_analyse
| Dvar of var_decl
| Dstruct of ident * var_decl list
type 'info file = 'info decl list