Eagle Legacy Modernization, LLC

Python3 Grammar

Main program: Python3_Program

 Count  Terminals:
  Python_BackQuote: A string enclosed in quotes
114 Python_Class_Definition: An identifier
36,530 Python_Comment: Comment
14,069 Python_EndOfLine: End of line
526 Python_Function_Definition: An identifier
  Python_HexNumber: A hex number
31,175 Python_Identifier_Reference: An identifier
4,964 Python_Literal: A string enclosed in quotes
7,431 Python_Number: A number
  Python_OctalNumber: A octal number
25,181 Python_StartOfLine: Start of line
74 Python_Variable_Definition: An identifier
 Count  Statistics(*) Tokens:
10 6.10(all) Python3_Program: [Python_Statement]*
583 (59% | none | none | 1% | 2% | none | none | 3% | 0% | 4% | none | 11% | 5% | none | 0% | 2% | none | 0% | 1% | none | 11%) |   Python3_Simple_Statement: (Python_Assignment | Python_AssertStatement | Python_BreakStatement | Python_ClassDeclaration | Python_ContinueStatement | Python_DeleteStatement | Python_ExecStatement | Python_ForStatement | Python_FromStatement | Python_FunctionDefinition | Python_GlobalStatement | Python_IfStatement | Python_ImportStatement | Python_PassStatement | Python_RaiseStatement | Python_ReturnStatement | Python_TryStatement | Python_WhileStatement | Python_WithStatement | Python_YieldStatement | Python_ExpressionStatement)
42,866 (none | none | 17% | none | 3% | 1% | 1% | 0% | 0% | 12% | none | 12% | 1% | 35% | none | none | 0% | none | 0% | 1% | 0% | 5% | 5% | 0% | 0% | 0% | 0% | 5% | 1% | 0% | 0% | 0% | 0% | 1%) Python_Expression: (Python_OctalNumber | Python_HexNumber | Python_Number | Python_Funny_Constructor | Python_Parens | Python_Braces | Python_Brackets | Python_UnarySign | Python_Not_Expression | Python_Literals | Python_BackQuotes | Python_Function_Call | Python_BuiltIn | Python_VariableExpression | Python_Star_Expression | Python_StarStar_Expression | Python_Lambda_Expression | Python_Yield | Python_SubscriptExpression | Python_Subfield | Python_Power_Expression | Python_Multiplicative_Expression | Python_Additive_Expression | Python_Shift_Expression | Python_Bitwise_And_Expression | Python_Bitwise_Xor_Expression | Python_Bitwise_Or_Expression | Python_Relational_Expression | Python_And_Expression | Python_Or_Expression | Python_For_In_Expression | Python_If_Else_Expression | Python_If_Expression | Python_Assignment_Expression)
2,148 all all all |   Python_Additive_Expression: Python_Expression ("+"|"-") Python_Expression
335 all all none all |   Python_And_Expression: Python_Expression "and" [Python_Comment]* Python_Expression
279 all all all |   Python_Assignment_Expression: Python_Expression ("="|"+="|"-=") Python_Expression
    |   Python_BackQuotes: Python_BackQuote*
16 all all all |   Python_Bitwise_And_Expression: Python_Expression '&' Python_Expression
5 all all all |   Python_Bitwise_Or_Expression: Python_Expression '|' Python_Expression
5 all all all |   Python_Bitwise_Xor_Expression: Python_Expression '^' Python_Expression
315 all 24% all none all |   Python_Braces: '{' [Python_EndOfLine] [Python_Dictionary] [Python_EndOfLine] '}'
315 none 52% 4.78(47%) 42% none |   |   Python_Dictionary: [Python_Comment]* [Python_DictionaryElement] [Python_MoreDictionaryElement]* [','] [Python_Comment]*
871 all all none all all |   |   |   Python_DictionaryElement: Python_Expression ':' [Python_EndOfLine] [Python_Comment] Python_Expression
707 all none all |   |   |   Python_MoreDictionaryElement: ',' [Python_Comment]* Python_DictionaryElement
271 all none 1% 71% all |   Python_Brackets: '[' [Python_Comment]* [Python_EndOfLine] [Python_List] ']'
528 all |   Python_BuiltIn: ("False"|"True")
32 all all all all all |   Python_For_In_Expression: Python_Expression "for" Python_VariableList "in" Python_Expression
5,075 all 1.00 |   Python_Function_Call: Python_Variable Python_Parameter_List*
    |   Python_Funny_Constructor: '(' Python_Type '*' Python_Expression ')' '(' ')'
43 all all all all all |   Python_If_Else_Expression: Python_Expression "if" Python_Expression "else" Python_Expression
4 all all all |   Python_If_Expression: Python_Expression "if" Python_Expression
9 all none all none all all |   Python_Lambda_Expression: "lambda" ['('] [Python_Variable_List] [')'] ':' Python_Expression
9 all all none none |   |   Python_Variable_List: [("*"|"**")] Python_Variable [Python_Variable_Default] [Python_MoreVariablesInList]*
    |   |   |   Python_MoreVariablesInList: ',' [Python_Comment]* [("*"|"**")] Python_Variable [Python_Variable_Default]
    |   |   |   Python_Variable_Default: '=' Python_Expression
4,964 1.00 |   Python_Literals: Python_Literal*
2,085 all all all |   Python_Multiplicative_Expression: Python_Expression ("//"|"*"|"/"|"%") Python_Expression
185 all all |   Python_Not_Expression: "not" Python_Expression
156 all all none all |   Python_Or_Expression: Python_Expression "or" [Python_Comment]* Python_Expression
1,481 all none all all |   Python_Parens: '(' [Python_CommentEoln]* [Python_List] ')'
    |   |   Python_CommentEoln: Python_Comment [Python_EndOfLine]
79 all all all |   Python_Power_Expression: Python_Expression "**" Python_Expression
2,032 all all all |   Python_Relational_Expression: Python_Expression Python_Relational_Operator Python_Expression
2,032 (13% | none | 87%) |   |   Python_Relational_Operator: (Python_IN_Operator | Python_IS_Operator | ("=="|"!="|"<>"|"<="|">="|"<"|">"))
264 all all |   |   |   Python_IN_Operator: ["not"] "in"
    |   |   |   Python_IS_Operator: "is" ["not"]
13 all all all |   Python_Shift_Expression: Python_Expression ("<<"|">>") Python_Expression
    |   Python_StarStar_Expression: "**" Python_Expression
    |   Python_Star_Expression: '*' Python_Expression
270 all all all |   Python_Subfield: Python_Expression '.' Python_Expression
41 all all none all all none |   Python_SubscriptExpression: Python_Expression '[' [Python_EndOfLine] Python_SubscrExpr ']' [Python_Parameter_List]
3 all none none |   |   Python_ColonSubscript: ':' [Python_EndOfLine] [Python_Expression]
41 all 7% none |   |   Python_SubscrExpr: [Python_Expression] [Python_ColonSubscript] [Python_ColonSubscript]
33 all all |   Python_UnarySign: ("*"|"-"|"+"|"~") Python_Expression
15,031 all |   Python_VariableExpression: Python_Variable
    |   Python_Yield: "yield" Python_Expression
1,519 1.00 none Python_ExpressionList: Python_Expression* [',']
1,673 none all 2.93(64%) 1% none Python_List: [Python_Comment]* Python_Expression [Python_MoreListItem]* [','] [Python_Comment]*
3,135 all none all |   Python_MoreListItem: ',' [Python_Comment]* Python_Expression
5,610 all all all none all Python_Parameter_List: '(' [Python_Comment] Python_Params [Python_EndOfLine] ')'
5,610 all 87% none 1.41(36%) |   Python_Params: [("*"|"**")] [Python_Expression] [Python_InitValue] [Python_MoreParams]*
2,822 all all all 100% none |   |   Python_MoreParams: ',' [Python_Comment] [("*"|"**")] [Python_Expression] [Python_InitValue]
    |   |   |   Python_InitValue: '=' Python_Expression
12,920 99% all 0% none all 73% Python_Statement: [Python_StartOfLine] Python_StatementOrComment [';'] [','] [Python_Comment] [Python_EndOfLine]
3,778 (80% | 20%) |   Python_SingleOrMultiLineStatement: (Python_MultilineStatement | Python_SingleLineStatement)
3,022 all all 3.12 |   |   Python_MultilineStatement: [Python_Comment] Python_EndOfLine Python_Statement*
756 1.16 all 100% |   |   Python_SingleLineStatement: Python_Simple_Statement* [Python_Comment] [Python_EndOfLine]
12,920 (6% | 94% | 0%) |   Python_StatementOrComment: (Python_CommentList | Python_Statement_List | Python_EndOfLine)
726 2.99 |   |   Python_CommentList: Python_Comment*
12,192 all 1.00 |   Python_Statement_List: Python_StartOfLine Python_Simple_Statement*
79 (all | none) Python_Type: (Python_Regular_Class | "object")
79 2.87 |   Python_Regular_Class: Python_TypeName*
153 (none | all) |   |   Python_TypeName: ("self" | Python_Identifier_Reference)
27,714 all 1.14(6%) 1.32(11%) 1.00(0%) none Python_Variable: Python_SelfOrVariable [Python_Subscript]* [Python_DotVariable]* [Python_Subscript]* [Python_DotVariable]*
3,992 all none all |   Python_DotVariable: '.' ['.'] Python_Identifier_Reference
27,714 (2% | 98% | none | 0%) |   Python_SelfOrVariable: ("self" | Python_Identifier_Reference | Python_DotVariable | (".."|"."|"_1"|"_2"|"__"|"_$"|"_"))
1,819 all all all |   Python_Subscript: '[' Python_Subscript_Body ']'
1,819 none 1.00 |   |   Python_Subscript_Body: [Python_EndOfLine] Python_Subscript_Dimension*
1,819 98% 6% 0% |   |   Python_Subscript_Dimension: [Python_Expression] [Python_ColonSubscr] [Python_ColonSubscr]
120 all none 64% |   |   |   Python_ColonSubscr: ':' [Python_EndOfLine] [Python_Expression]
6,604 1.04 none Python_VariableList: Python_Variable_or_List* [',']
6,744 (1% | 99%) |   Python_Variable_or_List: (Python_Var_List | Python_Variable)
77 all all all |   |   Python_Var_List: '(' [Python_VariableList] ')'
1 all all none Python_AssertStatement: "assert" Python_Expression [Python_AssertMessage]
    |   Python_AssertMessage: ',' Python_Expression
5,525 all all all 1.20(0%) all Python_Assignment: Python_VariableList ("="|"+="|"-="|"*="|"/="|"%="|"&="|"|="|"^="|"<<="|">>="|"**="|"//=") Python_Expression [Python_MoreAsgExpressions]* [Python_Comment]
6 all all |   Python_MoreAsgExpressions: ',' [Python_Expression]
157 all Python_BreakStatement: "break"
114 none none all all 99% all all Python_ClassDeclaration: [Python_Decorator]* [Python_EndOfLine] "class" Python_Class_Definition [Python_ClassSuper] ':' Python_SingleOrMultiLineStatement
113 all none 70% none none all |   Python_ClassSuper: '(' [Python_EndOfLine] [Python_Type] [Python_ClassSuper] [Python_MoreTypes]* ')'
    |   |   Python_MoreTypes: ',' Python_Type
175 all Python_ContinueStatement: "continue"
3 all all Python_DeleteStatement: "del" Python_ExpressionList
1 all 1.00 Python_ExecStatement: "exec" Python_Expression*
1,229 all all Python_ExpressionStatement: Python_Expression [Python_Comment]
970 all all all all all all all 0% Python_ForStatement: "for" Python_VariableList "in" Python_ExpressionList ':' [Python_Comment] Python_SingleOrMultiLineStatement [Python_ForElse]
1 all all all all |   Python_ForElse: Python_StartOfLine "else" ':' Python_SingleOrMultiLineStatement
270 all all all Python_FromStatement: "from" Python_Variable Python_ImportStatement
526 1.00(4%) 2% all all all all none all Python_FunctionDefinition: [Python_Decorator]* [Python_EndOfLine] "def" Python_FunctionName Python_Parameter_List ':' [Python_Comment]* Python_SingleOrMultiLineStatement
21 all all 43% all all |   Python_Decorator: '@' Python_Variable [Python_Parameter_List] [Python_Comment] Python_EndOfLine
526 (all | none) |   Python_FunctionName: (Python_Function_Definition | "__init__")
48 all 2.08 Python_GlobalStatement: "global" Python_Variable_Definition*
1,787 all all all all 2.79(2%) 8% 1.00(3%) Python_IfStatement: "if" Python_Expression ':' Python_SingleOrMultiLineStatement [Python_IfElif]* [Python_IfElse] [Python_Comment]*
95 all all all all all |   Python_IfElif: Python_StartOfLine "elif" Python_Expression ':' Python_SingleOrMultiLineStatement
151 all all all all |   Python_IfElse: Python_StartOfLine "else" ':' Python_SingleOrMultiLineStatement
633 all all 3% 2.67(0%) all Python_ImportStatement: "import" Python_ImportWhat [Python_FromImportAs] [Python_MoreImports]* [Python_Comment]
16 all all |   Python_FromImportAs: "as" Python_Variable
633 (none | 96% | 4%) |   Python_ImportWhat: (Python_ImportList | Python_Variable | '*')
    |   |   Python_ImportList: '(' Python_ImportListItem [Python_FromImportAs] ')'
    |   |   |   Python_ImportListItem: [Python_Expression] [Python_FromImportAs] [Python_MoreImportListItem]* [',']
    |   |   |   |   Python_MoreImportListItem: ',' Python_Expression [Python_FromImportAs]
8 all all none |   Python_MoreImports: ',' Python_Variable [Python_FromImportAs]
16 all Python_PassStatement: "pass"
11 all 1.00(all) Python_RaiseStatement: "raise" [Python_RaiseCondition]*
11 all none |   Python_RaiseCondition: Python_Expression [Python_RaiseFrom]
    |   |   Python_RaiseFrom: "from" Python_Expression
636 all 85% all Python_ReturnStatement: "return" [Python_ExpressionList] [Python_Comment]
12 all all all all all 1.00(all) none none Python_TryStatement: Python_StartOfLine "try" ':' [Python_Comment] Python_SingleOrMultiLineStatement [Python_TryExcept]* [Python_TryElse] [Python_TryFinally]
    |   Python_TryElse: Python_StartOfLine "else" ':' Python_SingleOrMultiLineStatement
12 all 1.00(all) all all |   Python_TryExcept: "except" [Python_TryExceptClause]* ':' Python_SingleOrMultiLineStatement
12 all 83% |   |   Python_TryExceptClause: Python_Expression [Python_TryExceptAs]
10 all all |   |   |   Python_TryExceptAs: "as" Python_Variable
    |   Python_TryFinally: Python_StartOfLine "finally" ':' Python_SingleOrMultiLineStatement
110 all all all all none Python_WhileStatement: "while" Python_Expression ':' Python_SingleOrMultiLineStatement [Python_WhileElse]
    |   Python_WhileElse: Python_StartOfLine "else" ':' Python_SingleOrMultiLineStatement
42 all 1.00 all all 1.74 Python_WithStatement: "with" Python_WithItem* ':' Python_EndOfLine Python_Statement*
42 all all |   Python_WithItem: Python_Expression [Python_WithItemAs]
42 all all |   |   Python_WithItemAs: "as" Python_Expression
4 all all Python_YieldStatement: "yield" [Python_YieldWhat]
4 (none | all) |   Python_YieldWhat: (Python_YieldFrom | Python_ExpressionList)
    |   |   Python_YieldFrom: "from" Python_Expression

Terminals = 12 (instances=120,064)
Tokens = 121 (instances=242,525)

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