Eagle Legacy Modernization, LLC

C Grammar

Main program: C_Program

 Count  Terminals:
117 CMacro_Define_Definition: An identifier
4,740 CMacro_EndOfLine: End of line
141 CMacro_Identifier_Reference: An identifier
3,751 CMacro_IncludeSys: A string enclosed in quotes
20 CMacro_Parameter_Definition: An identifier
366 CMacro_RestOfLine: Rest of the line
1,827 C_Character_Literal: A string enclosed in quotes
115,702 C_Comment: Comment
189,750 C_Field_Definition: An identifier
76,728 C_Function_Definition: An identifier
  C_HexNumber: A hex number
870,757 C_Identifier_Reference: An identifier
58 C_Label_Definition: An identifier
31,504 C_Literal: A string enclosed in quotes
73,528 C_Number: A number
29,449 C_Type_Definition: An identifier
317,293 C_Variable_Definition: An identifier
 Count  Statistics(*) Tokens:
111,037 all none 2.42(85%) 0% C_ArgumentList: C_ExpressionArg [C_Comment] [C_MoreArguments]* [',']
339,998 (none | 100% | none | 0%) |   C_ExpressionArg: (C_ExpressionArgType | C_Expression | "const" | C_TypePrimitive)
    |   |   C_ExpressionArgType: C_Identifier_Reference C_TypeStar*
228,961 all 1% all 0% |   C_MoreArguments: ',' [C_Comment] C_ExpressionArg [C_Comment]
1,895 all 1.04(4%) C_Assignment: C_Expression [C_MoreAssignments]*
70 all all |   C_MoreAssignments: ',' C_Expression
16,518 (0% | 100%) C_Data: (C_FunctionPointer | C_RegularData)
62,442 all all all all all all all none all 1.77(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]* ')' [';']
16,514 all all all 1.02(7%) 13% 1.52(6%) all 2.56(27%) |   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]*
2,240 all all |   |   C_DataInitialValue: '=' C_Expression
1,563 all 1.06(25%) all 1.06(2%) 3% |   |   C_MoreIdentifiers: ',' [C_TypeStar]* C_Variable_Definition [C_Subscript]* [C_DataInitialValue]
772,408 (10% | none | 0% | 4% | 1% | 0% | 14% | 0% | 0% | 0% | 8% | 0% | 0% | none | 1% | 1% | 51% | 2% | 0% | 2% | 0% | 0% | 0% | 0% | 0% | 0% | 0% | 0% | 1% | 1% | 0% | 0% | 0% | 0% | 0% | 0% | 4%) C_Expression: (C_Number | C_HexNumber | 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)
3,629 all all all |   C_AdditiveExpression: C_Expression ("+"|"-") C_Expression
13,696 all all |   C_AddressOfVariable: '&' C_Expression
52 all all all |   C_ArrowSubfield: C_Expression "->" C_Expression
32,497 all all all |   C_AssignmentExpression: C_Expression ("="|"*="|"/="|"%="|"+="|"-="|"<<="|">>="|">>>="|"&="|"^="|"|=") C_Expression
38 all all all |   C_BitwiseAndExpression: C_Expression '&' C_Expression
18 all all all |   C_BitwiseOrExpression: C_Expression '|' C_Expression
5,272 all |   C_BuiltIn: ("false"|"true"|"NULL")
7,308 all all all all |   C_CastExpression: '(' C_Type ')' C_Expression
74 all all |   C_CommentExpression: C_Comment C_Expression
1,481 all all all |   C_ConditionalAndExpression: C_Expression "&&" C_Expression
1,810 all all all |   C_ConditionalOrExpression: C_Expression "||" C_Expression
1,418 all all all |   C_DotSubfield: C_Expression '.' C_Expression
6,806 all all all |   C_EqualityExpression: C_Expression ("=="|"!=") C_Expression
3 all all all |   C_ExclusiveOrExpression: C_Expression '^' C_Expression
491 all all 0% all |   C_ExpressionList: '{' C_ArgumentList [C_Comment] '}'
110,439 all all 99% all |   C_FunctionCall: C_Variable '(' [C_ArgumentList] ')'
776 all 2% all all all 100% all |   C_FunctionPointerCall: '(' ['*'] C_Variable ')' '(' [C_ArgumentList] ')'
30,904 1.01 |   C_Literals: C_Literal*
    |   C_LogicalNotExpression: '~' C_Expression
1,149 all all all |   C_MultiplicativeExpression: C_Expression ("*"|"/"|"%") C_Expression
4,062 all all |   C_NotExpression: '!' C_Expression
11,627 all |   C_Parenthesized_Expression: C_ParenthesizedExpression
109 all all |   C_PostDecrementExpression: C_Variable "--"
60,788 all all |   C_PostIncrementExpression: C_Variable "++"
22 all all |   C_PreDecrementExpression: "--" C_Expression
240 all all |   C_PreIncrementExpression: "++" C_Expression
4,101 all all all |   C_RelationalExpression: C_Expression ("<"|">"|"<="|">=") C_Expression
16 all all all |   C_ShiftExpression: C_Expression ("<<"|">>"|">>>") C_Expression
158 all all |   C_SignedExpression: ("+"|"-") C_Expression
568 all all all all |   C_SizeOf: "sizeof" '(' C_Type ')'
123 all all |   C_StarExpression: '*' C_Expression
66 all all all all |   C_SubscriptExpression: C_Expression '[' C_Expression ']'
395 all all all all all |   C_TrueFalseExpression: C_Expression '?' C_Expression ':' C_Expression
396,935 all |   C_VariableExpression: C_Variable
75,881 all 0% all all all 1.25(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
75,932 (5% | 95%) |   C_FunctionBody: (C_FunctionImplementation | ';')
3,964 all 44.53(98%) all none |   |   C_FunctionImplementation: '{' [C_StatementOrComment]* '}' [';']
308,762 (1% | 99% | 0%) |   C_FunctionParameter: (C_FunctionDotDotDotParameter | C_FunctionRegularParameter | C_FunctionPointer)
1,901 all |   |   C_FunctionDotDotDotParameter: "..."
305,881 all all 95% 1.04(0%) 0% |   |   C_FunctionRegularParameter: ["const"] C_Type [C_Variable_Definition] [C_Subscript]* [C_Comment]
75,881 (all | none) |   C_FunctionTypeName: (C_Function_TypeAndName | "main")
75,881 all 1.00(0%) all |   |   C_Function_TypeAndName: C_Type [C_Comment]* C_Function_Definition
76,949 all none 100% none 2.24(58%) all |   C_Function_ParameterDefs: '(' [C_Comment] [C_FunctionParameter] [C_Comment] [C_MoreParameterDefs]* ')'
169,418 all 0% all |   C_MoreParameterDefs: ',' [C_Comment] C_FunctionParameter
58 all all C_Label: C_Label_Definition ':'
11,627 all all all C_ParenthesizedExpression: '(' C_Expression ')'
729 252.68(all) C_Program: [C_StatementOrComment]*
396,054 (0% | 19% | 4% | none | 19% | 55% | 2%) |   C_StatementOrComment: (C_Enum | C_Comment | C_TypeDef | C_Data | C_Function | C_Statement | C_Type)
514 all all |   |   C_Enum: C_TypeEnum ';'
245,881 (6% | 7% | 0% | 1% | 2% | 1% | 0% | 0% | 1% | 9% | 3% | 0% | 0% | 71%) 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)
14,660 all 2.11(100%) all |   C_StatementBlock: '{' [C_StatementOrComment]* '}'
72,303 all 99% all C_Subscript: '[' [C_Expression] ']'
618,049 all none 0% C_Type: C_TypeBase [C_TypeGeneric] [C_TypeFunction]
618,049 (none | 0% | 57% | 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,446 all 47% 89% |   |   C_TypeEnum: "enum" [C_Identifier_Reference] [C_TypeEnumValues]
1,280 all 1.25(21%) all 72% none 6.97(99%) all |   |   |   C_TypeEnumValues: '{' [C_Comment]* C_Variable_Definition [C_EnumInitializer] [C_Comment]* [C_MoreEnums]* '}'
3,439 all all |   |   |   |   C_EnumInitializer: '=' C_Expression
8,853 all 1.37(22%) all 28% 1.00(3%) |   |   |   |   C_MoreEnums: ',' [C_Comment]* C_Variable_Definition [C_EnumInitializer] [C_Comment]*
354,219 all all all all 1.09(38%) |   |   C_TypePrimitive: ["const"] ["unsigned"] ("char"|"double"|"float"|"int"|"long"|"short"|"void") ["int"] [C_TypeStar]*
29 all all all 1.00(93%) |   |   C_TypeShortUnsignedInt: ("long"|"short") "unsigned" "int" [C_TypeStar]*
12,883 none all none 100% 7% all 14.39(all) all 59% |   |   C_TypeStruct: [C_Comment]* "struct" [C_Comment] [C_Type_Definition] [C_Comment] '{' [C_FieldOrComment]* '}' [';']
186,192 (67% | 0% | 33% | none) |   |   |   C_FieldOrComment: (C_Field | C_Comment | C_FunctionPointer | C_TypeUnion)
124,285 all all 1.03(2%) none 1.49(2%) all 1.03(16%) |   |   |   |   C_Field: C_Type C_Field_Definition [C_Subscript]* [C_FieldInitialValue] [C_MoreFields]* ';' [C_Comment]*
    |   |   |   |   |   C_FieldInitialValue: '=' C_Expression
3,023 all 1.25(11%) all 1.00(1%) none |   |   |   |   |   C_MoreFields: ',' ['*']* C_Field_Definition [C_Subscript]* [C_FieldInitialValue]
155 all 85% all 5.08(all) all none |   |   C_TypeUnion: "union" [C_Type_Definition] '{' [C_FieldOrComment]* '}' [';']
250,057 all all 1.01(69%) |   |   C_TypeUserDefined: ["struct"] C_Identifier_Reference [C_TypeStar]*
324,642 all |   |   |   C_TypeStar: ("*"|"&")
170 all all all all |   C_TypeFunction: '(' '*' ')' C_Function_ParameterDefs
    |   C_TypeGeneric: '<' C_Type* '>'
16,648 all all all all C_TypeDef: "typedef" ["interface"] C_TypeDef_What ';'
16,648 (95% | 4% | 1%) |   C_TypeDef_What: (C_TypeDef_Data | C_TypeDef_Function | C_TypeDef_NoParensFunction)
15,801 all 0% all 1.00(4%) |   |   C_TypeDef_Data: C_Type ['*'] C_Type_Definition [C_TypeDefMore]*
658 all 98% all |   |   |   C_TypeDefMore: ',' ['*'] C_Type_Definition
712 all all all all all all |   |   C_TypeDef_Function: C_Type '(' '*' C_Function_Definition ')' C_Function_ParameterDefs
135 all all all |   |   C_TypeDef_NoParensFunction: C_Type C_Function_Definition C_Function_ParameterDefs
569,047 1.00(0%) all 1.20(7%) 1.03(1%) C_Variable: [C_VariableStar]* C_VariableIdentifier [C_ExtendedIdentifier]* [C_Subscript]*
50,871 (87% | none | 13%) |   C_ExtendedIdentifier: (C_ArrowIdentifier | C_ColonColonIdentifier | C_DotIdentifier)
44,205 all all |   |   C_ArrowIdentifier: "->" C_Identifier_Reference
    |   |   C_ColonColonIdentifier: "::" C_Identifier_Reference
6,666 all all |   |   C_DotIdentifier: '.' C_Identifier_Reference
569,047 (0% | 0% | 11% | 89%) |   C_VariableIdentifier: (C_CastedVariable | C_IndirectVariable | C_SubscriptedVariable | C_Identifier_Reference)
129 all all all all all all |   |   C_CastedVariable: '(' '(' C_Type ')' C_Identifier_Reference ')'
268 all 1.00 all all |   |   C_IndirectVariable: '(' C_VariableStar* C_Identifier_Reference ')'
63,266 all 1.00 |   |   C_SubscriptedVariable: C_Identifier_Reference C_Subscript*
3,021 all |   C_VariableStar: '*'
2,391 all all C_BreakStatement: "break" ';'
417 all all C_ContinueStatement: "continue" ';'
18 all 11% all all all all all all C_DoStatement: "do" [C_Comment] C_Statement "while" '(' C_Expression ')' ';'
174,039 all all C_ExpressionStatement: C_Expression ';'
1,864 (none | all) C_ForStatement: (C_ForCollectionStatement | C_ForLoopStatement)
    |   C_ForCollectionStatement: "for" '(' C_Type C_Variable ':' C_Expression ')' C_Statement
1,864 all all 99% none all 99% none all 99% 1.00(3%) none all 0% all |   C_ForLoopStatement: "for" '(' [C_ForLoopVariable] [C_Comment] ';' [C_Expression] [C_Comment] ';' [C_Expression] [C_MoreLoopIncrements]* [C_Comment] ')' [C_Comment] C_Statement
1,895 (100% | 0%) |   |   C_ForLoopVariable: (C_ForLoopVariableNoType | C_ForLoopVariableWithType)
1,890 all |   |   |   C_ForLoopVariableNoType: C_Assignment
5 all all |   |   |   C_ForLoopVariableWithType: C_Type C_Assignment
50 all all |   |   C_MoreLoopIncrements: ',' C_ForLoopVariable
22,460 all all all 0% all 1.02(1%) all 12% C_IfStatement: "if" '(' C_Expression [C_Comment] ')' [C_Comment]* C_Statement [C_IfElseClause]
2,726 1.12(1%) all 1.00(3%) all |   C_IfElseClause: [C_Comment]* "else" [C_Comment]* C_Statement
6,516 all 85% all C_ReturnStatement: "return" [C_Expression] ';'
485 all all all all 1% all 5.54 all C_SwitchStatement: "switch" '(' C_Expression ')' [C_Comment] '{' C_SwitchClause* '}'
2,448 all all all 3.17(78%) |   C_CaseClause: "case" C_Expression ':' [C_StatementOrComment]*
239 all all 1.90(99%) |   C_DefaultClause: "default" ':' [C_StatementOrComment]*
2,689 (0% | 91% | 9%) |   C_SwitchClause: (C_Comment | C_CaseClause | C_DefaultClause)
351 all all all all 1% all C_WhileStatement: "while" '(' C_Expression ')' [C_Comment] C_Statement
52 (29% | none | none | none | 33% | 19% | 4% | none | none | none | none | 4% | none | none | none | none | 2% | 10% | 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
1 all all all |   CMacro_ConditionalAndExpression: CMacro_Expression "&&" CMacro_Expression
5 all all all |   CMacro_ConditionalOrExpression: CMacro_Expression "||" CMacro_Expression
    |   CMacro_EqualityExpression: CMacro_Expression ("=="|"!=") CMacro_Expression
    |   CMacro_ExclusiveOrExpression: CMacro_Expression '^' CMacro_Expression
17 all all all all |   CMacro_FunctionCall: "defined" '(' CMacro_Identifier_Reference ')'
10 all |   CMacro_IdentifierExpression: CMacro_Identifier_Reference
    |   CMacro_MultiplicativeExpression: CMacro_Expression ("*"|"/"|"%") CMacro_Expression
2 all all |   CMacro_NotExpression: '!' CMacro_Expression
    |   CMacro_ParenthesizedExpression: '(' CMacro_Expression ')'
2 all all all |   CMacro_RelationalExpression: CMacro_Expression ("<"|">"|"<="|">=") CMacro_Expression
    |   CMacro_SymbolExpression: '#' CMacro_Expression
4,566 none all 3% all CMacro_StatementOrComment: [CMacro_EndOfLine] CMacro_StmtBody [C_Comment] CMacro_EndOfLine
4,566 (none | 3% | 6% | 1% | 2% | 88% | 0% | none) |   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)
117 all all all none 12% 84% 6% CMacro_Define_Statement: '#' "define" CMacro_Define_Definition [C_Comment] [CMacro_Parameters] [CMacro_RestOfLine] [C_Comment]
14 all 1.86 all |   CMacro_Parameters: '(' CMacro_Parameter_Definition* ')'
268 all all all CMacro_Error_Statement: '#' "error" [CMacro_RestOfLine]
114 all all all 4% all 2.21(all) 1.00(1%) 18% 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"
281 all |   CMacro_IfDefElement: C_StatementOrComment
1 all all all none all 2.00(all) |   CMacro_IfDefElif: '#' "elif" CMacro_Expression [C_Comment] [CMacro_EndOfLine] [CMacro_IfDefElement]*
21 none all all none all 1.29(all) |   CMacro_IfDefElse: [CMacro_EndOfLine] '#' "else" [C_Comment] CMacro_EndOfLine [CMacro_IfDefElement]*
33 all all all 15% all 2.55(all) none 18% none all all 6% CMacro_If_Statement: '#' "if" CMacro_Expression [C_Comment] CMacro_EndOfLine [CMacro_IfElement]* [CMacro_IfElif]* [CMacro_IfElse] [CMacro_EndOfLine] '#' "endif" [C_Comment]
91 all |   CMacro_IfElement: C_StatementOrComment
    |   CMacro_IfElif: '#' "elif" CMacro_Expression [C_Comment] [CMacro_EndOfLine] [CMacro_IfElement]*
6 all all 17% 83% 1.17(all) |   CMacro_IfElse: '#' "else" [C_Comment] [CMacro_EndOfLine] [CMacro_IfElement]*
4,031 all all all CMacro_Include_Statement: '#' "include" CMacro_IncludeWhat
4,031 (7% | 93%) |   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* ')'
    CMacro_Undef_Statement: '#' "undef" CMacro_Identifier_Reference

Terminals = 17 (instances=1,715,731)
Tokens = 155 (instances=8,267,471)

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