Annex A (informative) Grammar Summary
A.1 Lexical Grammar
MultiLineCommentChars ::
MultiLineNotAsteriskChar MultiLineCommentCharsopt
* PostAsteriskCommentCharsoptPostAsteriskCommentChars ::
MultiLineNotForwardSlashOrAsteriskChar MultiLineCommentCharsopt
* PostAsteriskCommentCharsoptIdentifierPart ::
IdentifierStart
UnicodeCombiningMark
UnicodeDigit
UnicodeConnectorPunctuation
<ZWNJ>
<ZWJ>
UnicodeLetter ::
any character in the Unicode categories “Uppercase letter (Lu)”, “Lowercase letter (Ll)”, “Titlecase letter (Lt)”, “Modifier letter (Lm)”, “Other letter (Lo)”, or “Letter number (Nl)”.
UnicodeCombiningMark ::
any character in the Unicode categories “Non-spacing mark (Mn)” or “Combining spacing mark (Mc)”
UnicodeConnectorPunctuation ::
any character in the Unicode category “Connector punctuation (Pc)”
Keyword :: one of
| break | do | instanceof | typeof |
| case | else | new | var |
| catch | finally | return | void |
| continue | for | switch | while |
| debugger | function | this | with |
| default | if | throw | |
| delete | in | try |
FutureReservedWord :: one of
| class | enum | extends | super |
| const | export | import |
The following tokens are also considered to be FutureReservedWords when parsing strict mode code (see 10.1.1).
| implements | let | private | public |
| interface | package | protected | static |
| yield |
Punctuator :: one of
| { | } | ( | ) | [ | ] |
| . | ; | , | < | > | <= |
| >= | == | != | === | !== | |
| + | - | * | % | ++ | -- |
| << | >> | >>> | & | | | ^ |
| ! | ~ | && | || | ? | : |
| = | += | -= | *= | %= | <<= |
| >>= | >>>= | &= | |= | ^= |
DivPunctuator :: one of
| / | /= |
DecimalLiteral ::
DecimalIntegerLiteral
. DecimalDigitsopt ExponentPartopt. DecimalDigits ExponentPartoptDecimalIntegerLiteral ExponentPartopt
DoubleStringCharacter ::
SourceCharacter but not one of
" or \ or LineTerminator\ EscapeSequenceLineContinuation
SingleStringCharacter ::
SourceCharacter but not one of
' or \ or LineTerminator\ EscapeSequenceLineContinuation
EscapeSequence ::
CharacterEscapeSequence
0 [lookahead ∉ DecimalDigit]HexEscapeSequence
UnicodeEscapeSequence
RegularExpressionFirstChar ::
RegularExpressionNonTerminator but not one of
* or \ or / or [RegularExpressionBackslashSequence
RegularExpressionClass
RegularExpressionChar ::
RegularExpressionNonTerminator but not
\ or / or [RegularExpressionBackslashSequence
RegularExpressionClass
RegularExpressionClassChars ::
[empty]
RegularExpressionClassChars RegularExpressionClassChar
RegularExpressionClassChar ::
RegularExpressionNonTerminator but not
] or \RegularExpressionBackslashSequence
A.2 Number Conversions
StringNumericLiteral :::
StrWhiteSpaceopt
StrWhiteSpaceopt StrNumericLiteral StrWhiteSpaceopt
StrDecimalLiteral :::
StrUnsignedDecimalLiteral
+ StrUnsignedDecimalLiteral- StrUnsignedDecimalLiteralStrUnsignedDecimalLiteral :::
Infinity
DecimalDigits
. DecimalDigitsopt ExponentPartopt. DecimalDigits ExponentPartoptDecimalDigits ExponentPartopt
A.3 Expressions
ElementList :
Elisionopt AssignmentExpression
ElementList
, Elisionopt AssignmentExpressionPropertyNameAndValueList :
PropertyAssignment
PropertyNameAndValueList
, PropertyAssignmentPropertyAssignment :
PropertyName
: AssignmentExpressionget PropertyName ( ) { FunctionBody }set PropertyName ( PropertySetParameterList ) { FunctionBody }MemberExpression :
PrimaryExpression
FunctionExpression
MemberExpression
[ Expression ]MemberExpression
. IdentifierNamenew MemberExpression ArgumentsCallExpression :
MemberExpression Arguments
CallExpression Arguments
CallExpression
[ Expression ]CallExpression
. IdentifierNamePostfixExpression :
LeftHandSideExpression
LeftHandSideExpression [no LineTerminator here]
++LeftHandSideExpression [no LineTerminator here]
--UnaryExpression :
PostfixExpression
delete UnaryExpressionvoid UnaryExpressiontypeof UnaryExpression++ UnaryExpression-- UnaryExpression+ UnaryExpression- UnaryExpression~ UnaryExpression! UnaryExpressionMultiplicativeExpression :
UnaryExpression
MultiplicativeExpression
* UnaryExpressionMultiplicativeExpression
/ UnaryExpressionMultiplicativeExpression
% UnaryExpressionAdditiveExpression :
MultiplicativeExpression
AdditiveExpression
+ MultiplicativeExpressionAdditiveExpression
- MultiplicativeExpressionShiftExpression :
AdditiveExpression
ShiftExpression
<< AdditiveExpressionShiftExpression
>> AdditiveExpressionShiftExpression
>>> AdditiveExpressionRelationalExpression :
ShiftExpression
RelationalExpression
< ShiftExpressionRelationalExpression
> ShiftExpressionRelationalExpression
<= ShiftExpressionRelationalExpression
>= ShiftExpressionRelationalExpression
instanceof ShiftExpressionRelationalExpression
in ShiftExpressionRelationalExpressionNoIn :
ShiftExpression
RelationalExpressionNoIn
< ShiftExpressionRelationalExpressionNoIn
> ShiftExpressionRelationalExpressionNoIn
<= ShiftExpressionRelationalExpressionNoIn
>= ShiftExpressionRelationalExpressionNoIn
instanceof ShiftExpressionEqualityExpression :
RelationalExpression
EqualityExpression
== RelationalExpressionEqualityExpression
!= RelationalExpressionEqualityExpression
=== RelationalExpressionEqualityExpression
!== RelationalExpressionEqualityExpressionNoIn :
RelationalExpressionNoIn
EqualityExpressionNoIn
== RelationalExpressionNoInEqualityExpressionNoIn
!= RelationalExpressionNoInEqualityExpressionNoIn
=== RelationalExpressionNoInEqualityExpressionNoIn
!== RelationalExpressionNoInBitwiseANDExpressionNoIn :
EqualityExpressionNoIn
BitwiseANDExpressionNoIn
& EqualityExpressionNoInBitwiseXORExpressionNoIn :
BitwiseANDExpressionNoIn
BitwiseXORExpressionNoIn
^ BitwiseANDExpressionNoInBitwiseORExpressionNoIn :
BitwiseXORExpressionNoIn
BitwiseORExpressionNoIn
| BitwiseXORExpressionNoInLogicalANDExpressionNoIn :
BitwiseORExpressionNoIn
LogicalANDExpressionNoIn
&& BitwiseORExpressionNoInLogicalORExpressionNoIn :
LogicalANDExpressionNoIn
LogicalORExpressionNoIn
|| LogicalANDExpressionNoInConditionalExpression :
LogicalORExpression
LogicalORExpression
? AssignmentExpression : AssignmentExpressionConditionalExpressionNoIn :
LogicalORExpressionNoIn
LogicalORExpressionNoIn
? AssignmentExpression : AssignmentExpressionNoInAssignmentExpression :
ConditionalExpression
LeftHandSideExpression
= AssignmentExpressionLeftHandSideExpression AssignmentOperator AssignmentExpression
AssignmentExpressionNoIn :
ConditionalExpressionNoIn
LeftHandSideExpression
= AssignmentExpressionNoInLeftHandSideExpression AssignmentOperator AssignmentExpressionNoIn
AssignmentOperator : one of
| *= | /= | %= | += | -= | <<= | >>= | >>>= | &= | ^= | |= |
A.4 Statements
Statement :
Block
VariableStatement
EmptyStatement
ExpressionStatement
IfStatement
IterationStatement
ContinueStatement
BreakStatement
ReturnStatement
WithStatement
LabelledStatement
SwitchStatement
ThrowStatement
TryStatement
DebuggerStatement
VariableDeclarationList :
VariableDeclaration
VariableDeclarationList
, VariableDeclarationVariableDeclarationListNoIn :
VariableDeclarationNoIn
VariableDeclarationListNoIn
, VariableDeclarationNoInIterationStatement :
do Statement while ( Expression );while ( Expression ) Statementfor ( ExpressionNoInopt ; Expressionopt ; Expressionopt ) Statementfor ( var VariableDeclarationListNoIn ; Expressionopt ; Expressionopt ) Statementfor ( LeftHandSideExpression in Expression ) Statementfor ( var VariableDeclarationNoIn in Expression ) StatementA.5 Functions and Programs
FunctionExpression :
function Identifieropt ( FormalParameterListopt ) { FunctionBody }A.6 Universal Resource Identifier Character Classes
uriAlpha ::: one of
a b c d e f g h i j k l m n o p q r s t u v w x y zA B C D E F G H I J K L M N O P Q R S T U V W X Y ZA.7 Regular Expressions
QuantifierPrefix ::
*+?{ DecimalDigits }{ DecimalDigits , }{ DecimalDigits , DecimalDigits }Atom ::
PatternCharacter
.\ AtomEscapeCharacterClass
( Disjunction )( ? : Disjunction )CharacterEscape ::
ControlEscape
c ControlLetterHexEscapeSequence
UnicodeEscapeSequence
IdentityEscape
ControlLetter :: one of
a b c d e f g h i j k l m n o p q r s t u v w x y zA B C D E F G H I J K L M N O P Q R S T U V W X Y ZNonemptyClassRanges ::
ClassAtom
ClassAtom NonemptyClassRangesNoDash
ClassAtom
– ClassAtom ClassRangesNonemptyClassRangesNoDash ::
ClassAtom
ClassAtomNoDash NonemptyClassRangesNoDash
ClassAtomNoDash
– ClassAtom ClassRangesA.8 JSON
A.8.1 JSON Lexical Grammar
JSONStringCharacter ::
SourceCharacter but not one of
" or \ or U+0000 through U+001F\ JSONEscapeSequenceA.8.2 JSON Syntactic Grammar
JSONValue :
JSONNullLiteral
JSONBooleanLiteral
JSONObject
JSONArray
JSONString
JSONNumber