Eagle Legacy Modernization, LLC

C Grammar

Main program: C_Program

 Count  Terminals:
2,382 CMacro_Define_Definition: An identifier
19,677 CMacro_EndOfLine: End of line
905 CMacro_Identifier_Reference: An identifier
5,344 CMacro_IncludeSys: A string enclosed in quotes
403 CMacro_Parameter_Definition: An identifier
2,550 CMacro_RestOfLine: Rest of the line
4,329 C_Character_Literal: A string enclosed in quotes
1,818,101 C_Comment: Comment
226,266 C_Field_Definition: An identifier
93,450 C_Function_Definition: An identifier
743 C_HexNumber: A hex number
1,041,035 C_Identifier_Reference: An identifier
91 C_Label_Definition: An identifier
42,397 C_Literal: A string enclosed in quotes
96,614 C_Number: A number
34,833 C_Type_Definition: An identifier
394,143 C_Variable_Definition: An identifier
 Count  Statistics(*) Tokens:
130,470 all all 2.41(82%) 0% C_ArgumentList: C_ExpressionArg [C_Comment] [C_MoreArguments]* [',']
387,839 (none | 100% | none | 0%) |   C_ExpressionArg: (C_ExpressionArgType | C_Expression | "const" | C_TypePrimitive)
    |   |   C_ExpressionArgType: C_Identifier_Reference C_TypeStar*
257,369 all all all all |   C_MoreArguments: ',' [C_Comment] C_ExpressionArg [C_Comment]
4,458 all 1.10(3%) C_Assignment: C_Expression [C_MoreAssignments]*
158 all all |   C_MoreAssignments: ',' C_Expression
23,860 (0% | 100%) C_Data: (C_FunctionPointer | C_RegularData)
74,302 all all all all all all all all all 1.77(63%) all 98% |   C_FunctionPointer: [("const"|"extern"|"inline"|"register"|"static"|"virtual"|"volatile")] C_Type '(' '*' C_Field_Definition ')' '(' [C_Comment] [C_FunctionParameter] [C_MoreParameterDefs]* ')' [';']
23,856 all all none all 1.05(8%) 13% 1.75(9%) all 2.48(23%) |   C_RegularData: [("const"|"extern"|"inline"|"register"|"static"|"virtual"|"volatile")] C_Type [C_Comment]* C_Variable_Definition [C_Subscript]* [C_DataInitialValue] [C_MoreIdentifiers]* ';' [C_Comment]*
3,139 all all |   |   C_DataInitialValue: '=' C_Expression
3,849 all 1.05(17%) all 1.14(2%) 3% |   |   C_MoreIdentifiers: ',' [C_TypeStar]* C_Variable_Definition [C_Subscript]* [C_DataInitialValue]
966,370 (0% | 10% | 0% | 4% | 1% | 0% | 13% | 0% | 0% | 0% | 0% | 7% | 0% | 0% | 0% | 0% | 1% | 1% | 50% | 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_PostIncrementVariable | C_PostDecrementExpression | C_PostDecrementVariable | 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)
7,260 all all all |   C_AdditiveExpression: C_Expression ("+"|"-") C_Expression
16,673 all all |   C_AddressOfVariable: '&' C_Expression
106 all all all |   C_ArrowSubfield: C_Expression "->" C_Expression
49,557 all all all |   C_AssignmentExpression: C_Expression ("="|"*="|"/="|"%="|"+="|"-="|"<<="|">>="|">>>="|"&="|"^="|"|=") C_Expression
74 all all all |   C_BitwiseAndExpression: C_Expression '&' C_Expression
94 all all all |   C_BitwiseOrExpression: C_Expression '|' C_Expression
7,255 all |   C_BuiltIn: ("false"|"true"|"NULL")
10,106 all all all all |   C_CastExpression: '(' C_Type ')' C_Expression
116 all all |   C_CommentExpression: C_Comment C_Expression
2,684 all all all |   C_ConditionalAndExpression: C_Expression "&&" C_Expression
2,749 all all all |   C_ConditionalOrExpression: C_Expression "||" C_Expression
1,906 all all all |   C_DotSubfield: C_Expression '.' C_Expression
12,326 all all all |   C_EqualityExpression: C_Expression ("=="|"!=") C_Expression
11 all all all |   C_ExclusiveOrExpression: C_Expression '^' C_Expression
1,157 all all all all |   C_ExpressionList: '{' [C_ArgumentList] [C_Comment] '}'
129,451 all all 99% all |   C_FunctionCall: C_Variable '(' [C_ArgumentList] ')'
1,082 all 6% all all all 100% all |   C_FunctionPointerCall: '(' ['*'] C_Variable ')' '(' [C_ArgumentList] ')'
41,000 1.01 |   C_Literals: C_Literal*
18 all all |   C_LogicalNotExpression: '~' C_Expression
3,010 all all all |   C_MultiplicativeExpression: C_Expression ("*"|"/"|"%") C_Expression
6,135 all all |   C_NotExpression: '!' C_Expression
16,296 all |   C_Parenthesized_Expression: C_ParenthesizedExpression
3 all all |   C_PostDecrementExpression: C_Parenthesized_Expression "--"
270 all all |   C_PostDecrementVariable: C_Variable "--"
188 all all |   C_PostIncrementExpression: C_Parenthesized_Expression "++"
63,574 all all |   C_PostIncrementVariable: C_Variable "++"
36 all all |   C_PreDecrementExpression: "--" C_Expression
424 all all |   C_PreIncrementExpression: "++" C_Expression
8,502 all all all |   C_RelationalExpression: C_Expression ("<"|">"|"<="|">=") C_Expression
35 all all all |   C_ShiftExpression: C_Expression ("<<"|">>"|">>>") C_Expression
292 all all |   C_SignedExpression: ("+"|"-") C_Expression
1,235 all all all all |   C_SizeOf: "sizeof" '(' C_Type ')'
139 all all |   C_StarExpression: '*' C_Expression
117 all all all all |   C_SubscriptExpression: C_Expression '[' C_Expression ']'
616 all all all all all |   C_TrueFalseExpression: C_Expression '?' C_Expression ':' C_Expression
480,403 all |   C_VariableExpression: C_Variable
92,360 all all all all all 2.29(0%) all C_Function: [("const"|"extern"|"inline"|"register"|"static"|"virtual"|"volatile")] [C_Comment] [("const"|"extern"|"inline"|"register"|"static"|"virtual"|"volatile")] C_FunctionTypeName C_Function_ParameterDefs [C_Comment]* C_FunctionBody
92,411 (7% | 93%) |   C_FunctionBody: (C_FunctionImplementation | ';')
6,345 all 31.23(99%) all none |   |   C_FunctionImplementation: '{' [C_StatementOrComment]* '}' [';']
375,907 (1% | 99% | 0%) |   C_FunctionParameter: (C_FunctionDotDotDotParameter | C_FunctionRegularParameter | C_FunctionPointer)
2,175 all |   |   C_FunctionDotDotDotParameter: "..."
372,572 all all 95% 1.05(0%) all |   |   C_FunctionRegularParameter: ["const"] C_Type [C_Variable_Definition] [C_Subscript]* [C_Comment]
92,360 (100% | 0%) |   C_FunctionTypeName: (C_Function_TypeAndName | "main")
92,297 all 1.00(0%) all |   |   C_Function_TypeAndName: C_Type [C_Comment]* C_Function_Definition
93,745 all all 100% all 2.27(59%) all |   C_Function_ParameterDefs: '(' [C_Comment] [C_FunctionParameter] [C_Comment] [C_MoreParameterDefs]* ')'
208,008 all all all |   C_MoreParameterDefs: ',' [C_Comment] C_FunctionParameter
91 all all C_Label: C_Label_Definition ':'
16,296 all all all C_ParenthesizedExpression: '(' C_Expression ')'
1,359 166.24(all) C_Program: [C_StatementOrComment]*
489,098 (0% | 20% | 4% | none | 19% | 55% | 2%) |   C_StatementOrComment: (C_Enum | C_Comment | C_TypeDef | C_Data | C_Function | C_Statement | C_Type)
704 all all |   |   C_Enum: C_TypeEnum ';'
312,165 (8% | 8% | 0% | 1% | 3% | 1% | 0% | 0% | 1% | 10% | 3% | 0% | 0% | 64%) 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)
25,267 all 2.22(100%) all |   C_StatementBlock: '{' [C_StatementOrComment]* '}'
84,442 all 98% all C_Subscript: '[' [C_Expression] ']'
752,664 all none 0% C_Type: C_TypeBase [C_TypeGeneric] [C_TypeFunction]
752,664 (none | 0% | 58% | 0% | 2% | 0% | 39%) |   C_TypeBase: (C_NamespaceType | C_TypeEnum | C_TypePrimitive | C_TypeShortUnsignedInt | C_TypeStruct | C_TypeUnion | C_TypeUserDefined)
    |   |   C_NamespaceType: C_Identifier_Reference "::" C_TypeBase
1,808 all 45% 89% |   |   C_TypeEnum: "enum" [C_Identifier_Reference] [C_TypeEnumValues]
1,605 all 1.26(21%) all 69% none 6.93(99%) all |   |   |   C_TypeEnumValues: '{' [C_Comment]* C_Variable_Definition [C_EnumInitializer] [C_Comment]* [C_MoreEnums]* '}'
4,138 all all |   |   |   |   C_EnumInitializer: '=' C_Expression
11,022 all 1.40(22%) all 27% 1.00(3%) |   |   |   |   C_MoreEnums: ',' [C_Comment]* C_Variable_Definition [C_EnumInitializer] [C_Comment]*
440,225 all all all all 1.10(38%) |   |   C_TypePrimitive: ["const"] ["unsigned"] ("char"|"double"|"float"|"int"|"long"|"short"|"void") ["int"] [C_TypeStar]*
43 all all all 1.00(79%) |   |   C_TypeShortUnsignedInt: ("long"|"short") "unsigned" "int" [C_TypeStar]*
15,291 none all all 100% all all 14.44(all) all 59% |   |   C_TypeStruct: [C_Comment]* "struct" [C_Comment] [C_Type_Definition] [C_Comment] '{' [C_FieldOrComment]* '}' [';']
221,847 (67% | 0% | 33% | none) |   |   |   C_FieldOrComment: (C_Field | C_Comment | C_FunctionPointer | C_TypeUnion)
148,189 all all 1.04(2%) none 1.48(2%) all 1.03(17%) |   |   |   |   C_Field: C_Type C_Field_Definition [C_Subscript]* [C_FieldInitialValue] [C_MoreFields]* ';' [C_Comment]*
    |   |   |   |   |   C_FieldInitialValue: '=' C_Expression
3,775 all 1.27(12%) all 1.00(1%) none |   |   |   |   |   C_MoreFields: ',' ['*']* C_Field_Definition [C_Subscript]* [C_FieldInitialValue]
205 all 81% all 4.99(all) all none |   |   C_TypeUnion: "union" [C_Type_Definition] '{' [C_FieldOrComment]* '}' [';']
296,239 all all 1.01(70%) |   |   C_TypeUserDefined: ["struct"] C_Identifier_Reference [C_TypeStar]*
396,312 all |   |   |   C_TypeStar: ("*"|"&")
181 all all all all |   C_TypeFunction: '(' '*' ')' C_Function_ParameterDefs
    |   C_TypeGeneric: '<' C_Type* '>'
19,848 all all all all C_TypeDef: "typedef" ["interface"] C_TypeDef_What ';'
19,848 (94% | 5% | 1%) |   C_TypeDef_What: (C_TypeDef_Data | C_TypeDef_Function | C_TypeDef_NoParensFunction)
18,695 all 0% all 1.00(4%) |   |   C_TypeDef_Data: C_Type ['*'] C_Type_Definition [C_TypeDefMore]*
723 all 98% all |   |   |   C_TypeDefMore: ',' ['*'] C_Type_Definition
988 all all all all all all |   |   C_TypeDef_Function: C_Type '(' '*' C_Function_Definition ')' C_Function_ParameterDefs
165 all all all |   |   C_TypeDef_NoParensFunction: C_Type C_Function_Definition C_Function_ParameterDefs
674,780 1.01(1%) all 1.18(9%) 1.13(1%) C_Variable: [C_VariableStar]* C_VariableIdentifier [C_ExtendedIdentifier]* [C_Subscript]*
69,102 (84% | none | 16%) |   C_ExtendedIdentifier: (C_ArrowIdentifier | C_ColonColonIdentifier | C_DotIdentifier)
58,064 all all |   |   C_ArrowIdentifier: "->" C_Identifier_Reference
    |   |   C_ColonColonIdentifier: "::" C_Identifier_Reference
11,038 all all |   |   C_DotIdentifier: '.' C_Identifier_Reference
674,780 (0% | 0% | 10% | 90%) |   C_VariableIdentifier: (C_CastedVariable | C_IndirectVariable | C_SubscriptedVariable | C_Identifier_Reference)
231 all all all all all all |   |   C_CastedVariable: '(' '(' C_Type ')' C_Identifier_Reference ')'
305 all 1.00 all all |   |   C_IndirectVariable: '(' C_VariableStar* C_Identifier_Reference ')'
69,538 all 1.02 |   |   C_SubscriptedVariable: C_Identifier_Reference C_Subscript*
4,294 all |   C_VariableStar: '*'
4,051 all all C_BreakStatement: "break" ';'
795 all all C_ContinueStatement: "continue" ';'
149 all all all all all all all all C_DoStatement: "do" [C_Comment] C_Statement "while" '(' C_Expression ')' ';'
200,314 all all C_ExpressionStatement: C_Expression ';'
4,426 (none | all) C_ForStatement: (C_ForCollectionStatement | C_ForLoopStatement)
    |   C_ForCollectionStatement: "for" '(' C_Type C_Variable ':' C_Expression ')' C_Statement
4,426 all all 98% all all 97% all all 97% 1.00(2%) 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
4,458 (all | none) |   |   C_ForLoopVariable: (C_ForLoopVariableNoType | C_ForLoopVariableWithType)
4,458 all |   |   |   C_ForLoopVariableNoType: C_Assignment
    |   |   |   C_ForLoopVariableWithType: C_Type C_Assignment
105 all all |   |   C_MoreLoopIncrements: ',' C_ForLoopVariable
31,388 all all all all all 1.01(1%) all 16% C_IfStatement: "if" '(' C_Expression [C_Comment] ')' [C_Comment]* C_Statement [C_IfElseClause]
4,883 1.07(1%) all 1.00(3%) all |   C_IfElseClause: [C_Comment]* "else" [C_Comment]* C_Statement
10,677 all 87% all C_ReturnStatement: "return" [C_Expression] ';'
734 all all all all all all 5.74 all C_SwitchStatement: "switch" '(' C_Expression ')' [C_Comment] '{' C_SwitchClause* '}'
3,846 all all all 2.94(79%) |   C_CaseClause: "case" C_Expression ':' [C_StatementOrComment]*
365 all all 1.94(99%) |   C_DefaultClause: "default" ':' [C_StatementOrComment]*
4,216 (0% | 91% | 9%) |   C_SwitchClause: (C_Comment | C_CaseClause | C_DefaultClause)
718 all all all all all all C_WhileStatement: "while" '(' C_Expression ')' [C_Comment] C_Statement
591 (4% | none | none | none | 59% | 2% | 9% | 2% | none | none | none | 0% | none | none | none | none | 7% | 17% | 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
41 all all all |   CMacro_ConditionalAndExpression: CMacro_Expression "&&" CMacro_Expression
102 all all all |   CMacro_ConditionalOrExpression: CMacro_Expression "||" CMacro_Expression
    |   CMacro_EqualityExpression: CMacro_Expression ("=="|"!=") CMacro_Expression
    |   CMacro_ExclusiveOrExpression: CMacro_Expression '^' CMacro_Expression
349 all all all all |   CMacro_FunctionCall: "defined" '(' CMacro_Identifier_Reference ')'
14 all |   CMacro_IdentifierExpression: CMacro_Identifier_Reference
    |   CMacro_MultiplicativeExpression: CMacro_Expression ("*"|"/"|"%") CMacro_Expression
52 all all |   CMacro_NotExpression: '!' CMacro_Expression
9 all all all |   CMacro_ParenthesizedExpression: '(' CMacro_Expression ')'
2 all all all |   CMacro_RelationalExpression: CMacro_Expression ("<"|">"|"<="|">=") CMacro_Expression
    |   CMacro_SymbolExpression: '#' CMacro_Expression
9,758 1% all all all CMacro_StatementOrComment: [CMacro_EndOfLine] CMacro_StmtBody [C_Comment] CMacro_EndOfLine
9,758 (none | 24% | 4% | 2% | 5% | 65% | 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)
2,382 all all all all 9% 92% all CMacro_Define_Statement: '#' "define" CMacro_Define_Definition [C_Comment] [CMacro_Parameters] [CMacro_RestOfLine] [C_Comment]
212 all 2.80 all |   CMacro_Parameters: '(' CMacro_Parameter_Definition* ')'
363 all all all CMacro_Error_Statement: '#' "error" [CMacro_RestOfLine]
536 all all all all all 36.84(all) 2.00(0%) 15% 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"
1,031 all |   CMacro_IfDefElement: C_StatementOrComment
4 all all all all all 2.00(50%) |   CMacro_IfDefElif: '#' "elif" CMacro_Expression [C_Comment] [CMacro_EndOfLine] [CMacro_IfDefElement]*
81 none all all all all 2.43(all) |   CMacro_IfDefElse: [CMacro_EndOfLine] '#' "else" [C_Comment] CMacro_EndOfLine [CMacro_IfDefElement]*
156 all all all all all 4.28(all) 5.00(10%) 28% 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]
268 all |   CMacro_IfElement: C_StatementOrComment
80 all all all all all 1.15(all) |   CMacro_IfElif: '#' "elif" CMacro_Expression [C_Comment] [CMacro_EndOfLine] [CMacro_IfElement]*
44 all all all 77% 1.36(all) |   CMacro_IfElse: '#' "else" [C_Comment] [CMacro_EndOfLine] [CMacro_IfElement]*
6,312 all all all CMacro_Include_Statement: '#' "include" CMacro_IncludeWhat
6,312 (15% | 85%) |   CMacro_IncludeWhat: (C_Literal | CMacro_IncludeSys)
3 all all all CMacro_Pragma_Statement: '#' "pragma" CMacro_Pragma_Type
3 (none | all | none) |   CMacro_Pragma_Type: (CMacro_Pragma_Pack | CMacro_Pragma_Warning | "once")
    |   |   CMacro_Pragma_Pack: "pack" '(' ["push"] ')'
3 all all all all 1.00 all |   |   CMacro_Pragma_Warning: "warning" '(' "disable" ':' C_Number* ')'
6 all all all CMacro_Undef_Statement: '#' "undef" CMacro_Identifier_Reference

Terminals = 17 (instances=3,783,263)
Tokens = 157 (instances=10,085,260)

(*) 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.