Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- type c_fragment
- and pp_directive =
- {
- name : string;
- arg : string option;
- }
- and obj_macro =
- {
- name : string;
- defn : string;
- }
- and func_macro =
- {
- name : string;
- params : string list;
- defn : c_fragment list;
- }
- and func_decl =
- {
- static : bool;
- inline : bool;
- name : string;
- return_type : string;
- params : string list;
- }
- and func_call =
- {
- name : string;
- args : string list;
- term : bool;
- }
- and func_defn =
- {
- return_type : string;
- name : string;
- params : string list;
- defn : c_fragment list;
- }
- and unary_expr =
- {
- op : string;
- postfix : bool;
- prim : c_fragment list;
- }
- and binary_expr =
- {
- op : string;
- lhs : c_fragment list;
- rhs : c_fragment list;
- }
- and ternary_expr =
- {
- expr1 : c_fragment list;
- expr2 : c_fragment list option;
- expt3 : c_fragment list option;
- }
- and for_stmt =
- {
- var_init : c_fragment list option;
- cond_expr : c_fragment list option;
- step_stmt : c_fragment list option;
- body : c_fragment list option;
- }
- and while_stmt =
- {
- cond : c_fragment;
- body : c_fragment list;
- }
- and if_stmt =
- {
- cond : c_fragment;
- body : c_fragment list;
- }
- and else_stmt =
- {
- cond : c_fragment option;
- body : c_fragment list;
- }
- and do_while_stmt =
- {
- body : c_fragment;
- cond : c_fragment;
- }
- and case_stmt =
- {
- const_subject : string;
- body : c_fragment list;
- }
- and switch_stmt =
- {
- subject : string;
- cases : case_stmt list;
- }
- and var_init =
- {
- var_type : string;
- var_name : string;
- init_expr : c_fragment;
- }
- and array_init =
- {
- array_type : string;
- array_name : string;
- num_memb : int option;
- init_list : c_fragment list;
- }
- and designated_init =
- {
- array_type : string;
- array_name : string;
- num_memb : int option;
- designates : (string * c_fragment) list;
- }
- and literal =
- | IntegerLit of int
- | FloatLit of float
- | StringLit of string
- | CharLit of char
- | BoolLit of bool
- | NullLit
- | MacroConst of string
- | EnumConst of string
- and identifier =
- | IndexedIdent of string * int
- | UnindexedIdent of string * int
- | ReferencedIdent of string
- | DereferencedIdent of string
- and compound_literal =
- {
- type_name : string;
- init_fields : (string * c_fragment) list;
- }
- and assign_stmt =
- {
- lhs : string;
- rhs : c_fragment;
- }
- and struct_decl =
- {
- name : string option;
- fields : (string * string) list;
- alias : string option;
- }
- and enum_decl =
- {
- name : string option;
- values : (string * int option) list;
- alias : string option;
- }
- and typedef_decl =
- {
- alias : string;
- typedef_type : string;
- }
- type c_fragment =
- | PPDirective of pp_directive
- | ObjMacro of obj_macro
- | FuncMacro of func_macro
- | FuncDecl of func_decl
- | FuncDefn of func_defn
- | FuncCall of func_call
- | UnaryExpr of unary_expr
- | BinaryExpr of binary_expr
- | TernaryExpr of ternary_expr
- | ForStmt of for_stmt
- | WhileStmt of while_stmt
- | IfStmt of if_stmt
- | ElseStmt of else_stmt
- | DoWhileStmt of do_while_stmt
- | SwitchStmt of switch_stmt
- | AssignStmt of assign_stmt
- | VarInit of var_init
- | ArrayInit of array_init
- | DesignatedInit of designated_init
- | SimpleLiteral of literal
- | CompoundLiteral of compound_literal
- | StructDecl of struct_decl
- | EnumDecl of enum_decl
- | TypedefDecl of typedef_decl
- | Identifier of identifier
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement