Eagle Legacy Modernization, LLC

Python Grammar

Main program: Python_Program

 Count  Terminals:
  Python_BackQuote: A string enclosed in quotes
85 Python_Class_Definition: An identifier
502 Python_Comment: Comment
3,593 Python_EndOfLine: End of line
139 Python_Function_Definition: An identifier
  Python_HexNumber: A hex number
9,128 Python_Identifier_Reference: An identifier
1,771 Python_Literal: A string enclosed in quotes
515 Python_Number: A number
  Python_OctalNumber: A octal number
3,022 Python_StartOfLine: Start of line
3 Python_Variable_Definition: An identifier
 Count  Statistics(*) Tokens:
8,556 (none | none | 6% | none | 2% | 2% | 1% | 0% | 1% | 21% | none | 20% | 1% | 33% | none | none | 0% | none | 0% | 2% | none | 2% | 3% | none | none | none | none | 4% | 1% | 0% | 0% | 0% | 0% | 2%) 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)
280 all all all |   Python_Additive_Expression: Python_Expression ("+"|"-") Python_Expression
67 all all none all |   Python_And_Expression: Python_Expression "and" [Python_Comment]* Python_Expression
130 all all all |   Python_Assignment_Expression: Python_Expression '=' Python_Expression
    |   Python_BackQuotes: Python_BackQuote*
    |   Python_Bitwise_And_Expression: Python_Expression '&' Python_Expression
    |   Python_Bitwise_Or_Expression: Python_Expression '|' Python_Expression
    |   Python_Bitwise_Xor_Expression: Python_Expression '^' Python_Expression
129 all 45% all none all |   Python_Braces: '{' [Python_EndOfLine] [Python_Dictionary] [Python_EndOfLine] '}'
129 none 95% 4.60(85%) 83% none |   |   Python_Dictionary: [Python_Comment]* [Python_DictionaryElement] [Python_MoreDictionaryElement]* [','] [Python_Comment]*
629 all all none none all |   |   |   Python_DictionaryElement: Python_Expression ':' [Python_EndOfLine] [Python_Comment] Python_Expression
506 all none all |   |   |   Python_MoreDictionaryElement: ',' [Python_Comment]* Python_DictionaryElement
108 all none 1% 61% all |   Python_Brackets: '[' [Python_Comment]* [Python_EndOfLine] [Python_List] ']'
84 all |   Python_BuiltIn: ("False"|"True")
5 all all all all all |   Python_For_In_Expression: Python_Expression "for" Python_VariableList "in" Python_Expression
1,710 all 1.00 none |   Python_Function_Call: Python_Variable Python_Function_Arguments* [Python_Function_Arguments]
1,710 all 73% none all |   |   Python_Function_Arguments: '(' [Python_Function_ArgList] [Python_EndOfLine] ')'
1,252 none none all 0% none |   |   |   Python_Function_ArgList: [Python_EndOfLine] [Python_Comment]* Python_Function_Params [','] [Python_Comment]*
1,252 all all none 1.35(21%) |   |   |   Python_Function_Params: [("*"|"**")] Python_Expression [Python_InitialValue] [Python_MoreArgument]*
    |   |   |   |   Python_InitialValue: '=' Python_Expression
352 all none all all none |   |   |   |   Python_MoreArgument: ',' [Python_Comment]* [("*"|"**")] Python_Expression [Python_InitialValue]
    |   Python_Funny_Constructor: '(' Python_Type '*' Python_Expression ')' '(' ')'
5 all all all all all |   Python_If_Else_Expression: Python_Expression "if" Python_Expression "else" Python_Expression
1 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
1,771 1.00 |   Python_Literals: Python_Literal*
137 all all all |   Python_Multiplicative_Expression: Python_Expression ("//"|"*"|"/"|"%") Python_Expression
66 all all |   Python_Not_Expression: "not" Python_Expression
14 all all none all |   Python_Or_Expression: Python_Expression "or" [Python_Comment]* Python_Expression
162 all none all all |   Python_Parens: '(' [Python_CommentEoln]* [Python_List] ')'
    |   |   Python_CommentEoln: Python_Comment [Python_EndOfLine]
    |   Python_Power_Expression: Python_Expression "**" Python_Expression
329 all all all |   Python_Relational_Expression: Python_Expression Python_Relational_Operator Python_Expression
329 (28% | none | 72%) |   |   Python_Relational_Operator: (Python_IN_Operator | Python_IS_Operator | ("=="|"!="|"<>"|"<="|">="|"<"|">"))
93 all all |   |   |   Python_IN_Operator: ["not"] "in"
    |   |   |   Python_IS_Operator: "is" ["not"]
    |   Python_Shift_Expression: Python_Expression ("<<"|">>") Python_Expression
    |   Python_StarStar_Expression: "**" Python_Expression
    |   Python_Star_Expression: '*' Python_Expression
139 all all all |   Python_Subfield: Python_Expression '.' Python_Expression
21 all all none all all none |   Python_SubscriptExpression: Python_Expression '[' [Python_EndOfLine] Python_SubscrExpr ']' [Python_Function_Arguments]
    |   |   Python_ColonSubscript: ':' [Python_EndOfLine] [Python_Expression]
21 all none none |   |   Python_SubscrExpr: [Python_Expression] [Python_ColonSubscript] [Python_ColonSubscript]
19 all all |   Python_UnarySign: ("*"|"-"|"+"|"~") Python_Expression
2,859 all |   Python_VariableExpression: Python_Variable
    |   Python_Yield: "yield" Python_Expression
105 1.00 none Python_ExpressionList: Python_Expression* [',']
228 none all 1.71(63%) 10% none Python_List: [Python_Comment]* Python_Expression [Python_MoreListItem]* [','] [Python_Comment]*
245 all none all |   Python_MoreListItem: ',' [Python_Comment]* Python_Expression
139 all none all none all Python_Parameter_List: '(' [Python_Comment] Python_Params [Python_EndOfLine] ')'
139 none all 99% none 1.41(63%) |   Python_Params: ['*'] ["**"] [Python_Expression] [Python_InitValue] [Python_MoreParams]*
123 all none none all all none |   |   Python_MoreParams: ',' [Python_Comment] ['*'] ["**"] [Python_Expression] [Python_InitValue]
    |   |   |   Python_InitValue: '=' Python_Expression
90 7.89(all) Python_Program: [Python_Statement]*
3,075 all 0% none none 81% Python_Statement: Python_StatementOrComment [';'] [','] [Python_Comment] [Python_EndOfLine]
2,961 (45% | none | 0% | 3% | 0% | 0% | none | 2% | 5% | 5% | 0% | 9% | 7% | 0% | 0% | 3% | 4% | 0% | 0% | 0% | 0% | 16%) |   Python_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_PrintStatement | Python_ReturnStatement | Python_TryStatement | Python_WhileStatement | Python_WithStatement | Python_YieldStatement | Python_ExpressionStatement)
639 (100% | 0%) |   Python_SingleOrMultiLineStatement: (Python_MultlineStatement | Python_SingleLineStatement)
637 none all 3.69 |   |   Python_MultlineStatement: [Python_Comment] Python_EndOfLine Python_Statement*
2 1.00 none all |   |   Python_SingleLineStatement: Python_Simple_Statement* [Python_Comment] [Python_EndOfLine]
3,075 (4% | 96% | 0%) |   Python_StatementOrComment: (Python_CommentList | Python_Statement_List | Python_EndOfLine)
124 6.94 |   |   Python_CommentList: Python_Comment*
2,950 all 1.01 |   Python_Statement_List: Python_StartOfLine Python_Simple_Statement*
71 (all | none) Python_Type: (Python_Regular_Class | "object")
71 2.94 |   Python_Regular_Class: Python_TypeName*
140 (none | all) |   |   Python_TypeName: ("self" | Python_Identifier_Reference)
6,511 all 1.04(4%) 1.37(34%) 1.00(0%) none Python_Variable: Python_SelfOrVariable [Python_Subscript]* [Python_DotVariable]* [Python_Subscript]* [Python_DotVariable]*
2,996 all none all |   Python_DotVariable: '.' ['.'] Python_Identifier_Reference
6,511 (8% | 92% | none | none) |   Python_SelfOrVariable: ("self" | Python_Identifier_Reference | Python_DotVariable | (".."|"."|"_1"|"_2"|"__"|"_$"|"_"))
260 all all all |   Python_Subscript: '[' Python_Subscript_Body ']'
260 none 1.00 |   |   Python_Subscript_Body: [Python_EndOfLine] Python_Subscript_Dimension*
260 97% 7% none |   |   Python_Subscript_Dimension: [Python_Expression] [Python_ColonSubscr] [Python_ColonSubscr]
18 all none 56% |   |   |   Python_ColonSubscr: ':' [Python_EndOfLine] [Python_Expression]
1,397 1.02 none Python_VariableList: Python_Variable_or_List* [',']
1,413 (0% | 100%) |   Python_Variable_or_List: (Python_Var_List | Python_Variable)
1 all all all |   |   Python_Var_List: '(' [Python_VariableList] ')'
    Python_AssertStatement: "assert" Python_Expression [Python_AssertMessage]
    |   Python_AssertMessage: ',' Python_Expression
1,339 all all all 1.00(0%) 1% Python_Assignment: Python_VariableList ("="|"+="|"-="|"*="|"/="|"%="|"&="|"|="|"^="|"<<="|">>="|"**="|"//=") Python_Expression [Python_MoreAsgExpressions]* [Python_Comment]
2 all all |   Python_MoreAsgExpressions: ',' [Python_Expression]
4 all Python_BreakStatement: "break"
85 none none all all all all all Python_ClassDeclaration: [Python_Decorator]* [Python_EndOfLine] "class" Python_Class_Definition [Python_ClassSuper] ':' Python_SingleOrMultiLineStatement
85 all none 82% none 1.00(1%) all |   Python_ClassSuper: '(' [Python_EndOfLine] [Python_Type] [Python_ClassSuper] [Python_MoreTypes]* ')'
1 all all |   |   Python_MoreTypes: ',' Python_Type
10 all Python_ContinueStatement: "continue"
3 all all Python_DeleteStatement: "del" Python_ExpressionList
    Python_ExecStatement: "exec" Python_Expression*
462 all Python_ExpressionStatement: Python_Expression
52 all all all all all none all none Python_ForStatement: "for" Python_VariableList "in" Python_ExpressionList ':' [Python_Comment] Python_SingleOrMultiLineStatement [Python_ForElse]
    |   Python_ForElse: Python_StartOfLine "else" ':' Python_SingleOrMultiLineStatement
143 all all all Python_FromStatement: "from" Python_Variable Python_ImportStatement
139 1.00(8%) 6% all all all all none all Python_FunctionDefinition: [Python_Decorator]* [Python_EndOfLine] "def" Python_FunctionName Python_Parameter_List ':' [Python_Comment]* Python_SingleOrMultiLineStatement
11 all all none none all |   Python_Decorator: '@' Python_Variable [Python_Parameter_List] [Python_Comment] Python_EndOfLine
139 (all | none) |   Python_FunctionName: (Python_Function_Definition | "__init__")
3 all 1.00 Python_GlobalStatement: "global" Python_Variable_Definition*
273 all all all all 1.50(1%) 19% none Python_IfStatement: "if" Python_Expression ':' Python_SingleOrMultiLineStatement [Python_IfElif]* [Python_IfElse] [Python_Comment]*
6 all all all all all |   Python_IfElif: Python_StartOfLine "elif" Python_Expression ':' Python_SingleOrMultiLineStatement
53 all all all all |   Python_IfElse: Python_StartOfLine "else" ':' Python_SingleOrMultiLineStatement
350 all all 2% 5.00(0%) none Python_ImportStatement: "import" Python_ImportWhat [Python_FromImportAs] [Python_MoreImports]* [Python_Comment]
7 all all |   Python_FromImportAs: "as" Python_Variable
350 (none | all | none) |   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]
5 all all none |   Python_MoreImports: ',' Python_Variable [Python_FromImportAs]
7 all Python_PassStatement: "pass"
95 all all 1.57(99%) none Python_PrintStatement: "print" [">>"] [Python_Expression]* [',']
3 all 1.00(all) Python_RaiseStatement: "raise" [Python_RaiseCondition]*
3 all none |   Python_RaiseCondition: Python_Expression [Python_RaiseFrom]
    |   |   Python_RaiseFrom: "from" Python_Expression
107 all 46% none Python_ReturnStatement: "return" [Python_ExpressionList] [Python_Comment]
12 all all all none all 1.00(92%) none 8% Python_TryStatement: Python_StartOfLine "try" ':' [Python_Comment] Python_SingleOrMultiLineStatement [Python_TryExcept]* [Python_TryElse] [Python_TryFinally]
    |   Python_TryElse: Python_StartOfLine "else" ':' Python_SingleOrMultiLineStatement
11 all 1.00(all) all all |   Python_TryExcept: "except" [Python_TryExceptClause]* ':' Python_SingleOrMultiLineStatement
11 all 82% |   |   Python_TryExceptClause: Python_Expression [Python_TryExceptAs]
9 all all |   |   |   Python_TryExceptAs: "as" Python_Variable
1 all all all all |   Python_TryFinally: Python_StartOfLine "finally" ':' Python_SingleOrMultiLineStatement
7 all all all all none Python_WhileStatement: "while" Python_Expression ':' Python_SingleOrMultiLineStatement [Python_WhileElse]
    |   Python_WhileElse: Python_StartOfLine "else" ':' Python_SingleOrMultiLineStatement
9 all 1.00 all all 1.67 Python_WithStatement: "with" Python_WithItem* ':' Python_EndOfLine Python_Statement*
9 all all |   Python_WithItem: Python_Expression [Python_WithItemAs]
9 all all |   |   Python_WithItemAs: "as" Python_Expression
1 all all Python_YieldStatement: "yield" [Python_YieldWhat]
1 (none | all) |   Python_YieldWhat: (Python_YieldFrom | Python_ExpressionList)
    |   |   Python_YieldFrom: "from" Python_Expression

Terminals = 12 (instances=18,758)
Tokens = 127 (instances=61,133)

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