Eagle Legacy Modernization, LLC

Javascript Grammar

Main program: Javascript_Program

 Count  Terminals:
3,214 Javascript_Comment: Comment
433 Javascript_Function_Definition: An identifier
  Javascript_HexNumber: A hex number
46,642 Javascript_Identifier_Reference: An identifier
24 Javascript_Label_Definition: An identifier
10,612 Javascript_Literal: A string enclosed in quotes
8,693 Javascript_Number: A number
134 Javascript_RegularExpression: A string enclosed in quotes
5,834 Javascript_Variable_Definition: An identifier
 Count  Statistics(*) Tokens:
    Javascript_ArgumentList: Javascript_Expression [Javascript_Comment]* [Javascript_MoreArguments]* [',']
    |   Javascript_MoreArguments: ',' [Javascript_Comment]* Javascript_Expression [Javascript_Comment]*
2,137 all all 83% 1.96(13%) 99% Javascript_Data: Javascript_Type Javascript_Variable_Definition [Javascript_InitData] [Javascript_More_Variables]* [';']
2,343 all all |   Javascript_InitData: '=' Javascript_Expression
719 all none all 80% |   Javascript_More_Variables: ',' [Javascript_Comment]* Javascript_Variable_Definition [Javascript_InitData]
73,640 (none | 10% | 14% | 0% | none | none | 0% | 0% | 0% | 0% | none | none | 0% | 9% | 0% | none | 0% | 0% | 0% | 0% | 1% | 4% | 32% | 2% | 0% | 1% | 1% | 0% | 1% | 2% | 0% | 0% | 0% | 3% | 1% | 4% | 0% | 1% | 0% | 0% | 2% | 0% | none | 0% | 2% | 1% | 1% | 6%) Javascript_Expression: (Javascript_HexNumber | Javascript_Number | Javascript_Literal | Javascript_RegularExpression | Javascript_DotClass | Javascript_CastExpression | Javascript_ExpressionList | Javascript_StringFunction | Javascript_DeleteExpression | Javascript_ClassCreationExpression | Javascript_ClassCreationWithInitializers | Javascript_ClassCreationWithSubscript | Javascript_NewNoArgsExpression | Javascript_MethodInvocation | Javascript_PreIncrementExpression | Javascript_PreDecrementExpression | Javascript_PostIncrementExpression | Javascript_PostDecrementExpression | Javascript_NegativeExpression | Javascript_LogicalNotExpression | Javascript_NotExpression | Javascript_BuiltIn | Javascript_VariableExpression | Javascript_StrangeFunction | Javascript_ParenthesizedFunction | Javascript_Parenthesized_Expression | Javascript_SimpleArray | Javascript_CommentExpression | Javascript_Dictionary | Javascript_FunctionExpr | Javascript_TypeOfExpr | Javascript_VoidExpr | Javascript_SubscriptExpression | Javascript_Subfield | Javascript_MultiplicativeExpression | Javascript_AdditiveExpression | Javascript_ShiftExpression | Javascript_RelationalExpression | Javascript_InstanceOfExpression | Javascript_InExpression | Javascript_EqualityExpression | Javascript_AndExpression | Javascript_ExclusiveOrExpression | Javascript_InclusiveOrExpression | Javascript_ConditionalAndExpression | Javascript_ConditionalOrExpression | Javascript_TrueFalseExpression | Javascript_AssignmentExpression)
2,951 all all all |   Javascript_AdditiveExpression: Javascript_Expression ("+"|"-") Javascript_Expression
8 all all all |   Javascript_AndExpression: Javascript_Expression '&' Javascript_Expression
4,661 all all all |   Javascript_AssignmentExpression: Javascript_Expression ("="|"*="|"/="|"%="|"+="|"-="|"<<="|">>="|">>>="|"&="|"^="|"|=") Javascript_Expression
2,620 all |   Javascript_BuiltIn: ("false"|"null"|"String"|"super"|"this"|"true")
    |   Javascript_CastExpression: '(' Javascript_Type ')' Javascript_Expression
166 all all all |   Javascript_ClassCreationExpression: "new" Javascript_Type Javascript_ParenthesizedExpression
    |   Javascript_ClassCreationWithInitializers: "new" Javascript_Type '{' Javascript_ArgumentList '}'
    |   Javascript_ClassCreationWithSubscript: "new" Javascript_Type Javascript_Subscript*
95 all all |   Javascript_CommentExpression: Javascript_Comment Javascript_Expression
1,266 all all all |   Javascript_ConditionalAndExpression: Javascript_Expression "&&" Javascript_Expression
751 all all all |   Javascript_ConditionalOrExpression: Javascript_Expression "||" Javascript_Expression
37 all all |   Javascript_DeleteExpression: "delete" Javascript_Expression
608 all 7.76 none 3.00(0%) all |   Javascript_Dictionary: '{' Javascript_DictionaryItem* [','] [Javascript_Comment]* '}'
2,664 all all all |   |   Javascript_DictionaryItem: Javascript_Expression ':' Javascript_Expression
    |   Javascript_DotClass: Javascript_Type '.' "class"
1,320 all all all all |   Javascript_EqualityExpression: Javascript_Expression ("!=="|"==="|"=="|"!=") Javascript_Expression [Javascript_Comment]
    |   Javascript_ExclusiveOrExpression: Javascript_Expression '^' Javascript_Expression
299 all 1.00(0%) none all |   Javascript_ExpressionList: '{' [Javascript_Comment]* [Javascript_ArgumentList] '}'
1,543 all 1% |   Javascript_FunctionExpr: Javascript_Function [Javascript_ParenthesizedExpression]
70 all all all |   Javascript_InExpression: Javascript_Expression "in" Javascript_Expression
6 all all all |   Javascript_InclusiveOrExpression: Javascript_Expression '|' Javascript_Expression
18 all all all |   Javascript_InstanceOfExpression: Javascript_Expression "instanceof" Javascript_Type
2 all all |   Javascript_LogicalNotExpression: '~' Javascript_Expression
6,298 all all |   Javascript_MethodInvocation: Javascript_Variable Javascript_ParenthesizedExpression
658 all all all |   Javascript_MultiplicativeExpression: Javascript_Expression ("*"|"/"|"%") Javascript_Expression
59 all all |   Javascript_NegativeExpression: ("-"|"+") Javascript_Expression
114 all all |   Javascript_NewNoArgsExpression: "new" Javascript_Type
885 all all |   Javascript_NotExpression: '!' Javascript_Expression
47 all all all all |   Javascript_ParenthesizedFunction: '(' Javascript_Function ')' Javascript_ParenthesizedExpression
1,071 all |   Javascript_Parenthesized_Expression: Javascript_ParenthesizedExpression
27 all all |   Javascript_PostDecrementExpression: Javascript_Variable "--"
358 all all |   Javascript_PostIncrementExpression: Javascript_Variable "++"
    |   Javascript_PreDecrementExpression: "--" Javascript_Variable
40 all all |   Javascript_PreIncrementExpression: "++" Javascript_Variable
703 all all all |   Javascript_RelationalExpression: Javascript_Expression ("<"|">"|"<="|">=") Javascript_Expression
6 all all all |   Javascript_ShiftExpression: Javascript_Expression (">>>"|"<<"|">>") Javascript_Expression
980 all 65% 4.14(53%) all |   Javascript_SimpleArray: '[' [Javascript_Expression] [Javascript_MoreArray]* ']'
2,163 all 99% |   |   Javascript_MoreArray: ',' [Javascript_Expression]
1,464 all all all all all all |   Javascript_StrangeFunction: '(' Javascript_Number ',' Javascript_Variable ')' Javascript_ParenthesizedExpression
36 all all all all |   Javascript_StringFunction: "String" '(' Javascript_Expression ')'
1,997 all all all |   Javascript_Subfield: Javascript_Expression '.' Javascript_Expression
45 all all all all |   Javascript_SubscriptExpression: Javascript_Expression '[' Javascript_Expression ']'
753 all all none all all none all |   Javascript_TrueFalseExpression: Javascript_Expression '?' [Javascript_Comment]* Javascript_Expression ':' [Javascript_Comment]* Javascript_Expression
176 all all |   Javascript_TypeOfExpr: "typeof" Javascript_Expression
23,527 all |   Javascript_VariableExpression: Javascript_Variable
93 all all |   Javascript_VoidExpr: "void" Javascript_Number
1,965 all 22% all 70% 1.91(38%) 1.00(0%) all none all Javascript_Function: "function" [Javascript_Function_Definition] '(' [Javascript_FunctionParameter] [Javascript_MoreParameters]* [Javascript_Comment]* ')' [Javascript_Comment]* Javascript_FunctionBody
1,965 all 3.16(98%) all |   Javascript_FunctionBody: '{' [Javascript_StatementOrComment]* '}'
2,796 (all | none) |   Javascript_FunctionParameter: (Javascript_Variable_Definition | '$')
1,417 all all all |   Javascript_MoreParameters: ',' [Javascript_Comment] Javascript_FunctionParameter
9,055 all 2.79(92%) none all Javascript_ParenthesizedExpression: '(' [Javascript_Expression]* [','] ')'
402 8.32(66%) Javascript_Program: [Javascript_Element]*
2,212 (7% | 17% | 76%) |   Javascript_Element: (Javascript_Comment | Javascript_Function | Javascript_Statement)
15,694 0% all Javascript_Statement: [Javascript_Label] Javascript_RealStatement
24 all all |   Javascript_Label: Javascript_Label_Definition ':'
15,694 (54% | 10% | 14% | 0% | 1% | 0% | 0% | 3% | 9% | 7% | 0% | 0% | 1% | 0%) |   Javascript_RealStatement: (Javascript_ExpressionStmt | Javascript_StatementBlock | Javascript_Data | ';' | Javascript_BreakStatement | Javascript_ContinueStatement | Javascript_DoStatement | Javascript_ForStatement | Javascript_IfStatement | Javascript_ReturnStatement | Javascript_SwitchStatement | Javascript_ThrowStatement | Javascript_TryStatement | Javascript_WhileStatement)
8,515 all 1.00(1%) 81% |   |   Javascript_ExpressionStmt: Javascript_Expression [Javascript_MoreStatements]* [';']
126 all all |   |   |   Javascript_MoreStatements: ',' Javascript_Statement
1,612 all 2.19(98%) all |   |   Javascript_StatementBlock: '{' [Javascript_StatementOrComment]* '}'
11,692 (98% | 2%) |   Javascript_StatementOrComment: (Javascript_Statement | Javascript_Comment)
2,507 all all all Javascript_Subscript: '[' Javascript_Expression ']'
2,727 (90% | 10%) Javascript_Type: (("var"|"Array"|"Date"|"Image"|"String") | Javascript_Variable)
32,397 all 1.24(36%) 1.14(7%) Javascript_Variable: Javascript_VariableIdentifier [Javascript_DotIdentifier]* [Javascript_Subscript]*
14,501 all all |   Javascript_DotIdentifier: '.' Javascript_VariableIdentifier
46,898 (none | 99% | 1% | none) |   Javascript_VariableIdentifier: (Javascript_CastedVariable | Javascript_Identifier_Reference | ("this"|"class") | ("$"|"_"))
    |   |   Javascript_CastedVariable: '(' '(' Javascript_Type ')' Javascript_Identifier_Reference ')'
126 all 19% 67% Javascript_BreakStatement: "break" [Javascript_Identifier_Reference] [';']
2 all all Javascript_ContinueStatement: "continue" ';'
6 all all all all all all 50% Javascript_DoStatement: "do" Javascript_Statement "while" '(' Javascript_Expression ')' [';']
448 (13% | 87%) Javascript_ForStatement: (Javascript_ForCollectionStatement | Javascript_ForLoopStatement)
60 all all all 47% all all all all |   Javascript_ForCollectionStatement: "for" '(' Javascript_Type [Javascript_Variable] Javascript_InOrColon Javascript_Expression ')' Javascript_Statement
60 (none | all) |   |   Javascript_InOrColon: (':' | "in")
388 all all 97% all 94% 1.83(22%) all all all 91% 2% 2% all all |   Javascript_ForLoopStatement: "for" '(' [Javascript_ForLoopVariable] [("="|"+=")] [Javascript_Expression] [Javascript_More_Variables]* ';' [Javascript_Expression] ';' [Javascript_Expression] [','] [Javascript_Expression] ')' Javascript_Statement
375 (38% | 62%) |   |   Javascript_ForLoopVariable: (Javascript_ForLoopVariableNoType | Javascript_ForLoopVariableWithType)
143 all |   |   |   Javascript_ForLoopVariableNoType: Javascript_Variable
232 all all |   |   |   Javascript_ForLoopVariableWithType: Javascript_Type Javascript_Variable
1,391 all all 1.02 none all 1.00(0%) all 1.16(2%) 24% Javascript_IfStatement: "if" '(' Javascript_Expression* [Javascript_Comment]* ')' [Javascript_Comment]* Javascript_Statement [Javascript_Comment]* [Javascript_IfElseClause]
329 all all |   Javascript_IfElseClause: "else" Javascript_Statement
1,142 all 96% 35% Javascript_ReturnStatement: "return" [Javascript_Expression] [';']
38 all all all all all 5.37 24% all Javascript_SwitchStatement: "switch" '(' Javascript_Expression ')' '{' Javascript_CaseClause* [Javascript_DefaultClause] '}'
204 all all all 1.49(93%) |   Javascript_CaseClause: "case" Javascript_Expression ':' [Javascript_StatementOrComment]*
9 all all 1.00 |   Javascript_DefaultClause: "default" ':' Javascript_StatementOrComment*
53 all all 6% 6% 92% Javascript_ThrowStatement: "throw" Javascript_Expression [','] [Javascript_Expression] [';']
182 all all 13.16(79%) all 1.00(all) none Javascript_TryStatement: "try" '{' [Javascript_StatementOrComment]* '}' [Javascript_CatchBlock]* [Javascript_FinallyBlock]
182 all all all all all |   Javascript_CatchBlock: "catch" '(' Javascript_Variable_Definition ')' Javascript_Statement
    |   Javascript_FinallyBlock: "finally" Javascript_Statement
24 all all all all all Javascript_WhileStatement: "while" '(' Javascript_Expression ')' Javascript_Statement

Terminals = 9 (instances=75,586)
Tokens = 93 (instances=317,017)

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