ECMAScript 6th Syntax Grammar

6th Edition / Draft September 27, 2013

この文章は working_draft_ecma-262_edition_6_09-27-13-rev19markup.pdf の構文部分の一部を抜き取り、編集したものです。
次期ECMAScriptのドラフトの最新版はharmony:specification_drafts [ES Wiki]にあげられるはずです。

Source Code

SourceCharacter:
  any Unicode character
  

Lexical Grammar

InputElementDiv:
  WhiteSpace
  LineTerminator
  Comment
  Token
  DivPunctuator
  RightBracePunctuator

InputElementRegExp:
  WhiteSpace
  LineTerminator
  Comment
  Token
  RightBracePunctuator
  RegularExpressionLiteral

InputElementTemplateTail:
  WhiteSpace
  LineTerminator
  Comment
  Token
  DivPunctuator
  TemplateSubstitutionTail
  

Unicode Format-Control Characters

Format-Control Character Usage
Code PointNameFormal NameUsage
U+200CZero width non-joiner<ZWNJ>IdentifierPart
U+200DZero width joiner<ZWJ>IdentifierPart
U+FEFFByte Order Mark<BOM>Whitespace

White Space

Whitespace Characters
Code PointNameFormal Name
U+0009Tab<Tab>
U+000BVartical Tab<VT>
U+000CForm Feed<FF>
U+0020Space<SP>
U+00A0No-break space<NBSP>
U+FEFFByte Order Mark<BOM>
Other category "Zs"Any other Unicode "space-separator"<USP>
WhiteSpace:
  <Tab>
  <VT>
  <FF>
  <SP>
  <NBSP>
  <BOM>
  <USP>
    

Line Terminators

Line Terminator Characters
Code Point Name Formal Name
U+000A Line Feed <LF>
U+000D Carriage Return <CR>
U+2028 Line separator <LS>
U+2029 Paragraph separator <PS>
LineTerminator:
  <LF>
  <CR>
  <LS>
  <PS>

LineTerminatorSequence:
  <LF>
  <CR> [lookahead ∉ <LF>]
  <LS>
  <PS>
  <CR> <LF>
    

Comments

Comment:
  MultiLineComment
  SingleLineComment

MultiLineComment:
  /* MultiLineCommentCharsopt */

MultiLineCommentChars:
  MultiLineNotAsteriskChar MultiLineCommentCharsopt
  * PostAsteriskCommentCharsopt

PostAsteriskCommentChars:
  MultiLineNotForwardSlashOrAsteriskChar MultiLineCommentCharsopt
  * PostAsteriskCommentCharsopt

MultiLineNotAsteriskChar:
  SourceCharacter but not *

MultiLineNotForwardSlashOrAsteriskChar:
  SourceCharacter but not one of / or *

SingleLineComment:
  // SingleLineCommentCharsopt

SingleLineCommentChars:
  SingleLineCommentChar SingleLineCommentCharsopt

SingleLineCommentChar:
  SourceCharacter but not LineTerminator
    

Tokens

Token:
  IdentifierName
  Punctuator
  NumericLiteral
  StringLiteral
  Template
    

Names and Keywords

Identifier:
  IdentifierName but not ReservedWord

IdentifierName:
  IdentifierStart
  IdentifierName IdentifierPart

IdentifierStart:
  UnicodeIDStart
  $
  _
  \ UnicodeEscapeSequence

IdentifierPart:
  UnicodeIDContinue
  $
  _
  \ UnicodeEscapeSequence
  <ZWNJ>
  <ZWJ>

UnicodeIDStart:
  any Unicode character with the Unicode property "ID_Start".

UnicodeIDContinue:
  any Unicode character with the Unicode property "ID_Continue".
    

Reserved Words

ReservedWord:
  Keyword
  FutureReservedWord
  NullLiteral
  BooleanLiteral
      
Keywords
Keyword: one of
  break do instanceof typeof
  case else let var
  catch export new void
  class finally return while
  const for super with
  continue function switch yield
  debugger if this
  default import throw
  delete in try
        
Future Reserved Words
FutureReservedWord: one of
  enum extends
        

The following tokens are also considered to be FutureReservedWord when they occure within strict mode code

implements package protected static
interface private public
        

Punctuators

Punctuator: one of
  { ( ) [ ] .
  ... ; , < > <=
  >= == != === !==
  + - * % ++ --
  << >> >>> & | ^
  ! ~ && || ? :
  = += -= *= %= <<=
  >>= >>>= &= |= ^= =>

DivPunctuator: one of
  / /=

RightBracePunctuator:
  }
      

Literals

Null Literals

NullLiteral:
  null
        

Boolean Literals

BooleanLiteral:
  true
  false
        

Numeric Literals

NumericLiteral:
  DecimalLiteral
  BinaryIntegerLiteral
  OctalIntegerLiteral
  HexIntegerLiteral

DecimalLiteral:
  DecimalIntegerLiteral . DecimalDigitsopt ExponentPartopt
  . DecimalDigits ExponentPartopt
  DecimalIntegerLiteral ExponentPartopt

DecimalIntegerLiteral:
  0
  NonZeroDigit DecimalDigitsopt

DecimalDigits:
  DecimalDigit
  DecimalDigits DecimalDigit

DecimalDigit: one of
  0 1 2 3 4 5 6 7 8 9

NonZeroDigit: one of
  1 2 3 4 5 6 7 8 9

ExponentPart:
  ExponentIndicator SignedInteger

ExponentIndicator: one of
  e E

SignedInteger:
  DecimalDigits
  + DecimalDigits
  - DecimalDigits

BinaryIntegerLiteral:
  0b BinaryDigits
  0B BinaryDigits

BinaryDigits:
  BinaryDigit
  BinaryDigits BinaryDigit

BinaryDigit: one of
  0 1

OctalIntegerLiteral:
  0o OctalDigits
  0O OctalDigits

OctalDigits:
  OctalDigit
  OctalDigits OctalDigit

OctalDigit: one of
  0 1 2 3 4 5 6 7

HexIntegerLiteral:
  0x HexDigits
  0X HexDigits

HexDigits:
  HexDigit
  HexDigits HexDigit

HexDigit: one of
  0 1 2 3 4 5 6 7 8 9
  a b c d e f A B C D E F
        

String Literals

StringLiteral:
  " DoubleStringCharactersopt "
  ' SingleStringCharactersopt '

DoubleStringCharacters:
  DoubleStringCharacter DoubleStringCharactersopt

SingleStringCharacters:
  SingleStringCharacter SingleStringCharactersopt

DoubleStringCharacter:
  SourceCharacter but not one of " or \ or LineTerminator
  \ EscapeSequence
  LineContinuation

SingleStringCharacter:
  SourceCharacter but not one of ' or \ or LineTerminator
  \ EscapeSequence
  LineContinuation

LineContinuation:
  \ LineTerminatorSequence

EscapeSequence:
  CharacterEscapeSequence
  0 [lookahead ∉ DecimalDigit]
  HexEscapeSequence
  UnicodeEscapeSequence

CharacterEscapeSequence:
  SingleEscapeCharacter
  NonEscapeCharacter

SingleEscapeCharacter: one of
  ' " \ b f n r t v

NonEscapeCharacter:
  SourceCharacter but not one of EscapeCharacter or LineTerminator

EscapeCharacter:
  SingleEscapeCharacter
  DecimalDigit
  x
  u

HexEscapeSequence:
  x HexDigit HexDigit

UnicodeEscapeSequence:
  u HexDigit HexDigit HexDigit HexDigit
  u{ HexDigits }
        
String Single Character Escape Sequences
Escape Sequence Code Unit Value Name Symbol
\b 0x0008 backspace <BS>
\t 0x0009 horizontal tab <HT>
\n 0x000A line feed(new line) <LF>
\v 0x000B vertical tab <VT>
\f 0x000C form feed <FF>
\r 0x000D carriage return <CR>
\" 0x0022 double quote "
\' 0x0027 single quote '
\\ 0x005C backslash \

Regular Expression Literals

RegularExpressionLiteral:
  / RegularExpressionBody / RegularExpressionFlags

RegularExpressionBody:
  RegularExpressionFirstChar RegularExpressionChars

RegularExpressionChars:
  [empty]
  RegularExpressionChars RegularExpressionChar

RegularExpressionFirstChar:
  RegularExpressionNonTerminator but not one of * or \ or / or [
  RegularExpressionBackslashSequence
  RegularExpressionClass

RegularExpressionChar:
  RegularExpressionNonTerminator but not one of \ or / or [
  RegularExpressionBackslashSequence
  RegularExpressionClass

RegularExpressionBackslashSequence:
  \ RegularExpressionNonTerminator

RegularExpressionNonTerminator:
  SourceCharacter but not LineTerminator

RegularExpressionClass:
  [ RegularExpressionClassChars ]

RegularExpressionClassChars:
  [empty]
  RegularExpressionClassChars RegularExpressionClassChar

RegularExpressionClassChar:
  RegularExpressionNonTerminator but not one of ] or \
  RegularExpressionBackslashSequence

RegularExpressionFlags:
  [empty]
  RegularExpressionFlags IdentifierPart
        

Template Literal Lexical Components

Template:
  NoSubstitutionTemplate
  TemplateHead

NoSubstitutionTemplate:
  ` TemplateCharactersopt `

TemplateHead:
  ` TemplateCharactersopt ${

TemplateSubstitutionTail:
  TemplateMiddle
  TemplateTail

TemplateMiddle:
  } TemplateCharactersopt ${

TemplateTail:
  } TemplateCharactersopt `

TemplateCharacters:
  TemplateCharacter TemplateCharactersopt

TemplateCharacter:
  SourceCharacter but not one of ` or \ or $ or LineTerminatorSequence
  $ [lookahead ∉ {]
  \ EscapeSequence
  LineContinuation
  LineTerminatorSequence
        

Expressions

Primary Expressions

PrimaryExpression:
  this
  IdentifierReference
  Literal
  ArrayInitialiser
  ObjectLiteral
  FunctionExpression
  ClassExpression
  GeneratorExpression
  GeneratorComprehension
  RegularExpressionLiteral
  TemplateLiteral
  CoverParenthesisedExpressionAndArrowParametersList

CoverParenthesisedExpressionAndArrowParametersList:
  ( Expression )
  ( )
  ( ... Identifier )
  ( Expression , ... Identifier )
    

Supplemental Syntax

When processing the production PrimaryExpression : CoverParenthesisedExpressionAndArrowParametersList the following grammar is used to refine the interpretation of CoverParenthesisedExpressionAndArrowParametersList.

ParenthesizedExpression:
  ( FormalParameterList )
      

Identifier Reference

IdentifierReference:
  Identifier
  [Only match if not within the FunctionBody of a GeneratorMethod, GeneratorDeclaration or GeneratorExpression] yield
      

Literals

Literal:
  NullLiteral
  ValueLiteral

ValueLiteral:
  BooleanLiteral
  NumericLiteral
  StringLiteral
      

Array Initialiser

ArrayInitialiser:
  ArrayLiteral
  ArrayComprehension
      
Array Literal
ArrayLiteral:
  [ Elisionopt ]
  [ ElementList ]
  [ ElementList , Elisionopt ]

ElementList:
  Elisionopt AssignmentExpression
  Elisionopt SpreadElement
  ElementList , Elisionopt AssignmentExpression
  ElementList , Elisionopt SpreadElement

Elision:
  ,
  Elision ,

SpreadElement:
  ... AssignmentExpression
        
Array Comprehension
ArrayComprehension:
  [ Comprehension ]

Comprehension:
  ComprehensionFor ComprehensionTail

ComprehensionTail:
  AssignmentExpression
  ComprehensionFor ComprehensionTail
  ComprehensionIf ComprehensionTail

ComprehensionFor:
  for ( ForBinding of AssignmentExpression )

ComprehensionIf:
  if ( AssignmentExpression )

ForBinding:
  BindingIdentifier
  BindingPattern
        

Object Initialiser

ObjectLiteral:
  { }
  { PropertyDefinitionList }
  { PropertyDefinitionList , }

PropertyDefinitionList:
  PropertyDefinition
  PropertyDefinitionList , PropertyDefinition

PropertyDefinition:
  IdentifierName
  CoverInitialisedName
  PropertyName : AssignmentExpression
  MethodDefinition

PropertyName:
  LiteralPropertyName
  ComputedPropertyName

LiteralPropertyName:
  IdentifierName
  StringLiteral
  NumericLiteral

ComputedPropertyName:
  [ AssignmentExpression ]

CoverInitialisedName:
  IdentifierName Initialiser

Initialiser:
  = AssignmentExpression
      

Generator Comprehensions

GeneratorComprehension:
  ( Comprehension )
      

Template Literals

TemplateLiteral:
  NoSubstitutionTemplate
  TemplateHead Expression [Lexical goal InputElementTemplateTail] TemplateSpans

TemplateSpans:
  TemplateTail
  TemplateMiddleList [Lexical goal InputElementTemplateTail] TemplateTail

TemplateMiddleList:
  TemplateMiddle Expression
  TemplateMiddleList [Lexical goal InputElementTemplateTail] TemplateMiddle Expression
      

Left-Hand-Side Expressions

MemberExpression:
  [Lexical goal InputElementRegExp] PrimaryExpression
  MemberExpression [ Expression ]
  MemberExpression . IdentifierName
  MemberExpression TemplateLiteral
  super [ Expression ]
  super . IdentifierName
  new super Argumentsopt
  new MemberExpression Arguments

NewExpression:
  MemberExpression
  new NewExpression

CallExpression:
  MemberExpression Arguments
  super Arguments
  CallExpression Arguments
  CallExpression [ Expression ]
  CallExpression . IdentifierName
  CallExpression TemplateLiteral

Arguments:
  ( )
  ( ArgumentList )

ArgumentList:
  AssignmentExpression
  ... AssignmentExpression
  ArgumentList , AssignmentExpression
  ArgumentList , ... AssignmentExpression

LeftHandSideExpression:
  NewExpression
  CallExpression
    

Postfix Expressions

PostfixExpression:
  LeftHandSideExpression
  LeftHandSideExpression [no LineTerminator here] ++
  LeftHandSideExpression [no LineTerminator here] --
    

Unary Operators

UnaryExpression:
  PostfixExpression
  delete UnaryExpression
  void UnaryExpression
  typeof UnaryExpression
  ++ UnaryExpression
  -- UnaryExpression
  + UnaryExpression
  - UnaryExpression
  ~ UnaryExpression
  ! UnaryExpression
    

Multiplicative Operators

MultiplicativeExpression:
  UnaryExpression
  MultiplicativeExpression * UnaryExpression
  MultiplicativeExpression / UnaryExpression
  MultiplicativeExpression % UnaryExpression
    

Additive Operators

AdditiveExpression:
  MultiplicativeExpression
  AdditiveExpression + MultiplicativeExpression
  AdditiveExpression - MultiplicativeExpression
    

Bitwise Shift Operators

ShiftExpression:
  AdditiveExpression
  ShiftExpression << AdditiveExpression
  ShiftExpression >> AdditiveExpression
  ShiftExpression <<< AdditiveExpression
    

Relational Operators

RelationalExpression:
  ShiftExpression
  RelationalExpression < ShiftExpression
  RelationalExpression > ShiftExpression
  RelationalExpression <= ShiftExpression
  RelationalExpression >= ShiftExpression
  RelationalExpression instanceof ShiftExpression
  RelationalExpression in ShiftExpression

RelationalExpressionNoIn:
  ShiftExpression
  RelationalExpressionNoIn < ShiftExpression
  RelationalExpressionNoIn > ShiftExpression
  RelationalExpressionNoIn <= ShiftExpression
  RelationalExpressionNoIn >= ShiftExpression
  RelationalExpressionNoIn instanceof ShiftExpression
    

Equality Operators

EqualityExpression:
  RelationalExpression
  EqualityExpression == RelationalExpression
  EqualityExpression != RelationalExpression
  EqualityExpression === RelationalExpression
  EqualityExpression !== RelationalExpression


EqualityExpressionNoIn:
  RelationalExpressionNoIn
  EqualityExpressionNoIn == RelationalExpressionNoIn
  EqualityExpressionNoIn != RelationalExpressionNoIn
  EqualityExpressionNoIn === RelationalExpressionNoIn
  EqualityExpressionNoIn !== RelationalExpressionNoIn
    

Binary Bitwise Operators

BitwiseANDExpression:
  EqualityExpression
  BitwiseANDExpression & EqualityExpression

BitwiseANDExpressionNoIn:
  EqualityExpressionNoIn
  BitwiseANDExpressionNoIn & EqualityExpressionNoIn

BitwiseXORExpression:
  BitwiseANDExpression
  BitwiseXORExpression ^ BitwiseANDExpression

BitwiseXORExpressionNoIn:
  BitwiseANDExpressionNoIn
  BitwiseXORExpressionNoIn ^ BitwiseANDExpressionNoIn

BitwiseORExpression:
  BitwiseXORExpression
  BitwiseORExpression | BitwiseXORExpression

BitwiseORExpressionNoIn:
  BitwiseXORExpressionNoIn
  BitwiseORExpressionNoIn | BitwiseXORExpressionNoIn
    

Binary Logical Operators

LogicalANDExpression:
  BitwiseXORExpression
  LogicalANDExpression && BitwiseORExpression

LogicalANDExpressionNoIn:
  BitwiseXORExpressionNoIn
  LogicalANDExpressionNoIn && BitwiseORExpressionNoIn

LogicalORExpression:
  LogicalANDExpression
  LogicalORExpression || LogicalANDExpression

LogicalORExpressionNoIn:
  LogicalANDExpressionNoIn
  LogicalORExpressionNoIn || LogicalANDExpressionNoIn
    

Conditional Operator

ConditionalExpression:
  LogicalORExpression
  LogicalORExpression ? AssignmentExpression : AssignmentExpression

ConditionalExpressionNoIn:
  LogicalORExpressionNoIn
  LogicalORExpressionNoIn ? AssignmentExpression : AssignmentExpressionNoIn
    

Assignment Operators

AssignmentExpression:
  ConditionalExpression
  [Only match if within the FunctionBody of a GeneratorMethod, GeneratorDeclaration or GeneratorExpression] YieldExpression
  ArrowFunction
  LeftHandSideExpression = AssignmentExpression
  LeftHandSideExpression AssignmentOperator AssignmentExpression

AssignmentExpressionNoIn:
  ConditionalExpressionNoIn
  YieldExpressionNoIn
  ArrowFunctionNoIn
  LeftHandSideExpression = AssignmentExpressionNoIn
  LeftHandSideExpression AssignmentOperator AssignmentExpressionNoIn

AssignmentOperator: one of
  *= /= %= += -= <<= >>= >>>= &= ^= |=
  

Destructuring Assingment

AssignmentPattern:
  ObjectAssignmentPattern
  ArrayAssignmentPattern

ObjectAssignmentPattern:
  { }
  { AssignmentPropertyList }
  { AssignmentPropertyList , }

ArrayAssignmentPattern:
  [ Elisionopt AssignmentRestElementopt ]
  [ AssignmentElementList ]
  [ AssignmentElementList , Elisionopt AssignmentRestElementopt ]

AssignmentPropertyList:
  AssignmentProperty
  AssignmentPropertyList , AssignmentProperty

AssignmentElementList:
  Elisionopt AssignmentElement
  AssignmentElementList , Elisionopt AssignmentElement

AssignmentProperty:
  Identifier Initialiseropt
  PropertyName : AssignmentElement

AssignmentElement:
  DestructuringAssignmentTarget Initialiseropt

AssignmentRestElement:
  ... DestructuringAssignmentTarget

DestructuringAssignmentTarget:
  LeftHandSideExpression
      

Comma Operator

Expression:
  AssignmentExpression
  Expression , AssignmentExpression

ExpressionNoIn:
  AssignmentExpressionNoIn
  ExpressionNoIn , AssignmentExpressionNoIn
    

Statements and Declarations

Statement:
  BlockStatement
  VariableStatement
  EmptyStatement
  ExpressionStatement
  IfStatement
  BreakableStatement
  ContinueStatement
  BreakStatement
  ReturnStatement
  WithStatement
  LabelledStatement
  ThrowStatement
  TryStatement
  DebuggerStatement

Declaration:
  FunctionDeclaration
  GeneratorDeclaration
  ClassDeclaration
  LexicalDeclaration

BreakableStatement:
  IterationStatement
  SwitchStatement
  

Block

BlockStatement:
  Block

Block:
  { StatementListopt }

StatementList:
  StatementListItem
  StatementList StatementListItem

StatementListItem:
  Statement
  Declaration
    

Declarations and the Variable Statement

Let and Const Declarations

LexicalDeclaration:
  LetOrConst BindingList ;

LexicalDeclarationNoIn:
  LetOrConst BindingListNoIn

LetOrConst:
  let
  const

BindingList:
  LexicalBinding
  BindingList , LexicalBinding

BindingListNoIn:
  LexicalBindingNoIn
  BindingListNoIn , LexicalBindingNoIn

LexicalBinding:
  BindingIdentifier Initialiseropt
  BindingPattern Initialiser

LexicalBindingNoIn:
  BindingIdentifier InitialiserNoInopt
  BindingPattern InitialiserNoIn

BindingIdentifier:
  default
  yield
  Identifier

InitialiserNoIn:
  = AssignmentExpressionNoIn
      

Variable Statement

VariableStatement:
  var VariableDeclarationList ;

VariableDeclarationList:
  VariableDeclaration
  VariableDeclarationList , VariableDeclaration

VariableDeclarationListNoIn:
  VariableDeclarationNoIn
  VariableDeclarationListNoIn , VariableDeclarationNoIn

VariableDeclaration:
  BindingIdentifier Initialiseropt
  BindingPattern Initialiser

VariableDeclarationNoIn:
  BindingIdentifier InitialiserNoInopt
  BindingPattern InitialiserNoIn
      

Destructuring Binding Patterns

BindingPattern:
  ObjectBindingPattern
  ArrayBindingPattern

ObjectBindingPattern:
  { }
  { BindingPropertyList }
  { BindingPropertyList , }

ArrayBindingPattern:
  [ Elisionopt BindingRestElementopt ]
  [ BindingElementList ]
  [ BindingElementList , Elisionopt BindingRestElementopt ]

BindingPropertyList:
  BindingProperty
  BindingPropertyList , BindingProperty

BindingElementList:
  Elisionopt BindingElement
  BindingElementList , Elisionopt BindingElement

BindingProperty:
  SingleNameBinding
  PropertyName : BindingElement

BindingElement:
  SingleNameBinding
  BindingPattern Initialiseropt

SingleNameBinding:
  BindingIdentifier Initialiseropt

BindingRestElement:
  ... BindingIdentifier
      

Empty Statement

EmptyStatement:
  ;
    

Expression Statement

ExpressionStatement:
  [lookahead ∉ {{, function, class}] Expression ;
    

The if Statement

IfStatement:
  if ( Expression ) Statement else Statement
  if ( Expression ) Statement
    

Iteration Statements

IterationStatement:
  do Statement while ( Expression )
  while ( Expression ) Statement
  for ( ExpressionNoInopt; Expressionopt; Expressionopt ) Statement
  for ( var VariableDeclarationListNoIn ; Expressionopt; Expressionopt ) Statement
  for ( LexicalDeclarationNoIn ; Expressionopt; Expressionopt ) Statement
  for ( LeftHandSideExpression in Expression ) Statement
  for ( var ForBinding in Expression ) Statement
  for ( ForDeclaration in Expression ) Statement
  for ( LeftHandSideExpression of AssignmentExpression ) Statement
  for ( var ForBinding of AssignmentExpression ) Statement
  for ( ForDeclaration of AssignmentExpression ) Statement

ForDeclaration:
  LetOrConst ForBinding
    

The continue Statement

ContinueStatement:
  continue ;
  continue [no LineTerminator here] Identifier ;
    

The break Statement

BreakStatement:
  break ;
  break [no LineTerminator here] Identifier ;
    

The return Statement

ReturnStatement:
  return ;
  return [no LineTerminator here] Expression ;
    

The with Statement

WithStatement:
  with ( Expression ) Statement
    

The switch Statement

SwitchStatement:
  switch ( Expression ) CaseBlock

CaseBlock:
  { CaseClausesopt }
  { CaseClausesopt DefaultClause CaseClausesopt }

CaseClauses:
  CaseClause
  CaseClauses CaseClause

CaseClause:
  case Expression : StatementListopt

DefaultClause:
  default : StatementListopt
    

Labelled Statements

LabelledStatement:
  Identifier : Statement
    

The throw Statement

ThrowStatement:
  throw [no LineTerminator here] Expression ;
    

The try Statement

TryStatement:
  try Block Catch
  try Block Finally
  try Block Catch Finally

Catch:
  catch ( CatchParameter ) Block

Finally:
  finally Block

CatchParameter:
  BindingIdentifier
  BindingPattern
    

The debugger Statement

DebuggerStatement:
  debugger ;
    

Functions and Classes

Function Definitions

FunctionDeclaration:
  function BindingIdentifier ( FormalParameters ) { FunctionBody }

FunctionExpression:
  function BindingIdentifieropt ( FormalParameters ) { FunctionBody }

StrictFormalParameters:
  FormalParameters

FormalParameters:
  [empty]
  FormalParameterList

FormalParameterList:
  FunctionRestParameter
  FormalsList
  FormalsList , FunctionRestParameter

FormalsList:
  FormalParameter
  FormalsList , FormalParameter

FunctionRestParameter:
  ... BindingIdentifier

FormalParameter:
  BindingElement

FunctionBody:
  FunctionStatementList

FunctionStatementList:
  StatementListopt
    

Arrow Function Definitions

ArrowFunction:
  ArrowParameters => ConciseBody

ArrowFunctionNoIn:
  ArrowParameters => ConciseBodyNoIn

ArrowParameters:
  BindingIdentifier
  CoverParenthesisedExpressionAndArrowParametersList

ConciseBody:
  [lookahead ∉ { { }] AssignmentExpression
  { FunctionBody }

ConciseBodyNoIn:
  [lookahead ∉ { { }] AssignmentExpressionNoIn
  { FunctionBody }
    

Method Definitions

MethodDefinition:
  PropertyName ( StrictFormalParameters ) { FunctionBody }
  GeneratorMethod
  get PropertyName ( ) { FunctionBody }
  set PropertyName ( PropertySetParameterList ) { FunctionBody }

PropertySetParameterList:
  BindingIdentifier
  BindingPattern
    

Generator Function Definitions

GeneratorMethod:
  * PropertyName ( StrictFormalParameters ) { FunctionBody }

GeneratorDeclaration:
  function * BindingIdentifier ( FormalParameters ) { FunctionBody }

GeneratorExpression:
  function * BindingIdentifieropt ( FormalParameters ) { FunctionBody }

YieldExpression:
  yield
  yield [no LineTerminator here] [Lexical goal InputElementRegExp] AssignmentExpression
  yield * [Lexical goal InputElementRegExp] AssignmentExpression

YieldExpressionNoIn:
  yield
  yield [no LineTerminator here] [Lexical goal InputElementRegExp] AssignmentExpressionNoIn
  yield * [Lexical goal InputElementRegExp] AssignmentExpressionNoIn
    

Class Definitions

ClassDeclaration:
  class BindingIdentifier ClassTail

ClassExpression:
  class BindingIdentifieropt ClassTail

ClassTail:
  ClassHeritageopt { ClassBodyopt }

ClassHeritage:
  extends AssignmentExpression

ClassBody:
  ClassElementList

ClassElementList:
  ClassElement
  ClassElementList ClassElement

ClassElement:
  MethodDefinition
  static MethodDefinition
  ;
    

Modules and Scripts

Modules

Module:
  ModuleBodyopt

ModuleBody:
  ModuleItemList

ModuleItemList:
  ModuleItem
  ModuleItemList ModuleItem

ModuleItem:
  ExportDeclaration
  ScriptItem

ScriptItem:
  ModuleDeclaration
  ImportDeclaration
  StatementListItem
    

Imports

ModuleDeclaration:
  module [no LineTerminator here] BindingIdentifier FromClause ;

ImportDeclaration:
  import ImportClause FromClause ;
  import ModuleSpecifier ;

FromClause:
  from ModuleSpecifier

ImportClause:
  BindingIdentifier
  { }
  { ImportsList }
  { ImportsList , }

ImportsList:
  ImportSpecifier
  ImportsList , ImportSpecifier

ImportSpecifier:
  BindingIdentifier
  IdentifierName as BindingIdentifier

ModuleSpecifier:
  StringLiteral
      

Exports

ExportDeclaration:
  export * FromClauseopt ;
  export ExportsClause FromClauseopt ;
  export VariableStatement ;
  export Declaration ;
  export BindingList ;

ExportsClause:
  { }
  { ExportsList }
  { ExportsList , }

ExportsList:
  ExportSpecifier
  ExportsList , ExportSpecifier

ExportSpecifier:
  IdentifierReference
  IdentifierReference as IdentifierName
      

Scripts

Script:
  ScriptBodyopt

ScriptBody:
  ScriptItemList

ScriptItemList:
  ScriptItem
  ScriptItemList ScriptItem