Module Ast_c

type tok = Parse_info.t
type 'a wrap = 'a * tok
type 'a bracket = tok * 'a * tok
type name = string wrap
type type_ =
| TBase of name
| TPointer of tok * type_
| TArray of const_expr option * type_
| TFunction of function_type
| TStructName of struct_kind * name
| TEnumName of name
| TTypeName of name
and function_type = type_ * parameter list
and parameter = {
p_type : type_;
p_name : name option;
}
and struct_kind =
| Struct
| Union
and expr =
| Int of string wrap
| Float of string wrap
| String of string wrap
| Char of string wrap
| Id of name
| Call of expr * argument list
| Assign of Cst_cpp.assignOp * expr * expr
| ArrayAccess of expr * expr
| RecordPtAccess of expr * tok * name
| Cast of type_ * expr
| Postfix of expr * Cst_cpp.fixOp wrap
| Infix of expr * Cst_cpp.fixOp wrap
| Unary of expr * Cst_cpp.unaryOp wrap
| Binary of expr * Cst_cpp.binaryOp wrap * expr
| CondExpr of expr * expr * expr
| Sequence of expr * expr
| SizeOf of (exprtype_) Common.either
| ArrayInit of (expr option * expr) list bracket
| RecordInit of (name * expr) list bracket
| GccConstructor of type_ * expr
| Ellipses of tok
and argument = expr
and const_expr = expr
type stmt =
| ExprSt of expr
| Block of stmt list
| If of tok * expr * stmt * stmt
| Switch of tok * expr * case list
| While of tok * expr * stmt
| DoWhile of tok * stmt * expr
| For of tok * expr option * expr option * expr option * stmt
| Return of tok * expr option
| Continue of tok
| Break of tok
| Label of name * stmt
| Goto of tok * name
| Vars of var_decl list
| Asm of expr list
and case =
| Case of tok * expr * stmt list
| Default of tok * stmt list
and var_decl = {
v_name : name;
v_type : type_;
v_storage : storage;
v_init : initialiser option;
}
and initialiser = expr
and storage =
| Extern
| Static
| DefaultStorage
type func_def = {
f_name : name;
f_type : function_type;
f_body : stmt list;
f_static : bool;
}
type struct_def = {
s_name : name;
s_kind : struct_kind;
s_flds : field_def list bracket;
}
and field_def = {
fld_name : name option;
fld_type : type_;
}
type enum_def = name * (name * const_expr option) list
type type_def = name * type_
type define_body =
| CppExpr of expr
| CppStmt of stmt
type toplevel =
| Include of tok * string wrap
| Define of name * define_body
| Macro of name * name list * define_body
| StructDef of struct_def
| TypeDef of type_def
| EnumDef of enum_def
| FuncDef of func_def
| Global of var_decl
| Prototype of func_def
type program = toplevel list
type any =
| Expr of expr
| Stmt of stmt
| Stmts of stmt list
| Type of type_
| Toplevel of toplevel
| Program of program
val str_of_name : ('a * 'b) -> 'a
val looks_like_macro : (string * 'a) -> bool
val unwrap : ('a * 'b) -> 'a