Eagle Legacy Modernization, LLC

C Grammar

Main program: C_Program

 Count  Terminals:
7,587 CMacro_Define_Definition: An identifier
33,577 CMacro_EndOfLine: End of line
2,784 CMacro_Identifier_Reference: An identifier
7,101 CMacro_IncludeSys: A string enclosed in quotes
1,327 CMacro_Parameter_Definition: An identifier
7,096 CMacro_RestOfLine: Rest of the line
5,914 C_Character_Literal: A string enclosed in quotes
2,528,675 C_Comment: Comment
231,027 C_Field_Definition: An identifier
102,893 C_Function_Definition: An identifier
1,501 C_HexNumber: A hex number
1,697,456 C_Identifier_Reference: An identifier
164 C_Label_Definition: An identifier
73,982 C_Literal: A string enclosed in quotes
158,634 C_Number: A number
35,640 C_Type_Definition: An identifier
425,717 C_Variable_Definition: An identifier
 Count  Statistics(*) Tokens:
243,065 all all 2.41(83%) 0% C_ArgumentList: C_ExpressionArg [C_Comment] [C_MoreArguments]* [',']
730,750 (none | 100% | none | 0%) |   C_ExpressionArg: (C_ExpressionArgType | C_Expression | "const" | C_TypePrimitive)
    |   |   C_ExpressionArgType: C_Identifier_Reference C_TypeStar*
487,685 all all all all |   C_MoreArguments: ',' [C_Comment] C_ExpressionArg [C_Comment]
6,189 all 1.08(4%) C_Assignment: C_Expression [C_MoreAssignments]*
240 all all |   C_MoreAssignments: ',' C_Expression
35,882 (0% | 100%) C_Data: (C_FunctionPointer | C_RegularData)
73,920 all all all all all all all all all 1.78(63%) all 98% |   C_FunctionPointer: [("const"|"extern"|"inline"|"register"|"static"|"virtual"|"volatile"|"CM_PUBLIC"|"CM_PRIVATE")] C_Type '(' '*' C_Field_Definition ')' '(' [C_Comment] [C_FunctionParameter] [C_MoreParameterDefs]* ')' [';']
35,872 all all all 1.04(8%) 14% 1.69(10%) all 2.35(17%) |   C_RegularData: [("const"|"extern"|"inline"|"register"|"static"|"virtual"|"volatile"|"CM_PUBLIC"|"CM_PRIVATE")] C_Type C_Variable_Definition [C_Subscript]* [C_DataInitialValue] [C_MoreIdentifiers]* ';' [C_Comment]*
5,345 all all |   |   C_DataInitialValue: '=' C_Expression
5,879 all 1.05(19%) all 1.13(2%) 2% |   |   C_MoreIdentifiers: ',' [C_TypeStar]* C_Variable_Definition [C_Subscript]* [C_DataInitialValue]
1,736,446 (0% | 9% | 0% | 4% | 1% | 0% | 14% | 0% | 0% | 0% | 7% | 0% | 0% | 0% | 1% | 1% | 51% | 2% | 0% | 2% | 0% | 0% | 0% | 0% | 0% | 0% | 1% | 0% | 1% | 1% | 0% | 0% | 0% | 0% | 0% | 0% | 5%) C_Expression: (C_HexNumber | C_Number | C_Character_Literal | C_Literals | C_CastExpression | C_ExpressionList | C_FunctionCall | C_FunctionPointerCall | C_PreIncrementExpression | C_PreDecrementExpression | C_PostIncrementExpression | C_PostDecrementExpression | C_SignedExpression | C_LogicalNotExpression | C_NotExpression | C_BuiltIn | C_VariableExpression | C_AddressOfVariable | C_SizeOf | C_Parenthesized_Expression | C_StarExpression | C_CommentExpression | C_SubscriptExpression | C_DotSubfield | C_ArrowSubfield | C_MultiplicativeExpression | C_AdditiveExpression | C_ShiftExpression | C_RelationalExpression | C_EqualityExpression | C_BitwiseAndExpression | C_ExclusiveOrExpression | C_BitwiseOrExpression | C_ConditionalAndExpression | C_ConditionalOrExpression | C_TrueFalseExpression | C_AssignmentExpression)
10,588 all all all |   C_AdditiveExpression: C_Expression ("+"|"-") C_Expression
30,388 all all |   C_AddressOfVariable: '&' C_Expression
206 all all all |   C_ArrowSubfield: C_Expression "->" C_Expression
81,591 all all all |   C_AssignmentExpression: C_Expression ("="|"*="|"/="|"%="|"+="|"-="|"<<="|">>="|">>>="|"&="|"^="|"|=") C_Expression
127 all all all |   C_BitwiseAndExpression: C_Expression '&' C_Expression
178 all all all |   C_BitwiseOrExpression: C_Expression '|' C_Expression
12,060 all |   C_BuiltIn: ("false"|"true"|"NULL")
17,804 all all all all |   C_CastExpression: '(' C_Type ')' C_Expression
122 all all |   C_CommentExpression: C_Comment C_Expression
4,232 all all all |   C_ConditionalAndExpression: C_Expression "&&" C_Expression
4,453 all all all |   C_ConditionalOrExpression: C_Expression "||" C_Expression
4,018 all all all |   C_DotSubfield: C_Expression '.' C_Expression
18,378 all all all |   C_EqualityExpression: C_Expression ("=="|"!=") C_Expression
19 all all all |   C_ExclusiveOrExpression: C_Expression '^' C_Expression
2,104 all all all all |   C_ExpressionList: '{' [C_ArgumentList] [C_Comment] '}'
241,182 all all 99% all |   C_FunctionCall: C_Variable '(' [C_ArgumentList] ')'
1,710 all 4% all all all 100% all |   C_FunctionPointerCall: '(' ['*'] C_Variable ')' '(' [C_ArgumentList] ')'
69,453 1.01 |   C_Literals: C_Literal*
18 all all |   C_LogicalNotExpression: '~' C_Expression
4,201 all all all |   C_MultiplicativeExpression: C_Expression ("*"|"/"|"%") C_Expression
9,769 all all |   C_NotExpression: '!' C_Expression
27,274 all |   C_Parenthesized_Expression: C_ParenthesizedExpression
372 all all |   C_PostDecrementExpression: C_Variable "--"
125,416 all all |   C_PostIncrementExpression: C_Variable "++"
56 all all |   C_PreDecrementExpression: "--" C_Expression
801 all all |   C_PreIncrementExpression: "++" C_Expression
12,976 all all all |   C_RelationalExpression: C_Expression ("<"|">"|"<="|">=") C_Expression
44 all all all |   C_ShiftExpression: C_Expression ("<<"|">>"|">>>") C_Expression
459 all all |   C_SignedExpression: ("+"|"-") C_Expression
1,464 all all all all |   C_SizeOf: "sizeof" '(' C_Type ')'
195 all all |   C_StarExpression: '*' C_Expression
203 all all all all |   C_SubscriptExpression: C_Expression '[' C_Expression ']'
944 all all all all all |   C_TrueFalseExpression: C_Expression '?' C_Expression ':' C_Expression
887,691 all |   C_VariableExpression: C_Variable
101,799 all all all all all 2.69(0%) all C_Function: [("const"|"extern"|"inline"|"register"|"static"|"virtual"|"volatile"|"CM_PUBLIC"|"CM_PRIVATE")] [C_Comment] [("const"|"extern"|"inline"|"register"|"static"|"virtual"|"volatile"|"CM_PUBLIC"|"CM_PRIVATE")] C_FunctionTypeName C_Function_ParameterDefs [C_Comment]* C_FunctionBody
101,850 (10% | 90%) |   C_FunctionBody: (C_FunctionImplementation | ';')
10,321 all 36.61(99%) all none |   |   C_FunctionImplementation: '{' [C_StatementOrComment]* '}' [';']
401,191 (1% | 99% | 0%) |   C_FunctionParameter: (C_FunctionDotDotDotParameter | C_FunctionRegularParameter | C_FunctionPointer)
2,215 all |   |   C_FunctionDotDotDotParameter: "..."
397,696 all all 93% 1.05(0%) all |   |   C_FunctionRegularParameter: ["const"] C_Type [C_Variable_Definition] [C_Subscript]* [C_Comment]
101,799 (100% | 0%) |   C_FunctionTypeName: (C_Function_TypeAndName | "main")
101,723 all 1.00(0%) all |   |   C_Function_TypeAndName: C_Type [C_Comment]* C_Function_Definition
103,344 all all 100% all 2.29(60%) all |   C_Function_ParameterDefs: '(' [C_Comment] [C_FunctionParameter] [C_Comment] [C_MoreParameterDefs]* ')'
224,088 all all all |   C_MoreParameterDefs: ',' [C_Comment] C_FunctionParameter
164 all all C_Label: C_Label_Definition ':'
27,274 all all all C_ParenthesizedExpression: '(' C_Expression ')'
2,078 117.20(all) C_Program: [C_StatementOrComment]*
731,975 (0% | 15% | 3% | none | 14% | 67% | 1%) |   C_StatementOrComment: (C_Enum | C_Comment | C_TypeDef | C_Data | C_Function | C_Statement | C_Type)
754 all all |   |   C_Enum: C_TypeEnum ';'
559,751 (7% | 6% | 0% | 0% | 4% | 1% | 0% | 0% | 1% | 9% | 3% | 0% | 0% | 67%) C_Statement: (C_StatementBlock | C_Data | C_Label | ';' | CMacro_StatementOrComment | C_BreakStatement | C_ContinueStatement | C_DoStatement | C_ForStatement | C_IfStatement | C_ReturnStatement | C_SwitchStatement | C_WhileStatement | C_ExpressionStatement)
39,954 all 2.14(100%) all |   C_StatementBlock: '{' [C_StatementOrComment]* '}'
155,742 all 99% all C_Subscript: '[' [C_Expression] ']'
812,771 all none 0% C_Type: C_TypeBase [C_TypeGeneric] [C_TypeFunction]
812,771 (none | 0% | 58% | 0% | 2% | 0% | 40%) |   C_TypeBase: (C_NamespaceType | C_TypeEnum | C_TypePrimitive | C_TypeShortUnsignedInt | C_TypeStruct | C_TypeUnion | C_TypeUserDefined)
    |   |   C_NamespaceType: C_Identifier_Reference "::" C_TypeBase
1,879 all 44% 89% |   |   C_TypeEnum: "enum" [C_Identifier_Reference] [C_TypeEnumValues]
1,679 all 1.25(21%) all 68% none 6.92(99%) all |   |   |   C_TypeEnumValues: '{' [C_Comment]* C_Variable_Definition [C_EnumInitializer] [C_Comment]* [C_MoreEnums]* '}'
4,242 all all |   |   |   |   C_EnumInitializer: '=' C_Expression
11,506 all 1.39(22%) all 27% 1.00(2%) |   |   |   |   C_MoreEnums: ',' [C_Comment]* C_Variable_Definition [C_EnumInitializer] [C_Comment]*
474,247 all all all all 1.09(39%) |   |   C_TypePrimitive: ["const"] ["unsigned"] ("char"|"double"|"float"|"int"|"long"|"short"|"void") ["int"] [C_TypeStar]*
49 all all all 1.00(71%) |   |   C_TypeShortUnsignedInt: ("long"|"short") "unsigned" "int" [C_TypeStar]*
15,541 none all all 100% all all 14.49(all) all 58% |   |   C_TypeStruct: [C_Comment]* "struct" [C_Comment] [C_Type_Definition] [C_Comment] '{' [C_FieldOrComment]* '}' [';']
226,281 (68% | 0% | 32% | none) |   |   |   C_FieldOrComment: (C_Field | C_Comment | C_FunctionPointer | C_TypeUnion)
153,104 all all 1.03(2%) none 1.50(2%) all 1.03(17%) |   |   |   |   C_Field: C_Type C_Field_Definition [C_Subscript]* [C_FieldInitialValue] [C_MoreFields]* ';' [C_Comment]*
    |   |   |   |   |   C_FieldInitialValue: '=' C_Expression
4,003 all 1.26(12%) all 1.00(1%) none |   |   |   |   |   C_MoreFields: ',' ['*']* C_Field_Definition [C_Subscript]* [C_FieldInitialValue]
205 all 80% all 4.99(all) all none |   |   C_TypeUnion: "union" [C_Type_Definition] '{' [C_FieldOrComment]* '}' [';']
322,311 all all 1.02(68%) |   |   C_TypeUserDefined: ["struct"] C_Identifier_Reference [C_TypeStar]*
426,695 all |   |   |   C_TypeStar: ("*"|"&")
324 all all all all |   C_TypeFunction: '(' '*' ')' C_Function_ParameterDefs
    |   C_TypeGeneric: '<' C_Type* '>'
20,415 all all all all C_TypeDef: "typedef" ["interface"] C_TypeDef_What ';'
20,415 (94% | 5% | 1%) |   C_TypeDef_What: (C_TypeDef_Data | C_TypeDef_Function | C_TypeDef_NoParensFunction)
19,245 all 0% all 1.00(4%) |   |   C_TypeDef_Data: C_Type ['*'] C_Type_Definition [C_TypeDefMore]*
736 all 98% all |   |   |   C_TypeDefMore: ',' ['*'] C_Type_Definition
1,010 all all all all all all |   |   C_TypeDef_Function: C_Type '(' '*' C_Function_Definition ')' C_Function_ParameterDefs
160 all all all |   |   C_TypeDef_NoParensFunction: C_Type C_Function_Definition C_Function_ParameterDefs
1,256,371 1.01(0%) all 1.19(8%) 1.08(1%) C_Variable: [C_VariableStar]* C_VariableIdentifier [C_ExtendedIdentifier]* [C_Subscript]*
117,854 (86% | none | 14%) |   C_ExtendedIdentifier: (C_ArrowIdentifier | C_ColonColonIdentifier | C_DotIdentifier)
101,941 all all |   |   C_ArrowIdentifier: "->" C_Identifier_Reference
    |   |   C_ColonColonIdentifier: "::" C_Identifier_Reference
15,913 all all |   |   C_DotIdentifier: '.' C_Identifier_Reference
1,256,371 (0% | 0% | 11% | 89%) |   C_VariableIdentifier: (C_CastedVariable | C_IndirectVariable | C_SubscriptedVariable | C_Identifier_Reference)
393 all all all all all all |   |   C_CastedVariable: '(' '(' C_Type ')' C_Identifier_Reference ')'
671 all 1.00 all all |   |   C_IndirectVariable: '(' C_VariableStar* C_Identifier_Reference ')'
134,177 all 1.01 |   |   C_SubscriptedVariable: C_Identifier_Reference C_Subscript*
6,826 all |   C_VariableStar: '*'
5,608 all all C_BreakStatement: "break" ';'
1,334 all all C_ContinueStatement: "continue" ';'
168 all all all all all all all all C_DoStatement: "do" [C_Comment] C_Statement "while" '(' C_Expression ')' ';'
376,798 all all C_ExpressionStatement: C_Expression ';'
6,119 (none | all) C_ForStatement: (C_ForCollectionStatement | C_ForLoopStatement)
    |   C_ForCollectionStatement: "for" '(' C_Type C_Variable ':' C_Expression ')' C_Statement
6,119 all all 99% all all 99% all all 99% 1.00(3%) all all all all |   C_ForLoopStatement: "for" '(' [C_ForLoopVariable] [C_Comment] ';' [C_Expression] [C_Comment] ';' [C_Expression] [C_MoreLoopIncrements]* [C_Comment] ')' [C_Comment] C_Statement
6,189 (all | none) |   |   C_ForLoopVariable: (C_ForLoopVariableNoType | C_ForLoopVariableWithType)
6,189 all |   |   |   C_ForLoopVariableNoType: C_Assignment
    |   |   |   C_ForLoopVariableWithType: C_Type C_Assignment
160 all all |   |   C_MoreLoopIncrements: ',' C_ForLoopVariable
52,799 all all all all all 1.01(1%) all 14% C_IfStatement: "if" '(' C_Expression [C_Comment] ')' [C_Comment]* C_Statement [C_IfElseClause]
7,354 1.05(1%) all 1.00(3%) all |   C_IfElseClause: [C_Comment]* "else" [C_Comment]* C_Statement
17,210 all 85% all C_ReturnStatement: "return" [C_Expression] ';'
1,141 all all all all all all 5.64 all C_SwitchStatement: "switch" '(' C_Expression ')' [C_Comment] '{' C_SwitchClause* '}'
5,835 all all all 2.94(79%) |   C_CaseClause: "case" C_Expression ':' [C_StatementOrComment]*
594 all all 1.87(99%) |   C_DefaultClause: "default" ':' [C_StatementOrComment]*
6,436 (0% | 91% | 9%) |   C_SwitchClause: (C_Comment | C_CaseClause | C_DefaultClause)
1,045 all all all all all all C_WhileStatement: "while" '(' C_Expression ')' [C_Comment] C_Statement
979 (10% | none | none | none | 55% | 5% | 8% | 1% | none | none | none | 0% | 0% | none | none | none | 5% | 16% | none) CMacro_Expression: (C_Number | C_HexNumber | C_Literal | C_Character_Literal | CMacro_FunctionCall | CMacro_IdentifierExpression | CMacro_NotExpression | CMacro_ParenthesizedExpression | CMacro_SymbolExpression | CMacro_MultiplicativeExpression | CMacro_AdditiveExpression | CMacro_RelationalExpression | CMacro_EqualityExpression | CMacro_BitwiseAndExpression | CMacro_ExclusiveOrExpression | CMacro_BitwiseOrExpression | CMacro_ConditionalAndExpression | CMacro_ConditionalOrExpression | CMacro_ConcatenateExpression)
    |   CMacro_AdditiveExpression: CMacro_Expression ("+"|"-") CMacro_Expression
    |   CMacro_BitwiseAndExpression: CMacro_Expression '&' CMacro_Expression
    |   CMacro_BitwiseOrExpression: CMacro_Expression '|' CMacro_Expression
    |   CMacro_ConcatenateExpression: CMacro_Expression "##" CMacro_Expression
49 all all all |   CMacro_ConditionalAndExpression: CMacro_Expression "&&" CMacro_Expression
160 all all all |   CMacro_ConditionalOrExpression: CMacro_Expression "||" CMacro_Expression
2 all all all |   CMacro_EqualityExpression: CMacro_Expression ("=="|"!=") CMacro_Expression
    |   CMacro_ExclusiveOrExpression: CMacro_Expression '^' CMacro_Expression
540 all all all all |   CMacro_FunctionCall: "defined" '(' CMacro_Identifier_Reference ')'
45 all |   CMacro_IdentifierExpression: CMacro_Identifier_Reference
    |   CMacro_MultiplicativeExpression: CMacro_Expression ("*"|"/"|"%") CMacro_Expression
75 all all |   CMacro_NotExpression: '!' CMacro_Expression
10 all all all |   CMacro_ParenthesizedExpression: '(' CMacro_Expression ')'
4 all all all |   CMacro_RelationalExpression: CMacro_Expression ("<"|">"|"<="|">=") CMacro_Expression
    |   CMacro_SymbolExpression: '#' CMacro_Expression
21,586 1% all all all CMacro_StatementOrComment: [CMacro_EndOfLine] CMacro_StmtBody [C_Comment] CMacro_EndOfLine
21,586 (none | 35% | 2% | 2% | 10% | 51% | 0% | 0%) |   CMacro_StmtBody: (CMacro_IfDefCPlusPlus | CMacro_Define_Statement | CMacro_Error_Statement | CMacro_If_Statement | CMacro_IfDef_Statement | CMacro_Include_Statement | CMacro_Pragma_Statement | CMacro_Undef_Statement)
7,587 all all all all 9% 89% all CMacro_Define_Statement: '#' "define" CMacro_Define_Definition [C_Comment] [CMacro_Parameters] [CMacro_RestOfLine] [C_Comment]
703 all 2.78 all |   CMacro_Parameters: '(' CMacro_Parameter_Definition* ')'
364 all all all CMacro_Error_Statement: '#' "error" [CMacro_RestOfLine]
2,158 all all all all all 14.94(all) 1.33(0%) 13% none all all CMacro_IfDef_Statement: '#' ("ifdef"|"ifndef") CMacro_Identifier_Reference [C_Comment] CMacro_EndOfLine [CMacro_IfDefElement]* [CMacro_IfDefElif]* [CMacro_IfDefElse] [CMacro_EndOfLine] '#' "endif"
    |   CMacro_IfDefCPlusPlus: '#' "ifdef" "__cplusplus" CMacro_EndOfLine "extern" C_Literal '{' CMacro_EndOfLine '#' "endif" CMacro_EndOfLine [CMacro_IfDefElement]* '#' "ifdef" "__cplusplus" CMacro_EndOfLine '}' [C_Comment] CMacro_EndOfLine '#' "endif"
13,848 all |   CMacro_IfDefElement: C_StatementOrComment
8 all all all all all 3.67(75%) |   CMacro_IfDefElif: '#' "elif" CMacro_Expression [C_Comment] [CMacro_EndOfLine] [CMacro_IfDefElement]*
277 none all all all all 1.78(all) |   CMacro_IfDefElse: [CMacro_EndOfLine] '#' "else" [C_Comment] CMacro_EndOfLine [CMacro_IfDefElement]*
353 all all all all all 3.08(100%) 4.48(7%) 24% none all all all CMacro_If_Statement: '#' "if" CMacro_Expression [C_Comment] CMacro_EndOfLine [CMacro_IfElement]* [CMacro_IfElif]* [CMacro_IfElse] [CMacro_EndOfLine] '#' "endif" [C_Comment]
806 all |   CMacro_IfElement: C_StatementOrComment
103 all all all all all 1.28(92%) |   CMacro_IfElif: '#' "elif" CMacro_Expression [C_Comment] [CMacro_EndOfLine] [CMacro_IfElement]*
83 all all all 77% 1.81(all) |   CMacro_IfElse: '#' "else" [C_Comment] [CMacro_EndOfLine] [CMacro_IfElement]*
11,078 all all all CMacro_Include_Statement: '#' "include" CMacro_IncludeWhat
11,078 (36% | 64%) |   CMacro_IncludeWhat: (C_Literal | CMacro_IncludeSys)
5 all all all CMacro_Pragma_Statement: '#' "pragma" CMacro_Pragma_Type
5 (none | all | none) |   CMacro_Pragma_Type: (CMacro_Pragma_Pack | CMacro_Pragma_Warning | "once")
    |   |   CMacro_Pragma_Pack: "pack" '(' ["push"] ')'
5 all all all all 1.00 all |   |   CMacro_Pragma_Warning: "warning" '(' "disable" ':' C_Number* ')'
41 all all all CMacro_Undef_Statement: '#' "undef" CMacro_Identifier_Reference

Terminals = 17 (instances=5,321,075)
Tokens = 155 (instances=14,810,229)

(*) Statistics are shown in the same order as the Tokens.
Percentages are rounded; 'all' and 'none' mean 100% and 0% before rounding.
For lists, it shows the average number of occurrences, excluding empty lists.