Eagle Legacy Modernization, LLC

Python2 Grammar

Main program: Python2_Program

 Count  Terminals:
  Python_BackQuote: A string enclosed in quotes
72 Python_Class_Definition: An identifier
33,012 Python_Comment: Comment
12,813 Python_EndOfLine: End of line
473 Python_Function_Definition: An identifier
  Python_HexNumber: A hex number
28,048 Python_Identifier_Reference: An identifier
4,007 Python_Literal: A string enclosed in quotes
7,229 Python_Number: A number
  Python_OctalNumber: A octal number
22,917 Python_StartOfLine: Start of line
68 Python_Variable_Definition: An identifier
 Count  Statistics(*) Tokens:
334 9.59(all) Python2_Program: [Python_Statement]*
11,332 (9% | 40% | 0% | 1% | 1% | 1% | 0% | 0% | 8% | 2% | 4% | 0% | 14% | 2% | 0% | 0% | 5% | 0% | 1% | 0% | 0% | 9%) |   Python2_Simple_Statement: (Python_PrintStatement | 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)
39,172 (none | none | 18% | none | 4% | 1% | 1% | 0% | 0% | 10% | none | 11% | 1% | 35% | none | none | 0% | none | 0% | 0% | 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)
1,861 all all all |   Python_Additive_Expression: Python_Expression ("+"|"-") Python_Expression
319 all all none all |   Python_And_Expression: Python_Expression "and" [Python_Comment]* Python_Expression
235 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
255 all 18% all none all |   Python_Braces: '{' [Python_EndOfLine] [Python_Dictionary] [Python_EndOfLine] '}'
255 none 43% 4.87(40%) 32% none |   |   Python_Dictionary: [Python_Comment]* [Python_DictionaryElement] [Python_MoreDictionaryElement]* [','] [Python_Comment]*
602 all all none all all |   |   |   Python_DictionaryElement: Python_Expression ':' [Python_EndOfLine] [Python_Comment] Python_Expression
492 all none all |   |   |   Python_MoreDictionaryElement: ',' [Python_Comment]* Python_DictionaryElement
233 all none 1% 74% all |   Python_Brackets: '[' [Python_Comment]* [Python_EndOfLine] [Python_List] ']'
508 all |   Python_BuiltIn: ("False"|"True")
34 all all all all all |   Python_For_In_Expression: Python_Expression "for" Python_VariableList "in" Python_Expression
4,497 all 1.00 |   Python_Function_Call: Python_Variable Python_Parameter_List*
    |   Python_Funny_Constructor: '(' Python_Type '*' Python_Expression ')' '(' ')'
42 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
5 all none all none all all |   Python_Lambda_Expression: "lambda" ['('] [Python_Variable_List] [')'] ':' Python_Expression
5 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,007 1.00 |   Python_Literals: Python_Literal*
2,074 all all all |   Python_Multiplicative_Expression: Python_Expression ("//"|"*"|"/"|"%") Python_Expression
171 all all |   Python_Not_Expression: "not" Python_Expression
146 all all none all |   Python_Or_Expression: Python_Expression "or" [Python_Comment]* Python_Expression
1,475 all none all all |   Python_Parens: '(' [Python_CommentEoln]* [Python_List] ')'
    |   |   Python_CommentEoln: Python_Comment [Python_EndOfLine]
80 all all all |   Python_Power_Expression: Python_Expression "**" Python_Expression
1,948 all all all |   Python_Relational_Expression: Python_Expression Python_Relational_Operator Python_Expression
1,948 (14% | none | 86%) |   |   Python_Relational_Operator: (Python_IN_Operator | Python_IS_Operator | ("=="|"!="|"<>"|"<="|">="|"<"|">"))
266 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
182 all all all |   Python_Subfield: Python_Expression '.' Python_Expression
23 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]
23 all 13% none |   |   Python_SubscrExpr: [Python_Expression] [Python_ColonSubscript] [Python_ColonSubscript]
33 all all |   Python_UnarySign: ("*"|"-"|"+"|"~") Python_Expression
13,772 all |   Python_VariableExpression: Python_Variable
    |   Python_Yield: "yield" Python_Expression
1,488 1.00 none Python_ExpressionList: Python_Expression* [',']
1,647 none all 2.94(64%) 1% none Python_List: [Python_Comment]* Python_Expression [Python_MoreListItem]* [','] [Python_Comment]*
3,072 all none all |   Python_MoreListItem: ',' [Python_Comment]* Python_Expression
4,979 all all all none all Python_Parameter_List: '(' [Python_Comment] Python_Params [Python_EndOfLine] ')'
4,979 all 86% none 1.40(37%) |   Python_Params: [("*"|"**")] [Python_Expression] [Python_InitValue] [Python_MoreParams]*
2,564 all all all 100% none |   |   Python_MoreParams: ',' [Python_Comment] [("*"|"**")] [Python_Expression] [Python_InitValue]
    |   |   |   Python_InitValue: '=' Python_Expression
11,771 99% all 0% none all 72% Python_Statement: [Python_StartOfLine] Python_StatementOrComment [';'] [','] [Python_Comment] [Python_EndOfLine]
3,553 (79% | 21%) |   Python_SingleOrMultiLineStatement: (Python_MultilineStatement | Python_SingleLineStatement)
2,791 all all 3.03 |   |   Python_MultilineStatement: [Python_Comment] Python_EndOfLine Python_Statement*
762 1.15 all 100% |   |   Python_SingleLineStatement: Python_Simple_Statement* [Python_Comment] [Python_EndOfLine]
11,771 (6% | 94% | 0%) |   Python_StatementOrComment: (Python_CommentList | Python_Statement_List | Python_EndOfLine)
682 2.98 |   |   Python_CommentList: Python_Comment*
11,087 all 1.00 |   Python_Statement_List: Python_StartOfLine Python_Simple_Statement*
59 (all | none) Python_Type: (Python_Regular_Class | "object")
59 2.83 |   Python_Regular_Class: Python_TypeName*
113 (none | all) |   |   Python_TypeName: ("self" | Python_Identifier_Reference)
25,093 all 1.16(5%) 1.32(10%) 1.00(0%) none Python_Variable: Python_SelfOrVariable [Python_Subscript]* [Python_DotVariable]* [Python_Subscript]* [Python_DotVariable]*
3,328 all none all |   Python_DotVariable: '.' ['.'] Python_Identifier_Reference
25,093 (2% | 98% | none | 0%) |   Python_SelfOrVariable: ("self" | Python_Identifier_Reference | Python_DotVariable | (".."|"."|"_1"|"_2"|"__"|"_$"|"_"))
1,605 all all all |   Python_Subscript: '[' Python_Subscript_Body ']'
1,605 none 1.00 |   |   Python_Subscript_Body: [Python_EndOfLine] Python_Subscript_Dimension*
1,605 98% 5% 0% |   |   Python_Subscript_Dimension: [Python_Expression] [Python_ColonSubscr] [Python_ColonSubscr]
91 all none 67% |   |   |   Python_ColonSubscr: ':' [Python_EndOfLine] [Python_Expression]
5,957 1.04 none Python_VariableList: Python_Variable_or_List* [',']
6,091 (1% | 99%) |   Python_Variable_or_List: (Python_Var_List | Python_Variable)
75 all all all |   |   Python_Var_List: '(' [Python_VariableList] ')'
1 all all none Python_AssertStatement: "assert" Python_Expression [Python_AssertMessage]
    |   Python_AssertMessage: ',' Python_Expression
4,892 all all all 1.20(0%) all Python_Assignment: Python_VariableList ("="|"+="|"-="|"*="|"/="|"%="|"&="|"|="|"^="|"<<="|">>="|"**="|"//=") Python_Expression [Python_MoreAsgExpressions]* [Python_Comment]
6 all all |   Python_MoreAsgExpressions: ',' [Python_Expression]
160 all Python_BreakStatement: "break"
72 none none all all 99% all all Python_ClassDeclaration: [Python_Decorator]* [Python_EndOfLine] "class" Python_Class_Definition [Python_ClassSuper] ':' Python_SingleOrMultiLineStatement
71 all none 83% none none all |   Python_ClassSuper: '(' [Python_EndOfLine] [Python_Type] [Python_ClassSuper] [Python_MoreTypes]* ')'
    |   |   Python_MoreTypes: ',' Python_Type
159 all Python_ContinueStatement: "continue"
3 all all Python_DeleteStatement: "del" Python_ExpressionList
1 all 1.00 Python_ExecStatement: "exec" Python_Expression*
1,113 all all Python_ExpressionStatement: Python_Expression [Python_Comment]
956 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
272 all all all Python_FromStatement: "from" Python_Variable Python_ImportStatement
473 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
18 all all 50% all all |   Python_Decorator: '@' Python_Variable [Python_Parameter_List] [Python_Comment] Python_EndOfLine
473 (all | none) |   Python_FunctionName: (Python_Function_Definition | "__init__")
42 all 2.24 Python_GlobalStatement: "global" Python_Variable_Definition*
1,702 all all all all 2.78(2%) 7% 1.00(3%) Python_IfStatement: "if" Python_Expression ':' Python_SingleOrMultiLineStatement [Python_IfElif]* [Python_IfElse] [Python_Comment]*
89 all all all all all |   Python_IfElif: Python_StartOfLine "elif" Python_Expression ':' Python_SingleOrMultiLineStatement
126 all all all all |   Python_IfElse: Python_StartOfLine "else" ':' Python_SingleOrMultiLineStatement
517 all all 1% 2.67(1%) all Python_ImportStatement: "import" Python_ImportWhat [Python_FromImportAs] [Python_MoreImports]* [Python_Comment]
4 all all |   Python_FromImportAs: "as" Python_Variable
517 (none | 95% | 5%) |   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]
10 all Python_PassStatement: "pass"
1,032 all all 1.05(100%) none Python_PrintStatement: "print" [">>"] [Python_Expression]* [',']
9 all 1.00(all) Python_RaiseStatement: "raise" [Python_RaiseCondition]*
9 all none |   Python_RaiseCondition: Python_Expression [Python_RaiseFrom]
    |   |   Python_RaiseFrom: "from" Python_Expression
621 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
26 all 1.00 all all 1.73 Python_WithStatement: "with" Python_WithItem* ':' Python_EndOfLine Python_Statement*
26 all all |   Python_WithItem: Python_Expression [Python_WithItemAs]
26 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=108,639)
Tokens = 122 (instances=231,894)

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