module Tast:sig..end
Typed syntax trees
typeunop =Ast.unop
typebinop =Ast.binop
typeconstant =Ast.constant
typeincdec =Ast.incdec
type function_ = {
|
fn_name : |
|
fn_params : |
|
fn_typ : |
}
type structure = {
|
s_name : |
|||
|
s_fields : |
|||
|
mutable s_list : |
|||
|
mutable s_size : |
(* | total size in bytes | *) |
}
type typ =
| |
Tint |
|||
| |
Tbool |
|||
| |
Tstring |
|||
| |
Tstruct of |
|||
| |
Tptr of |
|||
| |
Tnil |
(* | to type nil | *) |
| |
Tmany of |
(* | when 0 or >= 2 return types | *) |
type var = {
|
v_name : |
|||
|
v_id : |
(* | unique | *) |
|
v_loc : |
|||
|
v_typ : |
|||
|
mutable v_used : |
|||
|
mutable v_addr : |
(* | means &x is used somewhere | *) |
|
mutable v_ofs : |
(* | relative to %rbp | *) |
}
type field = {
|
f_name : |
|||
|
f_typ : |
|||
|
mutable f_ofs : |
(* | relative to the start of the structure | *) |
}
type expr = {
|
expr_desc : |
|
expr_typ : |
}
type expr_desc =
| |
TEskip |
| |
TEconstant of |
| |
TEbinop of |
| |
TEunop of |
| |
TEnil |
| |
TEnew of |
| |
TEcall of |
| |
TEident of |
| |
TEdot of |
| |
TEassign of |
| |
TEvars of |
| |
TEif of |
| |
TEreturn of |
| |
TEblock of |
| |
TEfor of |
| |
TEprint of |
| |
TEincdec of |
type tdecl =
| |
TDfunction of |
| |
TDstruct of |
typetfile =tdecl list