Grammar extracted by Vadim Zaytsev, see the Grammar Zoo entry for details: js/synytskyy-cordy/extracted
Source used for this grammar: Mykyta Synytskyy, James R. Cordy, TXL Javascript Grammar, Version 2.5, Rev 21.3.12, March 2012
program
, js_program
, js_subscope
, js_declaration_or_statement
, js_label
, js_declaration
, js_variable_declaration
, js_variable_description
, js_variable_initialization
, js_constant_declaration
, js_constant_description
, js_function_declaration
, js_function_expn
, js_formal_parameter
, js_expn
, js_assignment_expn
, assign_js_conditional_expn
, js_assignment_op
, js_conditional_expn
, js_conditional_clause
, js_logical_or_expn
, js_logical_or_logical_and_expn
, js_logical_and_expn
, js_logical_and_bitwise_or_expn
, js_bitwise_or_expn
, js_bitwise_or_bitwise_xor_expn
, js_bitwise_xor_expn
, js_bitwise_xor_bitwise_and_expn
, js_bitwise_and_expn
, js_bitwise_and_equality_expn
, js_equality_expn
, js_equality_op_relational_expn
, js_equality_op
, js_relational_expn
, js_relational_op_shift_expn
, js_relational_op
, js_shift_expn
, js_shift_op_additive_expn
, js_shift_op
, js_additive_expn
, js_additive_op_multiplicative_expn
, js_additive_op
, js_multiplicative_expn
, js_multiplicative_op_unary_expn
, js_multiplicative_op
, js_unary_expn
, js_unary_op
, js_postfix_expn
, js_postfix_op
, js_lefthand_side_expn
, js_member_expn
, js_selector
, js_arguments
, js_subscripts
, js_field_selector
, js_primary_expn
, js_literal
, js_numeric_literal
, js_string_literal
, js_regular_expn_literal
, js_array_literal
, js_array_element
, js_object_literal
, js_property_assignment
, js_property_name
, js_property_set_parameter
, js_statement
, js_empty_statement
, js_compound_statement
, js_expression_statement
, js_if_statement
, js_else_clause
, js_for_statement
, js_declaration_or_statement_no_nl
, js_while_statement
, js_break_statement
, js_continue_statement
, js_return_statement
, js_with_statement
, js_switch_statement
, js_case_clause
, js_case_clause_value
, js_do_statement
, js_try_catch_statement
, js_catch_clause
, js_finally_clause
, js_throw_statement
, js_debugger_statement
), 0 root (—), 1 top (program
), 12 bottom (comment
, js_regexp
, NL
14, id
13, EX
4, number
2, stringlit
, IN
4, js_hex_number
, charlit
, SPON
, SPOFF
).program ::= js_program
js_program ::=
js_declaration_or_statement
js_subscope ::=
js_declaration_or_statement
js_declaration_or_statement ::=
js_declaration NL
js_label
js_statement NL
comment NLjs_label ::=
id ":"
js_declaration ::= js_variable_declaration ";" js_constant_declaration ";" js_function_declaration ";"
js_variable_declaration ::= "var" js_variable_description ","
js_variable_description ::=
id js_variable_initialization
js_variable_initialization ::=
"=" js_assignment_expn
js_constant_declaration ::= "const" js_constant_description ","
js_constant_description ::= id js_variable_initialization
js_function_declaration ::= NL "function" id "(" js_formal_parameter "," ")" NL "{" NL IN js_subscope EX "}" NL
js_function_expn ::= "function" id "(" js_formal_parameter "," ")" NL "{" NL IN js_subscope EX "}"
js_formal_parameter ::= id
js_expn ::=
js_assignment_expn
js_assignment_expn ::=
js_conditional_expn assign_js_conditional_expn
assign_js_conditional_expn ::= js_assignment_op js_conditional_expn
js_assignment_op ::= "=" "*=" "/" SPOFF "=" SPON "%=" "+=" "-=" "<<=" ">>=" ">>>=" "&=" "^=" "|="
js_conditional_expn ::=
js_logical_or_expn js_conditional_clause
js_conditional_clause ::= "?" js_assignment_expn ":" js_assignment_expn
js_logical_or_expn ::=
js_logical_and_expn js_logical_or_logical_and_expn
js_logical_or_logical_and_expn ::=
"||" js_logical_and_expn
js_logical_and_expn ::=
js_bitwise_or_expn js_logical_and_bitwise_or_expn
js_logical_and_bitwise_or_expn ::=
"&&" js_bitwise_or_expn
js_bitwise_or_expn ::=
js_bitwise_xor_expn js_bitwise_or_bitwise_xor_expn
js_bitwise_or_bitwise_xor_expn ::=
"|" js_bitwise_xor_expn
js_bitwise_xor_expn ::=
js_bitwise_and_expn js_bitwise_xor_bitwise_and_expn
js_bitwise_xor_bitwise_and_expn ::=
"^" js_bitwise_and_expn
js_bitwise_and_expn ::=
js_equality_expn js_bitwise_and_equality_expn
js_bitwise_and_equality_expn ::=
"&" js_equality_expn
js_equality_expn ::=
js_relational_expn js_equality_op_relational_expn
js_equality_op_relational_expn ::= js_equality_op js_relational_expn
js_equality_op ::= "==" "!=" "===" "!==" "in" "instanceof"
js_relational_expn ::=
js_shift_expn js_relational_op_shift_expn
js_relational_op_shift_expn ::= js_relational_op js_shift_expn
js_relational_op ::= "<" ">" "<=" ">="
js_shift_expn ::=
js_additive_expn js_shift_op_additive_expn
js_shift_op_additive_expn ::= js_shift_op js_additive_expn
js_shift_op ::= "<<" ">>" ">>>"
js_additive_expn ::=
js_multiplicative_expn js_additive_op_multiplicative_expn
js_additive_op_multiplicative_expn ::= js_additive_op js_multiplicative_expn
js_additive_op ::= "+" "-"
js_multiplicative_expn ::=
js_unary_expn js_multiplicative_op_unary_expn
js_multiplicative_op_unary_expn ::= js_multiplicative_op js_unary_expn
js_multiplicative_op ::= "*" "/" "%"
js_unary_expn ::=
js_unary_op
js_postfix_expnjs_unary_op ::= "delete" "void" "typeof" "++" "--" "+" "-" "~" "!"
js_postfix_expn ::=
js_lefthand_side_expn js_postfix_op
js_postfix_op ::= "++" "--"
js_lefthand_side_expn ::= "new" js_member_expn
js_member_expn ::=
js_primary_expn js_selector
js_selector ::= js_arguments js_subscripts js_field_selector
js_arguments ::= "(" js_assignment_expn "," ")"
js_subscripts ::= "[" js_expn "]"
js_field_selector ::=
"." id
js_primary_expn ::= "this" "class" id js_literal js_array_literal js_object_literal js_function_expn "(" js_expn ")"
js_literal ::= "null" "true" "false" js_numeric_literal js_string_literal js_regular_expn_literal
js_numeric_literal ::= number js_hex_number
js_string_literal ::= stringlit charlit
js_regular_expn_literal ::= js_regexp
js_array_literal ::= "[" js_array_element "," "]"
js_array_element ::=
js_assignment_expn
js_object_literal ::= "{" js_property_assignment "," "," "}"
js_property_assignment ::= js_property_name ":" js_expn "get" js_property_name "(" ")" "{" js_subscope "}" "set" js_property_name "(" js_property_set_parameter ")" "{" js_subscope "}"
js_property_name ::= id js_string_literal number
js_property_set_parameter ::= id
js_statement ::= js_compound_statement ";" js_expression_statement ";" js_if_statement ";" js_for_statement ";" js_while_statement ";" js_break_statement ";" js_continue_statement ";" js_return_statement ";" js_with_statement ";" js_switch_statement ";" js_do_statement ";" js_try_catch_statement ";" js_throw_statement ";" js_debugger_statement ";" js_empty_statement
js_empty_statement ::=
";"
js_compound_statement ::= "{" NL IN js_subscope EX "}"
js_expression_statement ::= js_expn
js_if_statement ::= "if" "(" js_expn ")" js_declaration_or_statement js_else_clause
js_else_clause ::=
"else" js_declaration_or_statement
js_for_statement ::= "for" "(" js_declaration_or_statement_no_nl "," ";" js_expn ";" js_expn ")" js_statement "for" "each" "(" js_declaration_or_statement_no_nl "in" js_expn ")" js_statement
js_declaration_or_statement_no_nl ::= js_declaration js_statement
js_while_statement ::= "while" "(" js_expn ")" js_statement
js_break_statement ::= "break" id
js_continue_statement ::= "continue" id
js_return_statement ::= "return" js_expn
js_with_statement ::= "with" "(" js_expn ")" js_statement
js_switch_statement ::= "switch" "(" js_expn ")" "{" NL js_case_clause "}"
js_case_clause ::= js_case_clause_valueNL IN js_subscope EX
js_case_clause_value ::= "case" js_expn ":" "default" ":"
js_do_statement ::= "do" js_statement "while" "(" js_expn ")"
js_try_catch_statement ::= "try" js_compound_statement js_catch_clause js_finally_clause
js_catch_clause ::= NL "catch" "(" id ")" js_compound_statement
js_finally_clause ::=
NL "finally" js_compound_statement
js_throw_statement ::=
"throw" js_expn
js_debugger_statement ::=
"debugger"