1      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~                              ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _ ` a b c d e f g h i j k l m n o p q r s t u v w x y z { | } ~                                                                                                                                                                   ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _ ` a b c d e f g h i j k l m n o p q r s t u v w x y z { | } ~                                                                                                                                                             ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _ ` a b c d e f g h i j k l m n o p q r s t u v w x y z { | } ~                                                                                                                                                 !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~&Q(c) [1995..1999] Manuel M. T. Chakravarty (c) 2008 Benedikt Huber BSD-stylebenedikt.huber@gmail.comalphaportableNone 16CKOV_ NameSpaceMap a is a Map from identifiers to a., which manages global and local name spaces.create a name spaceAdd global definition%(ns',oldDef) = defGlobal ns ident def adds a global definition  ident := def8 to the namespace. It returns the modified namespace ns'|. If the identifier is already declared in the global namespace, the definition is overwritten and the old definition oldDef is returned.Enter new local scopens' = enterNewScope ns& creates and enters a new local scope.Leave innermost local scope(ns',defs) = leaveScope nsE pops leaves the innermost local scope. and returns its definitionsAdd local definition$(ns',oldDef) = defLocal ns ident def adds the local definition  ident := def to the innermost local scope, if there is a local scope, and to the global scope otherwise. It returns the modified name space ns'+ and the old binding of the identifier oldDef, which is overwritten. Search for a definitiondef = find ns identI returns the definition in some scope (inner to outer), if there is one. %flatten a namespace into a assoc list [nameSpaceToList ns = (localDefInnermost ns ++ .. ++ localDefsOutermost ns) ++ globalDefs ns ZMerge two namespaces. If they disagree on the types of any variables, all bets are off.   (c) 2008,2011 Benedikt Huber BSD-stylebenedikt.huber@gmail.com experimentalghcNone 16CKOVh(b,is') = takeByte is# reads and removes the first byte b from the  is(c,is') = takeChar is( reads and removes the first character c from the  isreturn True# if the given input stream is emptystr = takeChars n is returns the first n= characters of the given input stream, without removing themread a file into an convert  to  convert a  to an  countLines1 returns the number of text lines in the given   (c) 2008 Benedikt Huber BSD-stylebenedikt.huber@gmail.com experimentalghcNone 16CKOVmName is a unique identifierreturn an infinite stream of s starting with nameId 0Gget the infinite stream of unique names starting from the given integerY(c) [1995..2000] Manuel M. T. Chakravarty [2008..2009] Benedikt Huber BSD-stylebenedikt.huber@gmail.com experimentalghcNone 16CKOV%4class of type which aggregate a source code location'Position and length of a token(/uniform representation of source file positions)(absolute offset in the preprocessed file*<row (line) in the original file. Affected by #LINE pragmas.+rcolumn in the preprocessed file. Inaccurate w.r.t. to the original file in the presence of preprocessor macros.(position in source file, including filesfile position information source fileincluding file, if any.8position absoluteOffset fileName lineNumber columnNumber initializes a Position using the given arguments/Uinitialize a Position to the start of the translation unit starting in the given file0returns True6 if the given position refers to an actual source file1.no position (for unknown position information)2returns True2 if the there is no position information available3%position attached to built-in objects4returns True5 if the given position refers to a builtin definition5!position used for internal errors6returns True" if the given position is internal7advance column8advance to next line9advance just the offset%&'()+*,-./0123456789()*+.',*+)-/0123456789%&%&()*+f(c) [1995..1999] Manuel M. T. Chakravarty (c) 2008 Benedikt Huber (stripped radically) BSD-stylebenedikt.huber@gmail.com experimentalghcNone 16CKOV EGa class for convenient access to the attributes of an attributed objectGParsed entity attributeJ.get the number of characters an AST node spansK-get the position and length of the last tokenOequality by nameQ:create a node with neither name nor positional informationRGreturn True if the node carries neither name nor positional informationS;| Given only a source position, create a new node attributeTbGiven a source position and the position and length of the last token, create a new node attributeUMGiven a source position and a unique name, create a new attribute identifierVGiven a source position, the position and length of the last token and a unique name, create a new attribute identifier. Strict inEFGIHJKLMNOPQRSTUVGHIQRSTUVPEFNMLKJOEFGHIQ(c) [1995..1999] Manuel M. T. Chakravarty (c) 2008 Benedikt Huber BSD-stylebenedikt.huber@gmail.com experimentalghcNone 16CKOV ` C identifiersbReferences uniquely determining a struct, union or enum type. Those are either identified by an string identifier, or by a unique name (anonymous types).e<Return true if the struct/union/enum reference is anonymous.f"build an identifier from a string.only minimal error checking, e.g., the characters of the identifier are not checked for being alphanumerical only; the correct lexis of the identifier should be ensured by the caller, e.g., the scanner.8for reasons of simplicity the complete lexeme is hashed.g returns an internal6 identifier (has internal position and no unique name)h return an internal identifier with position infoi returns a builtin5 identifier (has builtin position and no unique name)jreturn True if the given identifier is internalkstring of an identifierl(string of a SUE ref (empty if anonymous)mCdump the identifier string and its positions for debugging purposes`abcdefghijklm`abcdefighjklm`abcd1(c) 2008 Benedikt Huber, Manuel M. T. Chakravarty BSD-stylebenedikt.huber@gmail.com experimentalghcNone 16CKOV\|gunspecified error raised by the user (in case the user does not want to define her own error types).}Serror raised if a operation requires an unsupported or not yet implemented feature.~%errors in Language.C are instance of ~'obtain source location etc. of an errorwrap error in try to cast a generic  to the specific error typemodify the error level supertype of all errors1information attached to every error in Language.CError levels (severity)return TrueQ when the given error makes it impossible to continue analysis or compilation.position of an Errorseverity level of an Errormessage lines of an Error4converts an error into a string using a fixed formatSeither the lines of the long error message or the short message has to be non-empty the format is e <fname>:<row>: (column <col>) [<err lvl>] >>> <line_1> <line_2> ... <line_n>=raise a fatal internal error; message may have multiple lines|}~~}||}~(c) 2008 Benedikt Huber BSD-stylebenedikt.huber@gmail.com experimentalghcNone 16CKOVM%&(*+),-/013456EFGIHLMNPQSU`bcdefgijkl|}~*bcdel`fkgji()*+,-%&/135046GHIEFNMLQSUP.(c) [2007..2008] Duncan Coutts, Benedikt Huber BSD-stylebenedikt.huber@gmail.com experimentalghcNone 16CKOV 5 !(c) 2001 Manuel M. T. Chakravarty BSD-stylebenedikt.huber@gmail.comportableNone 16CKOV ,(c) 2007..2008 Duncan Coutts, Benedikt Huber BSD-stylebenedikt.huber@gmail.com experimentalghcNone 16CKOVժC String literalsClang dotted version literal @https://clang.llvm.org/docs/AttributeReference.html#availabilityFloats (represented as strings)-datatype representing type flags for integers8datatype for memorizing the representation of an integerC char constants (abstract)showCharConst cG prepends _a_ String representing the C char constant corresponding to c;. If necessary uses octal or hexadecimal escape sequences.1get the haskell representation of a char constantVget integer value of a C char constant undefined result for multi-char char constantsreturn true if the character constant is wide..construct a character constant from a haskell  Use cchar_w' if you want a wide character constant.%construct a wide chararacter constant+create a multi-character character constantHconstruct a integer constant (without type flags) from a haskell integer'concatenate a list of C string literalsshowStringLiteral sF prepends a String representing the C string literal corresponding to s>. If necessary it uses octal or hexadecimal escape sequences.isAsciiSourceChar b returns Truee if the given character is a character which may appear in a ASCII C source file and is printable. isCChar cq returns true, if c is a source character which does not have to be escaped in C char constants (C99: 6.4.4.4) escapeCChar c% escapes c for use in a char constant isSChar cn returns true if c is a source character which does not have to be escaped in C string literals (C99: 6.4.5)//!F[1999..2004] Manuel M T Chakravarty 2005 Duncan Coutts BSD-stylebenedikt.huber@gmail.com%portable C Tokens for the C lexer.None 16CKOV6v      !"#$%&'()*+i      !"#$%&'()*"S(c) [1999..2004] Manuel M T Chakravarty (c) 2005-2007 Duncan Coutts BSD-stylebenedikt.huber@gmail.comportableNone 16CKOVSBexecute the given parser on the supplied input stream. returns R if the parser failed, and a pair of result and remaining name supply otherwise Synopsis: JexecParser parser inputStream initialPos predefinedTypedefs uniqNameSupply, setLastToken modifyCache tok-0handle an End-Of-File token (changes savedToken)./0123456789:,-;<=>?@ABCDEFGHI#None 16CDKOVtJKLMNOPQRSTUVWXYZ (c) 2008 Benedikt Huber BSD-stylebenedikt.huber@gmail.com experimentalghcNone 16CKOVC unary operator (K&R A7.3-4)prefix increment operatorprefix decrement operator postfix increment operator postfix decrement operator address operator indirection operator  prefix plus prefix minusone's complementlogical negation C binary operators (K&R A7.6-15)remainder of division shift left shift rightlessgreater less or equalgreater or equalequal not equal bitwise and exclusive bitwise or!inclusive bitwise or" logical and# logical or$"C assignment operators (K&R A7.17)(remainder and assignment0      !"#$%&'()*+,-./0123450$%&'()*+,-./0 !"#1234     5       !"#$ %&'()*+,-./ O(c) [1999..2007] Manuel M T Chakravarty (c) 2008 Benedikt Huber BSD-stylebenedikt.huber@gmail.com experimentalghcNone 16;CKOV]HAll AST nodes are annotated. Inspired by the Annotated class of Niklas Broberg's haskell-src-exts package. In principle, we could have Copointed superclass instead of ann&, for the price of another dependency.I!get the annotation of an AST nodeJpchange the annotation (non-recursively) of an AST node. Use fmap for recursively modifying the annotation.MAttributed string literalsSC constant (K&R A2.5 & A7.2)U  (expr, type)V (type, designator-list)W  (type,type)X  (expr, type)Y*GNU Builtins, which cannot be typed in C99k7integer, character, floating point and string constantslC99 compound literalmC11 generic selectionn GNU C compound statement as exproGNU C address of labelpbuiltin expressions, see YqC expression (K&R A7)6these can be arbitrary expression, as the argument of sizeof@ can be arbitrary, even if appearing in a constant expressionGNU C extensions: alignof, __real, __imag, ({ stmt-expr }), && label and built-inst attribute annotationsThose are of the form )CAttr attribute-name attribute-parameters@, and serve as generic properties of some syntax tree elements.varray position designatorwmember designatorxarray range designator CRangeDesig from to _ (GNU C)y DesignatorsA designator specifies a member of an object, either an element or range of an array, or the named member of a struct / union.{Initializer List3The members of an initializer list are of the form (designator-list,initializer). The designator-list specifies one member of the compound type which is initialized. It is allowed to be empty - in this case the initializer refers to the 'next'- member of the compound type (see C99 6.7.8).2Examples (simplified expressions and identifiers): @-- int x[3][4] = { [0][3] = 4, [2] = 5, 8 }; -- corresponds to the assignments -- x[0][3] = 4; x[2][0] = 5; x[2][1] = 8; let init1 = ([CArrDesig 0, CArrDesig 3], CInitExpr 4) init2 = ([CArrDesig 2] , CInitExpr 5) init3 = ([] , CInitExpr 8) in CInitList [init1, init2, init3] -- struct { struct { int a[2]; int b[2]; int c[2]; } s; } x = { .s = { {2,3} , .c[0] = 1 } }; -- corresponds to the assignments -- x.s.a[0] = 2; x.s.a[1] = 3; x.s.c[0] = 1; let init_s_0 = CInitList [ ([], CInitExpr 2), ([], CInitExpr 3)] init_s = CInitList [ ([], init_s_0), ([CMemberDesig "c", CArrDesig 0], CInitExpr 1) ] in CInitList [(CMemberDesig "s", init_s)]}assignment expression~initialization list (see {)&C initialization (K&R A8.7, C99 6.7.8)Initializers are either assignment expressions or initializer lists (surrounded in curly braces), whose elements are themselves initializers, paired with an optional list of designators./C enumeration specifier (K&R A8.4, C99 6.7.2.2)&CEnum identifier enumerator-list attrs represent as enum specifierJEither the identifier or the enumerator-list (or both) have to be present.If enumerator-list$ is present, it has to be non-empty.#The enumerator list is of the form *(enumeration-constant, enumeration-value?)C, where the latter is an optional constant integral expression.attrs is a list of  attribute6 annotations associated with the enumeration specifier(A tag to determine wheter we refer to a struct or union, see .7C structure or union specifiers (K&R A8.3, C99 6.7.2.1)+CStruct tag identifier struct-decls c-attrs6 represents a struct or union specifier (depending on tag).either  identifier or the declaration list  struct-decls (or both) have to be present. Example: in  struct foo x; , the identifier is present, in struct { int y; } x# the declaration list, and in struct foo { int y; } x; both of them.c-attrs is a list of  attribute: annotations associated with the struct or union specifier _Alignas(type) _Alignas(expr)"C alignment specifiers (C99 6.7.5)!C function specifiers (C99 6.7.4)function specifiers inline and  _Noreturn7C type qualifiers (K&R A8.2, C99 6.7.3) and attributes.const, volatile and restrict type qualifiers Additionally,  attributeG annotations for declarations and declarators, and function specifiers+IEC 60227: width (32,64,128), extended flagStruct or Union specifierEnumeration specifier Typedef name  typeof(expr)  typeof(type)  _Atomic(type)&C type specifier (K&R A8.2, C99 6.7.2)/Type specifiers are either basic types such as char or int, struct, union or enum specifiers or typedef names.As a GNU extension, a typeof% expression also is a type specifier.autoregisterstaticexterntypedefC11/GNUC thread local storage>C storage class specifier (and typedefs) (K&R A8.1, C99 6.7.1)"storage-class specifier or typedef type nametype qualifierfunction specifieralignment specifier'C declaration specifiers and qualifiersDeclaration specifiers include at most one storage-class specifier (C99 6.7.1), type specifiers (6.7.2) and type qualifiers (6.7.3). A statementA local declarationA nested function (GNU C)C99 Block itemsqThings that may appear in compound statements: either statements, declarations or nested function definitions.Assembler operand'CAsmOperand argName? constraintExpr arg2 specifies an operand for an assembler statement.GNU Assembler statement @CAssemblyStatement type-qual? asm-expr out-ops in-ops clobbers _Ois an inline assembler statement. The only type-qualifier (if any) allowed is volatile. asm-expr0 is the actual assembler epxression (a string), out-ops and in-ops7 are the input and output operands of the statement. clobbersR is a list of registers which are clobbered when executing the assembler statement-An (attributed) label followed by a statementA statement of the form case expr : stmtA case range of the form case lower ... upper : stmtThe default case default : stmtjA simple statement, that is in C: evaluating an expression with side-effects and discarding the result.compound statement #CCompound localLabels blockItems atconditional statement $CIf ifExpr thenStmt maybeElseStmt atswitch statement CSwitch selectorExpr switchStmt , where  switchStmt usually includes case, break and default statementswhile or do-while statement CWhile guard stmt isDoWhile atfor statement CFor init expr-2 expr-3 stmt, where init4 is either a declaration or initializing expressiongoto statement  CGoto labelcomputed goto CGotoPtr labelExprcontinue statementbreak statementreturn statement CReturn returnExprassembly statementC statement (K&R A9, C99 6.8) CUnknownSize isCompleteType CArrSize isStatic exprSize of an arrayPointer declarator CPtrDeclr tyquals declrArray declarator "CArrDeclr declr tyquals size-expr?Function declarator =CFunDeclr declr (old-style-params | new-style-params) c-attrsDerived declarators, see YIndirections are qualified using type-qualifiers and generic attributes, and additionallyGThe size of an array is either a constant expression, variable length ([) or missing; in the last case, the type of the array is incomplete. The qualifier static is allowed for function arguments only, indicating that the supplied argument is an array of at least the given size.(New style parameter lists have the form  Right (declarations, isVariadic)0, old style parameter lists have the form Left (parameter-names)PC declarator (K&R A8.5, C99 6.7.5) and abstract declarator (K&R A8.8, C99 6.7.6)gA declarator declares a single object, function, or type. It is always associated with a declaration (), which specifies the declaration's type and the additional storage qualifiers and attributes, which apply to the declared object.A declarator is of the form +CDeclr name? indirections asm-name? attrs _ , where nameI is the name of the declared object (missing for abstract declarators),  declquals1 is a set of additional declaration specifiers, asm-nameN is the optional assembler name and attributes is a set of attrs is a set of  attribute% annotations for the declared object. indirections is a set of pointer, array and function declarators, which modify the type of the declared object as described below. If the  declaration specifies the non-derived type T, and we have  indirections = [D1, D2, ..., Dn]$ than the declared object has type (D1 indirect (D2 indirect ... (Dn indirect T))), where(CPtrDeclr attrs) indirect T is attributed pointer to T(CFunDeclr attrs) indirect T is attributed function returning T(CArrayDeclr attrs) indirect T is (attributed array of elemements of type T!Examples (simplified attributes):x is an int int x; CDeclr "x" []x0 is a restrict pointer to a const pointer to int Tconst int * const * restrict x; CDeclr "x" [CPtrDeclr [restrict], CPtrDeclr [const]]f0 is an function return a constant pointer to int ;int* const f(); CDeclr "f" [CFunDeclr [],CPtrDeclr [const]]f2 is a constant pointer to a function returning int Cint (* const f)(); ==> CDeclr "f" [CPtrDeclr [const], CFunDeclr []]mC declarations (K&R A8, C99 6.7), including structure declarations, parameter declarations and type names.A declaration is of the form %CDecl specifiers init-declarator-listX, where the form of the declarator list's elements depends on the kind of declaration:61) Toplevel declarations (K&R A8, C99 6.7 declaration)`C99 requires that there is at least one specifier, though this is merely a syntactic restriction>at most one storage class specifier is allowed per declarationthe elements of the non-empty init-declarator-list are of the form (Just declr, init?, Nothing). The declarator declrX has to be present and non-abstract and the initialization expression is optional.D2) Structure declarations (K&R A8.3, C99 6.7.2.1 struct-declaration)4Those are the declarations of a structure's members.do not allow storage specifiers:in strict C99, the list of declarators has to be non-emptythe elements of init-declarator-list are either of the form (Just declr, Nothing, size?)J, representing a member with optional bit-field size, or of the form (Nothing, Nothing, Just size), for unnamed bitfields. declr has to be non-abstract.3no member of a structure shall have incomplete typeG3) Parameter declarations (K&R A8.6.3, C99 6.7.5 parameter-declaration)init-declarator-list- must contain at most one triple of the form (Just declr, Nothing, Nothing)[, i.e. consist of a single declarator, which is allowed to be abstract (i.e. unnamed).4) Type names (A8.8, C99 6.7.6)do not allow storage specifiersinit-declarator-list- must contain at most one triple of the form (Just declr, Nothing, Nothing) . where declrG is an abstract declarator (i.e. doesn't contain a declared identifier),C function definition (C99 6.9.1, K&R A10.1)%A function definition is of the form ,CFunDef specifiers declarator decllist? stmt. specifiersm are the type and storage-class specifiers of the function. The only storage-class specifiers allowed are extern and static.The  declarator/ must be such that the declared identifier has  function typeK. The return type shall be void or an object type other than array type.The optional declaration list decllist( is for old-style function declarations.The statement stmt is a compound statement.)External C declaration (C99 6.9, K&R A10)IEither a toplevel declaration, function definition or external assembler..Complete C tranlsation unit (C99 6.9, K&R A10)A complete C translation unit, for example representing a C header or source file. It consists of a list of external (i.e. toplevel) declarations.#Separate the declaration specifiers attributel of a declaration qualify declarations or declarators (but not types), and are therefore separated as well.returns True2 if the given typespec is a struct, union or enum  definition%Lift a string literal to a C constant      !"#$%&'()*+,-./HJIKLMNOPQRSTUVWXYZk[\]^_`abcdefghijlmnopqrstuvwxyz{|~}trs{y|}~zuvwxqZ[\]^_`abcdefghijklmnop$%&'()*+,-./ !"#     YTUVWXSMNOPQRKLHIJHIJKLNOPQRTUVWXZ[\]^_`abcdefghijklmnoprsuvwx|}~$(c) 2008 Benedikt Huber BSD-stylebenedikt.huber@gmail.com experimentalghcNone 16CKOV       !"#$%&'()*+,-./HJIKLMNOPQRSTUVWXYZk[\]^_`abcdefghijlmnopqrstuvwxyz{|~} XCopyright (c) 2007 Bertram Felgenhauer (c) 2008 Benedikt Huber BSD-stylebenedikt.huber@gmail.com experimentalportableNone 16;<=CKOV,A class of types which can be pretty printedpretty print the given valueprettyPrec prec pM pretty prints p assuming that the surrounding context has a precedence of precXPretty print the given tranlation unit, but replace declarations from header files with #include directives.7The resulting file may not compile (because of missing #define directives and similar things), but is very useful for testing, as otherwise the pretty printed file will be cluttered with declarations from system headers.%None 16;=CDKOVeparseC input initialPos\ parses the given preprocessed C-source input and returns the AST or a list of parse errors. translUnitP[ provides a parser for a complete C translation unit, i.e. a list of external declarations.extDeclP; provides a parser for an external (file-scope) declaration statementP# provides a parser for C statements expressionP$ provides a parser for C expressions\]^_`abcdefg^9 _9 (c) 2008 Benedikt Huber BSD-stylebenedikt.huber@gmail.com experimentalghcNone 16CKOVIrun the given parser using a new name supply and builtin typedefs see  Synopsis: 'runParser parser inputStream initialPos   (c) 2008 Benedikt Huber BSD-stylebenedikt.huber@gmail.comalphaghcNone 16CKOV*ZW is currently an alias for q (Syntax)   is an alias for  (Syntax)  attribute annotationsThose are of the form (Attr attribute-name attribute-parameters@, and serve as generic properties of some syntax tree elements.Some examples:labels can be attributed with unused to indicate that their not used*struct definitions can be attributed with packed< to tell the compiler to use the most compact representation$declarations can be attributed with  deprecated-function declarations can be attributes with noreturn: to tell the compiler that the function will never return,or with const' to indicate that it is a pure functionTODOM: ultimatively, we want to parse attributes and represent them in a typed way Assembler name (alias for CStrLit)%Top level assembler block (alias for CStrLit)VarName name assembler-name is a name of an declared object is currently an alias for .uWe're planning a normalized representation, but this depends on the implementation of constant expression evaluation0Type qualifiers: constant, volatile and restrictXAn Enumerator consists of an identifier, a constant expressions and the link to its type%Representation of C enumeration types .EnumType name enumeration-constants attrs node(a tag to determine wheter we refer to a struct or union, see "."!Composite type (struct or union).&composite type declarations(!floating point type (C99 6.7.2.2)-integral types (C99 6.7.2.2)<Ntypdef references If the actual type is known, it is attached for convenience> Builtin type (va_list, anything)Anormalized type representationIAn array type may either have unknown size or a specified array size, the latter either variable or constant. Furthermore, when used as a function parameters, the size may be qualified as staticI. In a function prototype, the size may be `Unspecified variable size' ([*]).J UnknownArraySize is-starredK "FixedSizeArray is-static size-exprLFunction types are of the form %FunType return-type params isVariadic.?If the parameter types aren't yet known, the function has type FunTypeIncomplete type attrs.Otypes of C objectsPa non-derived typeQ pointer typeR array typeS function typeTa defined typeUHLinkage: Either no linkage, internal to the translation unit or external[*Storage duration and linkage of a variable\ no storage]&automatic storage (optional: register)^?static storage, linkage spec and thread local specifier (gnu c)_-function, either internal or external linkaged#Declaration attributes of the form 0DeclAttrs isInlineFunction storage linkage attrs:They specify the storage and linkage of a declared object.e DeclAttrs fspecs storage attrsfGeneric variable declarationshtypedef definitions.0The identifier is a new name for the given type.jStruct/Union member declarationk $MemberDecl vardecl bitfieldsize nodel AnonBitField typ sizemParameter declarationpFunction definitionsUA function definition is a declaration together with a statement (the function body).rObject DefinitionsCAn object definition is a declaration together with an initializer.rIf the initializer is missing, it is a tentative definition, i.e. a definition which might be overriden later on.t&Declarations, which aren't definitionsvDeclaration eventsPThose events are reported to callbacks, which are executed during the traversal.w"file-scope struct/union/enum eventx$file-scope declaration or definitionyparameter declarationz(local variable declaration or definition{a type definition|assembler block}<global declaration/definition table returned by the analysis?identifiers, typedefs and enumeration constants (namespace sum)object or function declarationobject definitionfunction definitiondefinition of an enumerator9All datatypes aggregating a declaration are instances of  DeclarationLget the name, type and declaration attributes of a declaration or definition!Composite type definitions (tags)6accessor class : composite type tags (struct or union)(accessor class : struct/union/enum names1return the type corresponding to a tag definitionh1get the declaration corresponding to a definitionkget the variable identifier of a declaration (only safe if the the declaration is known to have a name)get the variable name of a  Declarationget the type of a  Declaration$get the declaration attributes of a  Declaration,textual description of the kind of an objectsplitIdentDecls includeAllDecls splits a map of object, function and enumerator declarations and definitions into one map holding declarations, and three maps for object definitions, enumerator definitions and function definitions. If includeAllDecls is Trueu all declarations are present in the first map, otherwise only those where no corresponding definition is available.empty global declaration tablefilter global declarationsmerge global declarationsReturns True- if the given object definition is tentative.return the idenitifier of a typedefget the [ of a declaration.get the `function attributes' of a declarationreturn True if the object has linkageGet the linkage of a definition.return the type of a composite type definition%return the type of an enum definitionno type qualifiersmerge (&&) two type qualifier setsEmpty attribute listMerge attribute lists TODO&: currently does not remove duplicates      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIKJLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvxw{yz|}~}~vwxyz{|turspqmnojklhifgde`abc[\]^_ZYUVWXOPQRSTLMNIJK<=ABCDEFGH>?@-./0123456789:;()*+,&'"# !$%     #   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWX[\]^_`abcdefghijklmnopqrstuvwxyz{|}~None 16CKOV3 oFor an arithmetic operator, if the arguments are of the given types, return the type of the full expression.      (c) 2008 Benedikt Huber BSD-stylebenedikt.huber@gmail.comalphaghcNone 16CKOV8NRedefError is caused by an invalid redefinition of the same identifier or typeCBadSpecifierError is caused by an invalid combination of specifiersEInvalidASTError is caused by the violation of an invariant in the AST ! !{(c) 2008 Benedikt Huber based on code from c2hs (c) [1999..2001] Manuel M. T. Chakravarty BSD-stylebenedikt.huber@gmail.comalphaghcNone 16CKOV_F%*Status of a declaration+ new entry,old def was overwritten-new def was discarded."new def shadows one in outer scope/ kind mismatch0!Table holding current definitions2declared `ordinary identifiers'3declared structunion enum tags4defined labels5 member declarations (only local)6link names with definitions8OTag names map to forward declarations or definitions of struct/union/enum types< All ordinary identifiers map to  IdenTyDecl2: either a typedef or a object/function/enumerator>@empty definition table, with all name space maps in global scope?6get the globally defined entries of a definition tableA8Enter function scope (AND the corresponding block scope)B\Leave function scope, and return the associated DefTable. Error if not in function scope.CEnter new block scopeDLeave innermost block scopeE"Enter new member declaration scopeF(Leave innermost member declaration scopeisameTagKind ty1 ty2 returns True if ty1,ty20 are the same kind of tag (struct,union or enum)I/declare/define a global object/function/typeDefreturns Redeclared defF if there is already an object/function/typeDef in global scope, or DifferentKindRedec def/ if the old declaration is of a different kind.J;declare/define a object/function/typeDef with lexical scopereturns Redeclared def or DifferentKindRedec defE if there is already an object/function/typeDef in the same scope.Kndeclare/define a object/function/typeDef with lexical scope, if the given predicate holds on the old entry.returns  Keep old_def? if the old definition shouldn't be overwritten, and otherwise Redeclared def or DifferentKindRedecl defC if there is already an object/function/typeDef in the same scope.LBdeclare a tag (fwd decl in case the struct name isn't defined yet)M define a tagNVdefine a label Return the old label if it is already defined in this function's scopeO9lookup identifier (object, function, typeDef, enumerator)P lookup tagQ lookup labelR'lookup an object in the innermost scopeS+lookup an identifier in the innermost scopeTRecord the type of a node.ULookup the type of a node.VfMerge two DefTables. If both tables contain an entry for a given key, they must agree on its value.-*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUV-<=89:;01234567>?@ABCDEF*+,-./GHIJKLMNOPQRSTUVjkl*+,-./012345679:;None 16CKOV]'Constructor for a simple integral type.^-Constructor for a simple floating-point type._#A simple pointer with no qualifiersmA pointer with the const qualifier.`The underlying type for uint16_t. For now, this is just unsigned short.aThe underlying type for uint32_t. For now, this is just  unsigned int.bThe underlying type for uint64_t. For now, this is just unsigned long long.c<The type returned by sizeof (size_t). For now, this is just int.dCThe type of pointer differences (ptrdiff_t). For now, this is just int.e4The type of comparisons/guards. This is always just int.fSimple void type.gAn unqualified void pointer.hA const -qualified void pointer.iAn unqualified char pointer.jA const -qualified char pointer.kThe type of a constant string.l3The builtin type of variable-length argument lists.m8Check whether a type is an integral type. This includes enum5 types. This function does not attempt to resolve typedef types.ndCheck whether a type is a floating-point numeric type. This function does not attempt to resolve typedef types.oqCheck whether a type is an pointer type. This includes array types. This function does not attempt to resolve typedef types.pbCheck whether a type is a scalar type. Scalar types include arithmetic types and pointer types.qreturn True% if the given type is a function type9Result is undefined in the presence of undefined typeDefsr Return the qualifiers of a type.t Return the attributes of a type.vReturn the base type of a pointer or array type. It is an error to call this function with a type that is not in one of those two categories.wresolve typedefs, if possiblex$Attempt to remove all references to typedef types from a given type. Note that this does not dereference the types of structure or union fields, so there are still cases where further dereferencing is needed.nTrue iff Type is a variable length array or a derived type thereof. Variably modified types have function or block scope, so only some constructions are possible.yzTwo types denote the same type if they are identical, ignoring type definitions, and neither is a variably modified type.oReturns pk iff both array sizes denote the same size. Assumes that neither array type was a variably modified type. ]^_`abcdefghijklmnopqrstuvwxyz{| ]^_`abcdefghijklmnopqrstuvwxzy{|None 16CKOV}}(c) 2008 Benedikt Huber BSD-stylebenedikt.huber@gmail.comalphaghcNone16;<=>?CKOQVHThe variety of the C language to accept. Note: this is not yet enforced.:simple traversal monad, providing user state and callbacksTraversal monad%handling declarations and definitions throw an ~ catch an ~2 (we could implement dynamically-typed catch here)remember that an ~ occurred (without throwing it)"return the list of recorded errorsreturn the definition table0perform an action modifying the definition tableunique name generationhforward declaration of a tag. Only necessary for name analysis, but otherwise no semantic consequences.define the given composite type or enumeration If there is a declaration visible, overwrite it with the definition. Otherwise, enter a new definition in the current namespace. If there is already a definition present, yield an error (redeclaration)./handle variable declarations (external object declarations and function prototypes) variable declarations are either function prototypes, or external declarations, and not very interesting on their own. we only put them in the symbol table and call the handle. declarations never override definitions[handle parameter declaration. The interesting part is that parameters can be abstract (if they are part of a type). If they have a name, we enter the name (usually in function prototype or function scope), checking if there are duplicate definitions. FIXME: I think it would be more transparent to handle parameter declarations in a special wayhandle function definitions*handle object defintions (maybe tentative)lookup a type definition the 'wrong kind of object' is an internal error here, because the parser should distinguish typeDefs and other objects(lookup an object, function or enumeratorq-add link between use and definition (private))create a reference to a struct/union/enumThis currently depends on the fact the structs are tagged with unique names. We could use the name generation of TravMonad as well, which might be the better choice when dealing with autogenerated code.,check wheter non-recoverable errors occurred(raise an error caused by a malformed AST*raise an error based on an Either argument:~;~~rstuvwxy(c) 2008 Benedikt Huber BSD-stylebenedikt.huber@gmail.com prototypeghcNone 16CKOVMExport global declarations TODO: This does not export tags and type defs yetExport Declarator Synopsis: 5exportDeclr other_specs type attributes variable-nameExport a type to syntaxz3export function attributes to C function specifiers{/express storage in terms of storage specifiers.sThis isn't always possible and depends on the context the identifier is declared. Most importantly, if there is a  conflicting declaration in scope, export is impossible. Furthermore, automatic storage is impossible in file scope. If the storage can actually be specified, the export is correct.  (c) 2008 Benedikt Huber BSD-stylebenedikt.huber@gmail.com prototypeghcNone 16;=CKOV(c) 2008 Benedikt Huber BSD-stylebenedikt.huber@gmail.comalphaghcNone 16<CKOVد|banalyse and translate a parameter declaration Should be called in either prototype or block scope}Ja parameter declaration has no linkage and either auto or register storage~*analyse and translate a member declarationanalyse declarators get the type of a type declarationA type declaration T may appear in thre forms:  typeof(T)6as abstract declarator in a function prototype, as in f(int),in a declaration without declarators, as in struct x { int a } ; Currently, analyseTypeDecl2 is exlusively used for analysing types for GNU's  typeof(T).SWe move attributes to the type, as they have no meaning for the abstract declarator!translate a type"Btranslate a type without (syntactic) indirections Due to the GNU typeof6 extension and typeDefs, this can be an arbitrary typeMerge type attributes!This handles for example the form  const typeof(char volatile) x;translate a enum type decl &enum my_enum enum your_enum { x, y=3 })translate and analyse an enumeration type#UMapping from num type specs to C types (C99 6.7.2-2), ignoring the complex qualifier.(convert old style parametersUThis requires matching parameter names and declarations, as in the following example: $int f(d,c,a,b) char a,*b; int c; { }is converted to $int f(int d, int c, char a, char* b)CTODO: This could be moved to syntax, as it operates on the AST onlyVsplit a CDecl into declarators, hereby eliding SUE defs from the second declarator on.There are several reasons why this isn't the preferred way for handling multiple-declarator declarations, but it can be convinient some times. ZsplitCDecl [d| struct x { int z; } a,*b; |] [ [d| struct x { int z; } a, struct x *b; |] ]TODO?: This could be moved to syntax, as it operates on the AST only) translate  attribute2 annotations TODO: This is a unwrap and wrap stub*9construct a name for a variable TODO: more or less bogus9      !"#$%&'()*+,9 !"#$%(&     ')*,+     None 16CKOVۦ78BA@?>=<;:9CDEFGHIJKL789:;<=>?@ABCDEFGHIJKL7 89:;<=>?@ABNone 16;=CKOV~ X!Determine the type of a constant.Y+Determine whether two types are compatible.Z5Determine the composite type of two compatible types.cGDetermine whether two types are compatible in an assignment expression.d)Determine the type of a binary operation.e/Determine the type of a conditional expression.hGet the type of field m of type tigGet all members of a struct, union, or enum, with their types. Collapse fields of anonymous members.j]Expand an anonymous composite type into a list of member names and their associated types."MNOPQRSTUVWXYZ[\]^_`abcdefghijklmn"MNOPQRSTUVWXYZ[\]^_`abcdefghijklmnNone 16CKOVopqropqr(c) 2008 Benedikt Huber BSD-stylebenedikt.huber@gmail.comalphaghcNone 16CKOVjsAnalyse the given ASTanalyseAST ast results in global declaration dictionaries. If you want to perform specific actions on declarations or definitions, you may provide callbacks in the  MonadTrav m.Returns the set of global declarations and definitions which where successfully translated. It is the users responsibility to check whether any hard errors occurred (runTrav does this for you).t Analyse an top-level declarationuAnalyse a function definitionv6Analyse a declaration other than a function definition(Note: static assertions are not analysedAnalyse a typedef(compute storage of a function definitionLa function definition has static storage with internal linkage if specified static-, the previously declared linkage if any if extern7 or no specifier are present. (See C99 6.2.2, clause 5){This function won't raise an Trav error if the declaration is incompatible with the existing one, this case is handled in .handle a function prototype(handle a object declaration / definitionWe have to check the storage specifiers here, as they determine wheter we're dealing with decalartions or definitions see [http:/www.sivity.netprojects language.cwiki/ExternalDefinitions]Dhandle a function-scope object declaration / definition see [http:/www.sivity.netprojects language.cwiki/LocalDefinitions]lGiven a context, determine the type declaration for the enclosing function, if possible, given a context.yXTypecheck a statement, given a statement context. The type of a statement is usually voidI, but expression statements and blocks can sometimes have other types.Typecheck a block item. When statement expressions are blocks, they have the type of their last expression statement, so this needs to return a type.`Typecheck an expression, with information about whether it appears as an lvalue or an rvalue.Return the type of a builtin.stuvwxyz{stuvxwy{z&(c) 2008 Benedikt Huber BSD-stylebenedikt.huber@gmail.comalphaghcNone 16CKOV=      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIKJLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvxw{yz|}~ !~      !"#$%&'()*+,stuvwxyz{(c) 2008 Benedikt Huber BSD-stylebenedikt.huber@gmail.com experimentalportableNone 16CKOV~&Generic arguments for the preprocessor$Generic Options for the preprocessorA encapsulates the abstract interface for invoking C preprocessorsYparse the given command line arguments, and return a pair of parsed and ignored argumentsrun the preprocessor%file extension of a preprocessed file4Cpp arguments that only specify the input file name.;use the given preprocessor arguments without analyzing them6add a typed option to the given preprocessor arguments7add a string option to the given preprocessor arguments#run the preprocessor and return an  if preprocesssing succeededcreate an output file, given  Maybe tmpdir and  inputfile-compute output file name from input file namecreate a temporary file7guess whether a file is preprocessed (file end with .i)~~~(c) 2008 Benedikt Huber BSD-stylebenedikt.huber@gmail.com experimentalportableNone 16CKOV#GCC+ represents a reference to the gcc compilercreate a reference to gccParse arguments for preprocessing via GCC. At least one .c, .hc or .h file has to be present. For now we only support the most important gcc options.|1) Parse all flags relevant to CppArgs 2) Move -c,-S,-M? to other_args 3) Strip -E 4) The rest goes into extra_args(c) 2008 Benedikt Huber [1995..2007] Manuel M. T. Chakravarty Duncan Coutts Betram Felgenhauer BSD-stylebenedikt.huber@gmail.com experimentalghcNone 16CKOV+3preprocess (if necessary) and parse a C source file Synopsis: parseCFile preprocesssor tmp-dir? cpp-opts file Example: parseCFile (newGCC "gcc") Nothing ["-I/usr/include/gtk-2.0"] my-gtk-exts.c$parse an already preprocessed C file Synopsis: parseCFilePre file.ii%&(*+),-/013456EFGIHLMNPQSU`bcdefgijkl|}~      !"#$%&'()*+,-./HJIKLMNOPQRSTUVWXYZk[\]^_`abcdefghijlmnopqrstuvwxyz{|~}'()*+,-./0123456789:;<=>>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnmopqrstuvwxyz{|}~                                                    """" ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? ? @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _ ` a b c d e f f g h i j k l m n o p q r s t u v w x y z { | } ~      l                                                                                                                                                                               ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _ ` a b c d e f g h i j k l m n o p q r s t u v w x y z { | } ~                                                                                                                                          % % % % %                         ! " # $ $ % % & & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; ; < = > ? @ A B C D E F G H G I I J K L M N O P Q R S T U V W X Y Z [ \ \ ] ^ _ _ ` ` a a b b c d d e f f g g h h i j i k l m n o o p q r s t u v w t x y z { | } ~                                                                                                                                  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijkklmnopqrstuvwxyz{|}~,-./      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`aabcdefghijklmnopqrstuvwxyz{|}~N~    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! ! " " """"""""".""""""""""""" "!"""#"$"%"&#'#(#)#*#)#+#,#-#,#.#/#0#1#2#3#4#567%8%9%:%:%;%<%=%=%>%?%@%@ ABCDEFGHIJiKLMNOrPQRSTUVWXYZ[\]^_`abcdefguhi%language-c-0.8-KoBDKGTf2gtDsoj7Q0ypyE Language.C.Analysis.NameSpaceMapLanguage.C.Data.InputStreamLanguage.C.Data.NameLanguage.C.Data.PositionLanguage.C.Data.NodeLanguage.C.Data.IdentLanguage.C.Data.ErrorLanguage.C.ParserLanguage.C.Syntax.ConstantsLanguage.C.Syntax.OpsLanguage.C.Syntax.ASTLanguage.C.PrettyLanguage.C.Analysis.SemRep#Language.C.Analysis.TypeConversionsLanguage.C.Analysis.SemErrorLanguage.C.Analysis.DefTableLanguage.C.Analysis.TypeUtilsLanguage.C.Analysis.BuiltinsLanguage.C.Analysis.TravMonadLanguage.C.Analysis.ExportLanguage.C.Analysis.DebugLanguage.C.Analysis.AstAnalysis Language.C.Analysis.DeclAnalysisLanguage.C.Analysis.ConstEvalLanguage.C.Analysis.TypeCheckLanguage.C.Syntax.UtilsLanguage.C.System.PreprocessLanguage.C.System.GCC Language.CLanguage.C.DataLanguage.C.Data.RListLanguage.C.Parser.BuiltinLanguage.C.Parser.TokensLanguage.C.Parser.ParserMonadLanguage.C.Parser.LexerLanguage.C.SyntaxLanguage.C.Parser.ParserLanguage.C.Analysis NameSpaceMap globalNames hasLocalNames localNames nameSpaceMap defGlobal enterNewScope leaveScopedefLocal lookupName lookupGloballookupInnermostScope nsMapToListmergeNameSpace InputStreamtakeBytetakeCharinputStreamEmpty takeCharsreadInputStreaminputStreamToStringinputStreamFromString countLinesNamenameId newNameSupplynamesStartingFrom $fEnumName $fNFDataName $fShowName $fReadName$fEqName $fOrdName$fIxName $fDataName $fGenericNamePosposOf PosLengthPosition posOffsetposRow posColumnposFile posParentpositioninitPos isSourcePosnoposisNoPos builtinPos isBuiltinPos internalPos isInternalPosincPosretPos incOffset$fShowPosition$fNFDataPosition$fNFDataFilePosition $fEqPosition $fOrdPosition$fDataPosition$fGenericPosition$fEqFilePosition$fOrdFilePosition$fDataFilePosition$fGenericFilePositionCNodenodeInfoNodeInfoOnlyPos lengthOfNodegetLastTokenPos nameOfNode posOfNode fileOfNodeeqByName internalNode undefNode isUndefNodemkNodeInfoOnlyPosmkNodeInfoPosLen mkNodeInfo mkNodeInfo' $fPosNodeInfo$fShowNodeInfo$fNFDataNodeInfo $fCNodeEither$fCNodeNodeInfo$fDataNodeInfo $fEqNodeInfo $fOrdNodeInfo$fGenericNodeInfoIdentSUERef AnonymousRefNamedRefisAnonymousRefmkIdent internalIdentinternalIdentAt builtinIdentisInternalIdent identToStringsueRefToString dumpIdent $fPosIdent $fCNodeIdent $fOrdIdent $fEqIdent $fNFDataIdent$fNFDataSUERef $fDataIdent $fShowIdent$fGenericIdent $fDataSUERef $fOrdSUERef $fEqSUERef $fShowSUERef$fGenericSUERef UserErrorUnsupportedFeatureError errorInfotoError fromErrorchangeErrorLevelCError ErrorInfo ErrorLevel LevelWarn LevelError LevelFatal isHardError mkErrorInfoerrorPos errorLevel errorMsgsunsupportedFeatureunsupportedFeature_userErr showError showErrorInfo internalErr$fShowErrorLevel$fShowErrorInfo $fErrorCError $fShowCError$fErrorErrorInfo$fShowUnsupportedFeature$fErrorUnsupportedFeature$fShowUserError$fErrorUserError$fEqErrorLevel$fOrdErrorLevelbuiltinTypeNamesFlagsCString ClangCVersionCFloatCIntegerCIntFlag FlagUnsignedFlagLong FlagLongLongFlagImagCIntReprDecReprHexRepr OctalReprCCharCChars showCharConstgetCChar getCCharAsInt isWideCharcCharcChar_wcChars readCInteger getCIntegercIntegercFloat readCFloatreadClangCVersioncString cString_w getCStringconcatCStrings showStringLit escapeChar unescapeCharunescapeStringnoFlagssetFlag clearFlagtestFlag $fNFDataCChar $fShowCChar$fNFDataCIntRepr$fNFDataCIntFlag$fShowCIntFlag$fNFDataCFloat $fShowCFloat$fShowClangCVersion$fNFDataCString $fShowCString $fNFDataFlags$fNFDataCInteger$fShowCInteger $fEqCChar $fOrdCChar $fDataCChar$fGenericCChar $fEqCIntRepr $fOrdCIntRepr$fEnumCIntRepr$fBoundedCIntRepr$fDataCIntRepr$fGenericCIntRepr $fEqCIntFlag $fOrdCIntFlag$fEnumCIntFlag$fBoundedCIntFlag$fDataCIntFlag$fGenericCIntFlag $fEqCFloat $fOrdCFloat $fDataCFloat$fGenericCFloat$fEqClangCVersion$fOrdClangCVersion$fDataClangCVersion $fEqCString $fOrdCString $fDataCString$fGenericCString $fEqFlags $fOrdFlags $fDataFlags$fGenericFlags$fGeneric1Flags $fEqCInteger $fOrdCInteger$fDataCInteger$fGenericCIntegerP ParseError execParserCUnaryOp CPreIncOp CPreDecOp CPostIncOp CPostDecOpCAdrOpCIndOpCPlusOpCMinOpCCompOpCNegOp CBinaryOpCMulOpCDivOpCRmdOpCAddOpCSubOpCShlOpCShrOpCLeOpCGrOpCLeqOpCGeqOpCEqOpCNeqOpCAndOpCXorOpCOrOpCLndOpCLorOp CAssignOp CMulAssOp CDivAssOp CRmdAssOp CAddAssOp CSubAssOp CShlAssOp CShrAssOp CAndAssOp CXorAssOpCOrAssOp assignBinopisCmpOpisPtrOpisBitOp isLogicOp isEffectfulOp$fNFDataCAssignOp$fNFDataCBinaryOp$fNFDataCUnaryOp $fEqCAssignOp$fOrdCAssignOp$fShowCAssignOp$fDataCAssignOp$fGenericCAssignOp $fEqCBinaryOp$fOrdCBinaryOp$fShowCBinaryOp$fDataCBinaryOp$fGenericCBinaryOp $fEqCUnaryOp $fOrdCUnaryOp$fShowCUnaryOp$fDataCUnaryOp$fGenericCUnaryOp Annotated annotationamapCStringLiteralCStrLit CConstant CIntConst CCharConst CFloatConst CStrConstCConst CBuiltinThing CBuiltinVaArgCBuiltinOffsetOfCBuiltinTypesCompatibleCBuiltinConvertVectorCBuiltin CExpressionCCommaCAssignCCondCBinaryCCastCUnary CSizeofExpr CSizeofType CAlignofExpr CAlignofType CComplexReal CComplexImagCIndexCCallCMemberCVar CCompoundLitCGenericSelection CStatExpr CLabAddrExpr CBuiltinExprCExpr CAttributeCAttrCPartDesignator CArrDesig CMemberDesig CRangeDesig CDesignatorCInitializerList CInitList CInitializer CInitExprCInit CEnumerationCEnum CStructTag CUnionTagCStructureUnionCStruct CStructUnionCAlignmentSpecifier CAlignAsType CAlignAsExpr CAlignSpecCFunctionSpecifier CInlineQual CNoreturnQualCFunSpecCTypeQualifier CConstQual CVolatQual CRestrQual CAtomicQual CAttrQual CNullableQual CNonnullQual CTypeQualCTypeSpecifier CVoidType CCharType CShortTypeCIntType CLongType CFloatType CDoubleType CSignedType CUnsigType CBoolType CComplexType CInt128Type CFloatNTypeCSUType CEnumTypeCTypeDef CTypeOfExpr CTypeOfType CAtomicType CTypeSpecCStorageSpecifierCAuto CRegisterCStaticCExternCTypedefCThread CStorageSpecCDeclarationSpecifier CDeclSpecCCompoundBlockItem CBlockStmt CBlockDecl CNestedFunDef CBlockItemCAssemblyOperand CAsmOperandCAssemblyStatementCAsmStmt CStatementCLabelCCaseCCasesCDefault CCompoundCIfCSwitchCWhileCForCGotoCGotoPtrCContCBreakCReturnCAsmCStat CArraySize CNoArrSizeCArrSizeCDerivedDeclarator CPtrDeclr CArrDeclr CFunDeclr CDerivedDeclr CDeclaratorCDeclr CDeclarationCDecl CStaticAssert CFunctionDefCFunDefCExternalDeclarationCDeclExtCFDefExtCAsmExtCExtDeclCTranslationUnit CTranslUnitpartitionDeclSpecsisSUEDef cstringOfLit liftStrLit$fFunctorCStorageSpecifier$fPosCStorageSpecifier$fCNodeCStorageSpecifier$fNFDataCStorageSpecifier$fFunctorCFunctionSpecifier$fPosCFunctionSpecifier$fCNodeCFunctionSpecifier$fNFDataCFunctionSpecifier$fNFDataCStructTag$fFunctorCConstant$fPosCConstant$fCNodeCConstant$fNFDataCConstant$fFunctorCStringLiteral$fPosCStringLiteral$fCNodeCStringLiteral$fNFDataCStringLiteral$fFunctorCBuiltinThing$fPosCBuiltinThing$fCNodeCBuiltinThing$fPosCExpression$fCNodeCExpression$fFunctorCAttribute$fPosCAttribute$fCNodeCAttribute$fFunctorCPartDesignator$fPosCPartDesignator$fCNodeCPartDesignator$fPosCInitializer$fCNodeCInitializer$fFunctorCEnumeration$fPosCEnumeration$fCNodeCEnumeration$fFunctorCStructureUnion$fPosCStructureUnion$fCNodeCStructureUnion$fFunctorCAlignmentSpecifier$fPosCAlignmentSpecifier$fCNodeCAlignmentSpecifier$fFunctorCTypeQualifier$fPosCTypeQualifier$fCNodeCTypeQualifier$fFunctorCTypeSpecifier$fPosCTypeSpecifier$fCNodeCTypeSpecifier$fFunctorCDeclarationSpecifier$fPosCDeclarationSpecifier$fCNodeCDeclarationSpecifier$fFunctorCCompoundBlockItem$fPosCCompoundBlockItem$fCNodeCCompoundBlockItem$fFunctorCAssemblyOperand$fPosCAssemblyOperand$fCNodeCAssemblyOperand$fFunctorCAssemblyStatement$fPosCAssemblyStatement$fCNodeCAssemblyStatement$fPosCStatement$fCNodeCStatement$fFunctorCArraySize$fPosCDerivedDeclarator$fCNodeCDerivedDeclarator$fFunctorCDeclarator$fPosCDeclarator$fCNodeCDeclarator$fPosCDeclaration$fCNodeCDeclaration$fFunctorCFunctionDef$fPosCFunctionDef$fCNodeCFunctionDef$fNFDataCBuiltinThing$fFunctorCExpression$fNFDataCExpression$fNFDataCAttribute$fNFDataCPartDesignator$fFunctorCInitializer$fNFDataCInitializer$fNFDataCEnumeration$fNFDataCStructureUnion$fNFDataCAlignmentSpecifier$fNFDataCTypeQualifier$fNFDataCTypeSpecifier$fNFDataCDeclarationSpecifier$fNFDataCCompoundBlockItem$fNFDataCAssemblyOperand$fNFDataCAssemblyStatement$fFunctorCStatement$fNFDataCStatement$fNFDataCArraySize$fFunctorCDerivedDeclarator$fNFDataCDerivedDeclarator$fNFDataCDeclarator$fFunctorCDeclaration$fNFDataCDeclaration$fNFDataCFunctionDef$fFunctorCExternalDeclaration$fPosCExternalDeclaration$fCNodeCExternalDeclaration$fNFDataCExternalDeclaration$fFunctorCTranslationUnit$fPosCTranslationUnit$fCNodeCTranslationUnit$fNFDataCTranslationUnit$fAnnotatedCStringLiteral$fAnnotatedCConstant$fAnnotatedCBuiltinThing$fAnnotatedCExpression$fAnnotatedCAttribute$fAnnotatedCPartDesignator$fAnnotatedCInitializer$fAnnotatedCEnumeration$fAnnotatedCStructureUnion$fAnnotatedCAlignmentSpecifier$fAnnotatedCFunctionSpecifier$fAnnotatedCTypeQualifier$fAnnotatedCTypeSpecifier$fAnnotatedCStorageSpecifier $fAnnotatedCDeclarationSpecifier$fAnnotatedCCompoundBlockItem$fAnnotatedCAssemblyOperand$fAnnotatedCAssemblyStatement$fAnnotatedCStatement$fAnnotatedCDerivedDeclarator$fAnnotatedCDeclarator$fAnnotatedCDeclaration$fAnnotatedCFunctionDef$fAnnotatedCExternalDeclaration$fAnnotatedCTranslationUnit$fShowCStorageSpecifier$fEqCStorageSpecifier$fOrdCStorageSpecifier$fDataCStorageSpecifier$fGenericCStorageSpecifier$fGeneric1CStorageSpecifier$fShowCFunctionSpecifier$fDataCFunctionSpecifier$fGenericCFunctionSpecifier$fGeneric1CFunctionSpecifier$fShowCStructTag$fEqCStructTag$fDataCStructTag$fGenericCStructTag$fShowCConstant$fDataCConstant$fGenericCConstant$fGeneric1CConstant$fShowCStringLiteral$fDataCStringLiteral$fGenericCStringLiteral$fGeneric1CStringLiteral$fShowCDeclaration$fDataCDeclaration$fGenericCDeclaration$fDataCExpression$fShowCExpression$fGenericCExpression$fShowCBuiltinThing$fDataCBuiltinThing$fGenericCBuiltinThing$fShowCPartDesignator$fDataCPartDesignator$fGenericCPartDesignator$fShowCInitializer$fDataCInitializer$fGenericCInitializer$fShowCStatement$fDataCStatement$fGenericCStatement$fShowCAttribute$fDataCAttribute$fGenericCAttribute$fGeneric1CAttribute$fShowCCompoundBlockItem$fDataCCompoundBlockItem$fGenericCCompoundBlockItem$fGeneric1CCompoundBlockItem$fShowCFunctionDef$fDataCFunctionDef$fGenericCFunctionDef$fGeneric1CFunctionDef$fShowCDeclarationSpecifier$fDataCDeclarationSpecifier$fGenericCDeclarationSpecifier$fGeneric1CDeclarationSpecifier$fShowCAlignmentSpecifier$fDataCAlignmentSpecifier$fGenericCAlignmentSpecifier$fGeneric1CAlignmentSpecifier$fShowCTypeQualifier$fDataCTypeQualifier$fGenericCTypeQualifier$fGeneric1CTypeQualifier$fShowCTypeSpecifier$fDataCTypeSpecifier$fGenericCTypeSpecifier$fGeneric1CTypeSpecifier$fShowCEnumeration$fDataCEnumeration$fGenericCEnumeration$fGeneric1CEnumeration$fShowCStructureUnion$fDataCStructureUnion$fGenericCStructureUnion$fGeneric1CStructureUnion$fShowCDeclarator$fDataCDeclarator$fGenericCDeclarator$fGeneric1CDeclarator$fShowCDerivedDeclarator$fDataCDerivedDeclarator$fGenericCDerivedDeclarator$fShowCArraySize$fDataCArraySize$fGenericCArraySize$fGeneric1CArraySize$fShowCAssemblyStatement$fDataCAssemblyStatement$fGenericCAssemblyStatement$fGeneric1CAssemblyStatement$fShowCAssemblyOperand$fDataCAssemblyOperand$fGenericCAssemblyOperand$fGeneric1CAssemblyOperand$fShowCExternalDeclaration$fDataCExternalDeclaration$fGenericCExternalDeclaration$fGeneric1CExternalDeclaration$fShowCTranslationUnit$fDataCTranslationUnit$fGenericCTranslationUnit$fGeneric1CTranslationUnitPrettypretty prettyPrecprettyUsingInclude$fPrettyCStringLiteral$fPrettyCConstant$fPrettyCUnaryOp$fPrettyCBinaryOp$fPrettyCAssignOp$fPrettyCBuiltinThing$fPrettyCExpression$fPrettyCAttribute$fPrettyCPartDesignator$fPrettyCInitializer$fPrettyCArraySize$fPrettyCDeclarator$fPrettyCEnumeration$fPrettyCStructTag$fPrettyCStructureUnion$fPrettyCFunctionSpecifier$fPrettyCTypeQualifier$fPrettyCTypeSpecifier$fPrettyCStorageSpecifier$fPrettyCAlignmentSpecifier$fPrettyCDeclarationSpecifier$fPrettyCDeclaration$fPrettyCCompoundBlockItem$fPrettyCAssemblyOperand$fPrettyCAssemblyStatement$fPrettyCStatement$fPrettyCFunctionDef$fPrettyCExternalDeclaration$fPrettyCTranslationUnitparseC translUnitPextDeclP statementP expressionP execParser_ExprStmt AttributesAttrAsmNameAsmBlockVarNameNoName Initializer TypeQualsconstantvolatilerestrictatomicnullablenonnull EnumeratorEnumType CompTyKind StructTagUnionTagCompType EnumTypeRef CompTypeRef FloatTypeTyFloatTyDouble TyLDoubleTyFloatNIntTypeTyBoolTyCharTySCharTyUCharTyShortTyUShortTyIntTyUIntTyInt128 TyUInt128TyLongTyULongTyLLongTyULLong TypeDefRef BuiltinTypeTyVaListTyAnyTypeNameTyVoid TyIntegral TyFloating TyComplexTyCompTyEnum TyBuiltin ArraySizeUnknownArraySizeFunTypeFunTypeIncompleteType DirectTypePtrType ArrayType FunctionType TypeDefTypeLinkage NoLinkageInternalLinkageExternalLinkageRegister ThreadLocalStorage NoStorageAutoStatic FunLinkage FunctionAttrsisInline isNoreturn DeclAttrsVarDeclTypeDef MemberDecl AnonBitField ParamDeclAbstractParamDeclFunDefObjDefDecl DeclEventTagEvent ParamEvent LocalEvent TypeDefEventAsmEvent GlobalDeclsgObjsgTags gTypeDefs IdentDecl Declaration ObjectDef FunctionDef EnumeratorDef getVarDeclTagDefCompDefEnumDef HasCompTyKindcompTag HasSUERefsueRef typeOfTagDef declIdentdeclNamedeclType declAttrs objKindDescrsplitIdentDeclsemptyGlobalDeclsfilterGlobalDeclsmergeGlobalDecls isTentativeidentOfTypeDef isExtDecl declStorage functionAttrsnoFunctionAttrs hasLinkage declLinkage typeOfCompDef typeOfEnumDef noTypeQualsmergeTypeQualsidentOfVarNameisNoName noAttributesmergeAttributes $fShowIntType$fShowFloatType$fPosEnumTypeRef$fCNodeEnumTypeRef$fHasSUERefEnumTypeRef$fShowCompTyKind$fPosCompTypeRef$fCNodeCompTypeRef$fHasSUERefCompTypeRef$fHasCompTyKindCompTypeRef$fOrdTypeQuals $fEqTypeQuals $fPosAttr $fCNodeAttr$fPosEnumerator$fCNodeEnumerator $fPosEnumType$fCNodeEnumType$fHasSUERefEnumType$fPosTypeDefRef$fCNodeTypeDefRef$fPosParamDecl$fCNodeParamDecl $fPosFunDef $fCNodeFunDef $fPosObjDef $fCNodeObjDef $fPosDecl $fCNodeDecl$fPosIdentDecl$fCNodeIdentDecl$fDeclarationEnumerator$fDeclarationVarDecl$fDeclarationParamDecl$fDeclarationFunDef$fDeclarationObjDef$fDeclarationDecl$fDeclarationIdentDecl$fDeclarationEither $fPosTypeDef$fCNodeTypeDef$fPosMemberDecl$fCNodeMemberDecl$fDeclarationMemberDecl $fPosCompType$fCNodeCompType$fHasCompTyKindCompType$fHasSUERefCompType $fPosTagDef $fCNodeTagDef$fHasSUERefTagDef$fPosDeclEvent$fCNodeDeclEvent$fEqFunctionAttrs$fOrdFunctionAttrs$fDataFunctionAttrs $fDataLinkage $fShowLinkage $fEqLinkage $fOrdLinkage $fDataStorage $fShowStorage $fEqStorage $fOrdStorage$fDataBuiltinType $fDataIntType $fEqIntType $fOrdIntType$fDataFloatType $fEqFloatType$fOrdFloatType$fDataEnumTypeRef$fEqCompTyKind$fOrdCompTyKind$fDataCompTyKind$fDataCompTypeRef$fDataTypeName$fDataTypeQuals $fDataVarName $fDataAttr$fDataDeclAttrs$fDataEnumerator$fDataEnumType$fDataArraySize $fDataType$fDataTypeDefRef $fDataFunType$fDataParamDecl $fDataVarDecl $fDataFunDef $fDataObjDef $fDataDecl$fDataIdentDecl $fDataTypeDef$fDataMemberDecl$fDataCompType $fDataTagDefarithmeticConversionfloatConversion intConversion TypeMismatch RedefKind DuplicateDefDiffKindRedecl ShadowedDefDisagreeLinkage NoLinkageOld RedefInfo RedefErrorBadSpecifierErrorInvalidASTError InvalidAST invalidASTbadSpecifierError typeMismatch redefinition$fShowInvalidASTError$fErrorInvalidASTError$fShowBadSpecifierError$fErrorBadSpecifierError$fErrorRedefError$fShowRedefError$fErrorTypeMismatch$fShowTypeMismatchDeclarationStatusNewDecl RedeclaredKeepDefShadowed KindMismatchDefTable identDeclstagDecls labelDefs memberDeclsrefTable typeTableTagEntry TagFwdDeclCompDeclEnumDecl IdentEntry identOfTyDecl emptyDefTable globalDefs inFileScopeenterFunctionScopeleaveFunctionScopeenterBlockScopeleaveBlockScopeenterMemberDeclleaveMemberDecldeclStatusDescr defineTypeDefdefineGlobalIdentdefineScopedIdentdefineScopedIdentWhen declareTag defineTag defineLabel lookupIdent lookupTag lookupLabellookupIdentInnerlookupTagInner insertType lookupType mergeDefTable$fCNodeTagFwdDecl$fHasSUERefTagFwdDecl$fShowTagEntryKind$fDataDeclarationStatus$fEqTagEntryKind$fOrdTagEntryKindintegralfloating simplePtr uint16_tType uint32_tType uint64_tType size_tType ptrDiffTypeboolTypevoidTypevoidPtr constVoidPtrcharPtr constCharPtr stringType valistTypeisIntegralTypeisFloatingType isPointerType isScalarTypeisFunctionType typeQuals typeQualsUpd typeAttrs typeAttrsUpdbaseType derefTypeDefdeepDerefTypeDefsameType canonicalType getIntType getFloatTypebuiltins TravState userState TravOptionslanguage CLanguageC89C99GNU89GNU99Trav MonadTrav handleDecl MonadCErrorthrowTravErrorcatchTravError recordError getErrors MonadSymtab getDefTable withDefTable MonadNamegenName handleTagDecl handleTagDefhandleEnumeratorDef handleTypeDefhandleAsmBlock handleVarDeclhandleParamDecl handleFunDefhandleObjectDefenterPrototypeScopeleavePrototypeScope lookupTypeDef lookupObject createSUERefhandleTravError hadHardErrorsastError throwOnLeftwarnrunTravrunTrav_withExtDeclHandler travErrors initTravStatemodifyUserState getUserState modifyOptions mapMaybeMmaybeMmapSndM concatMapM$fMonadTravTrav$fMonadCErrorTrav$fMonadSymtabTrav$fMonadNameTrav $fMonadTrav$fApplicativeTrav $fFunctorTravexport exportDeclrexportTypeDecl exportTypeDef exportTypeexportTypeSpecexportCompTypeDeclexportEnumTypeDeclexportCompTypeexportCompTypeRefexportEnumTypeexportEnumTypeRef prettyAssocsprettyAssocsWithglobalDeclStats $fPrettyAttr $fPretty[]$fPrettyVarName$fPrettyLinkage$fPrettyStorage$fPrettyFunctionAttrs$fPrettyEnumerator$fPrettyEnumType$fPrettyMemberDecl$fPrettyCompType$fPrettyTypeQuals $fPrettyType$fPrettyDeclAttrs$fPrettyParamDecl$fPrettyVarDecl$fPrettyFunDef$fPrettyObjDef$fPrettyTypeDef $fPrettyDecl$fPrettyIdentDecl$fPrettyTagDef$fPrettySUERef $fPrettyIdent$fPrettyEnumTypeRef$fPrettyCompTypeRef$fPrettyCompTyKind$fPrettyTagFwdDecl$fPrettyEither$fPrettyGlobalDecls$fPrettyDefTableExprSideLValueRValueStmtCtxFunCtxLoopCtx SwitchCtxtExprTypeSpecAnalysisTSNoneTSVoidTSBoolTSNum TSTypeDefTSType TSNonBasic NumTypeSpecbasesignSpecsizeMod isComplexSizeMod NoSizeModShortModLongMod LongLongModSignSpec NoSignSpecSignedUnsigned NumBaseType NoBaseTypeBaseCharBaseInt BaseInt128 BaseFloat BaseFloatN BaseDouble VarDeclInfo StorageSpec NoStorageSpecAutoSpecRegSpec ThreadSpec StaticSpec ExternSpechasThreadLocalSpecanalyseVarDecl'analyseVarDecl isTypeDefanalyseTypeDecltType tDirectTypetNumType tArraySize tTypeQualscanonicalTypeSpeccanonicalStorageSpec mergeOldStyletAttr mkVarName nameOfDecl getOnlyDeclr$fEqStorageSpec$fOrdStorageSpec$fShowStorageSpec$fReadStorageSpec$fEqNumBaseType$fOrdNumBaseType $fEqSignSpec $fOrdSignSpec $fEqSizeMod $fOrdSizeMod MachineDesciSizefSize builtinSizeptrSizevoidSizeiAlignfAlign builtinAlignptrAlign voidAlignintExpr sizeofType alignofTypecompSizeintOpintUnOp withWordBytes boolValueintValue constEvalpTypetypeErrorOnLeft typeErrornotFound checkScalar'checkIntegral'assignCompatible' binopType'conditionalType' checkScalar checkIntegral constType compatible compositeType compositeSize sizeEqual mergeAttrscompositeParamDeclcompositeParamDecl'compositeVarDeclcompositeDeclAttrscastCompatibleassignCompatible binopTypeconditionalType derefType varAddrType fieldType tagMembersexpandAnonymous lookupSUE deepTypeAttrs typeDefAttrssueAttrs getSubStmts mapSubStmtsmapBlockItemStmts getLabels analyseAST analyseExt analyseFunDef analyseDecl defineParamsanalyseFunctionBodytStmt defaultMD tDesignator $fEqExprSide$fShowExprSideCppArgs cppOptions extraOptions cppTmpDir inputFile outputFile CppOption IncludeDirDefineUndefine IncludeFile Preprocessor parseCPPArgsrunCPPcppFile rawCppArgs addCppOptionaddExtraOptionrunPreprocessorisPreprocessedGCCnewGCC$fPreprocessorGCC parseCFile parseCFilePreNsMapGHC.BaseString posFileInfo FilePosition posSrcFile posParentFile NoPositionBuiltinPositionInternalPositionRListReversedempty singletonsnocrappendappendrrappendrrmapreverseviewrghc-prim GHC.TypesCharisAsciiSourceCharisCChar escapeCCharisSChar ClangCTokClangCVersionTokClangBuiltinConvertVectorGnuCTok GnuCAttrTok GnuCExtTok GnuCVaArg GnuCOffsetof GnuCTyCompatGnuCComplexRealGnuCComplexImagCTokenCTokEof CTokLParen CTokRParen CTokLBracket CTokRBracket CTokArrowCTokDot CTokExclam CTokTildeCTokIncCTokDecCTokPlus CTokMinusCTokStar CTokSlash CTokPercent CTokAmper CTokShiftL CTokShiftRCTokLess CTokLessEqCTokHigh CTokHighEq CTokEqual CTokUnequalCTokHatCTokBarCTokAndCTokOr CTokQuest CTokColon CTokAssign CTokPlusAss CTokMinusAss CTokStarAss CTokSlashAss CTokPercAss CTokAmpAss CTokHatAss CTokBarAss CTokSLAss CTokSRAss CTokComma CTokSemic CTokLBrace CTokRBrace CTokEllipsis CTokAlignof CTokAlignasCTokAsm CTokAtomicCTokAuto CTokBreakCTokBoolCTokCaseCTokChar CTokConst CTokContinue CTokComplex CTokDefaultCTokDo CTokDoubleCTokElseCTokEnum CTokExtern CTokFloat CTokFloatNCTokFor CTokGenericCTokGotoCTokIf CTokInlineCTokInt CTokInt128CTokLong CTokLabel CTokNoreturn CTokNullable CTokNonnull CTokRegister CTokRestrict CTokReturn CTokShort CTokSigned CTokSizeof CTokStaticCTokStaticAssert CTokStruct CTokSwitch CTokTypedef CTokTypeof CTokThread CTokUnion CTokUnsignedCTokVoid CTokVolatile CTokWhileCTokCLitCTokILitCTokFLitCTokSLit CTokIdent CTokTyIdentCTokGnuC CTokClangC posLenOfTok setLastTokenhandleEofTokenfailP getNewNamesetPosgetPos addTypedef shadowTypedef isTypeIdent enterScopegetInputsetInput getLastToken getSavedTokengetCurrentPositionunPPStatecurPoscurInput prevToken savedToken namesupplytyidentsscopes ParseResultPOkPFailed parseErrorlexCAlexAcc AlexAccNone AlexAccSkip AlexLastAccAlexNone AlexLastSkip AlexReturnAlexEOF AlexErrorAlexSkip AlexTokenAlexAddrAlexA#GHC.Num* HappyAddrHappyA#HappyStk Happy_IntList HappyConsCDeclrRLocatedL HappyAbsSyn declOfDeftagKind TagEntryKindCompKindEnumKindconstPtrisVariablyModifiedType sameArraySizeTrueaddRef symbolTablererrors nameGeneratordoHandleExtDecloptionsunTravexportFunAttrs exportStorage tParamDeclcomputeParamStorage tMemberDeclsmergeTypeAttributes tEnumTypeDecl tEnumType splitCDeclanalyseTypeDefcomputeFunDefStorage extFunProto extVarDecl localVarDeclenclosingFunctionType tBlockItemtExpr' builtinTypepreprocessedExt mkOutputFilegetOutputFileName mkTmpFilegccParseCPPArgsgccPath