signature PARSER = sig structure P: PPC structure D: DYNARRAY type ctx type nid = int datatype ctype = unknown_t | void_t | char_t | uchar_t | short_t | ushort_t | int_t | uint_t | long_t | ulong_t | longlong_t | ulonglong_t | pointer_t of int * ctype | function_t of ctype * ctype list * bool | array_t of Word64.word * ctype | struct_t of { name: nid, size: word, alignment: word, fields: (nid * word * ctype) list } | union_t of { name: nid, size: word, alignment: word, fields: (nid * word * ctype) list } | enum_t of nid * bool | (* is complete? *) remote_t of int datatype unop = UnopPreInc | UnopPreDec | UnopAddr | UnopDeref | UnopPos | UnopNeg | UnopComp | UnopLogNeg | UnopSizeof | UnopCast | UnopPostInc | UnopPostDec and binopReg = BrSubscript | BrMul | BrDiv | BrMod | BrSum | BrSub | BrShiftLeft | BrShiftRight | BrGreater | BrLess | BrLessEqual | BrGreaterEqual | BrEqual | BrNotEqual | BrBitAnd | BrBitXor | BrBitOr | BrLogAnd | BrLogOr | BrAssign | BrMulAssign | BrDivAssign | BrModAssign | BrSumAssign | BrSubAssign | BrLeftShiftAssign | BrRightShiftAssign | BrBitAndAssign | BrBitXorAssign | BrBitOrAssign | BrComma and cnum = Ninteger of Word64.word | Nfloat of Real32.real | Ndouble of Real64.real and id = Lid of int | Gid of int * bool and expr = Eid of int * id option | Econst of int * cnum | Estrlit of int | EmemberByV of exprAug * int | EmemberByP of exprAug * int | EfuncCall of exprAug * exprAug list | Eternary of exprAug * exprAug * exprAug | EsizeofType of ctype | Eunop of unop * exprAug | Ebinop of binop * exprAug * exprAug and exprAug = EA of expr * P.tkPos * bool * ctype and binop = BR of binopReg | BinopTernaryIncomplete of exprAug datatype linkage = LinkInternal | LinkExternal val iniLayouts: (bool * word * { offset: word, t: ctype, value: word } list) D.t datatype cini = CiniExpr of exprAug | CiniLayout of int type objDef = int * P.tkPos * ctype * cini * linkage datatype stmt = StmtExpr of exprAug | StmtCompound of (int * cini option) list * stmt list | StmtIf of exprAug * stmt * stmt option | StmtFor of exprAug option * exprAug option * exprAug option * stmt | StmtWhile of exprAug * stmt | StmtDoWhile of stmt * exprAug | StmtReturn of exprAug option | StmtBreak | StmtNone | StmtContinue type funcInfo = { name: int, pos: P.tkPos, t: ctype, paramNum: int, localVars: { name: nid, pos: P.tkPos, onStack: bool, t: ctype } vector, stmt: stmt } datatype declClass = DeclRegular | DeclTentative | DeclDefined type decl = P.tkPos * declClass * ctype * linkage (* Objects are in reverse order *) datatype def = Objects of objDef list | Definition of funcInfo val createCtx: string -> string list -> ctx val parseDef: ctx -> bool * ctx val printDef: def -> unit val alignOfType: ctype -> word val sizeOfType: ctype -> word val isSigned: ctype -> bool val isPointer: ctype -> bool val pointsTo: ctype -> ctype val isArray: ctype -> bool val typeRank: ctype -> int val resolveType: ctype -> ctype val commonType: ctype -> ctype -> ctype val getLayoutSize: int -> word val extz: word -> word -> word val exts: word -> word -> word val getT: exprAug -> ctype val funcParts: ctype -> ctype * ctype list val Pctype: (ctype, 'a, 'b, 'c) a1printer val getFieldInfo: ctype -> nid -> (word * ctype) option val finalize: ctx -> ctx type progInfo = { ext: nid list, glob: nid list, objsZI: objDef list, objs: objDef list, funcs: funcInfo list, strlits: int list } val explode: ctx -> progInfo end