Skip to content

Instantly share code, notes, and snippets.

@nbp
Last active October 11, 2019 14:01
Show Gist options
  • Save nbp/ad9c2a5578d67ac307d333605180f0a4 to your computer and use it in GitHub Desktop.
Save nbp/ad9c2a5578d67ac307d333605180f0a4 to your computer and use it in GitHub Desktop.
Script :
StatementList?
Module :
StatementList?
StatementList :
Statement
StatementList Statement
Statement :
Block
ExpressionStatement
EmptyStatement
`if` `(` Expression[+In] `)` Statement
`else` Statement
`do` Statement `while` `(` Expression[+In] `)` `;`
`while` `(` Expression[+In] `)` Statement
`for` `(` [lookahead != `let`] Expression[~In]? `;` Expression[+In]? `;` Expression[+In]? `)` Statement
`for` `(` LocalDeclaration[~In] `;` Expression[+In]? `;` Expression[+In]? `)` Statement
`for` `(` [lookahead != `let`] Expression[~In] `in` Expression[+In] `)` Statement
`for` `(` LocalDeclaration[~In] `in` Expression[+In] `)` Statement
`for` AwaitKeyword? `(` [lookahead != `let` ] Expression[~In] `of` Expression[+In] `)` Statement
`for` AwaitKeyword? `(` LocalDeclaration[~In] `of` Expression[+In] `)` Statement
`switch` `(` Expression[+In] `)` Block
`case` Expression[+In] `:`
`default` `:`
`continue` `;`
`continue` Identifier `;`
`break` `;`
`break` Identifier `;`
`return` `;`
`return` Expression[+In] `;`
`with` `(` Expression[+In] `)` Statement
Identifier `:` Statement
`throw` Expression[+In] `;`
`try` Block
`catch` `(` Expression[+In] `)` Block
`catch` Block
`finally` Block
`debugger` `;`
Declaration
`import` ImportClause FromClause? `;`
`export` `*` FromClause `;`
`export` ExportClause FromClause? `;`
`export` Declaration
`export` `default` Statement
Declaration :
LocalDeclaration[+In] `;`
FunctionDeclaration
ClassDeclaration
AwaitKeyword :
`await`
AsyncKeyword :
`async`
Sparkle :
`*`
Block :
`{` StatementList? `}`
EmptyStatement :
`;`
ExpressionStatement :
[lookahead <! {`{`, `function`, `async`, `class`, `let`}] Expression[+In] `;`
LocalDeclaration[In] :
`var` Expression[?In]
`let` Expression[?In]
`const` Expression[?In]
FunctionDeclaration :
`function` Sparkle? Identifier `(` Expression[+In]? `)` Block
`async` `function` Sparkle? Identifier `(` Expression[+In]? `)` Block
FunctionExpression :
`function` Sparkle? Identifier? `(` Expression[+In]? `)` Block
`async` `function` Sparkle? Identifier? `(` Expression[+In]? `)` Block
ClassDeclaration :
`class` Identifier ClassHeritage? `{` ClassElementList? `}`
ClassExpression :
`class` Identifier? ClassHeritage? `{` ClassElementList? `}`
ClassHeritage :
`extends` PostfixExpression
Expression[In] :
AssignmentExpression[?In]
Expression[?In] `,` AssignmentExpression[?In]
AssignmentExpression[In] :
ConditionalExpression[?In]
`yield`
`yield` AssignmentExpression[?In]
`yield` `*` AssignmentExpression[?In]
PostfixExpression `=>` ConciseBody[?In]
`async` Identifier `=>` ConciseBody[?In]
PostfixExpression AssignmentOperator AssignmentExpression[?In]
ConciseBody[In] :
[lookahead != `{`] AssignmentExpression[?In]
Block
AssignmentOperator :
`=`
`*=`
`/=`
`%=`
`+=`
`-=`
`<<=`
`>>=`
`>>>=`
`&=`
`^=`
`|=`
`**=`
ConditionalExpression[In] :
BinaryExpression[?In]
BinaryExpression[?In] `?` AssignmentExpression[+In] `:` AssignmentExpression[?In]
BinaryExpression[In] :
UnaryExpression
BinaryExpression[?In] BinaryOperator[?In] UnaryExpression
BinaryOperator[In] :
`||`
`&&`
`|`
`^`
`&`
`==`
`!=`
`===`
`!==`
`<`
`>`
`<=`
`>=`
`instanceof`
[+In] `in`
`<<`
`>>`
`>>>`
`+`
`-`
`*`
`/`
`%`
`**`
UnaryExpression :
PostfixExpression
UnaryOperator UnaryExpression
UnaryOperator :
`delete`
`void`
`typeof`
`+`
`-`
`~`
`!`
`await`
`++`
`--`
`new`
`...`
PostfixExpression :
PrimaryExpression
PostfixExpression `++`
PostfixExpression `--`
PostfixExpression Arguments
PostfixExpression `[` Expression[+In] `]`
PostfixExpression `.` IdentifierName
PostfixExpression TemplateLiteral
`new` `.` `target`
PrimaryExpression :
`null`
`true`
`false`
NumericLiteral
StringLiteral
RegularExpressionLiteral
TemplateLiteral
IdentifierReference
`this`
`super`
`(` Expression[+In] `)`
`[` Expression[+In] `]`
`{` `}`
`{` PropertyDefinitionList `}`
`{` PropertyDefinitionList `,` `}`
FunctionExpression
ClassExpression
TemplateLiteral :
NoSubstitutionTemplate
TemplateHead Expression[+In] TemplateMiddleList? TemplateTail
TemplateMiddleList :
TemplateMiddle Expression[+In]
TemplateMiddleList TemplateMiddle Expression[+In]
PropertyDefinitionList :
PropertyDefinition
PropertyDefinitionList `,` PropertyDefinition
PropertyDefinition :
PropertyName
PropertyName `=` AssignmentExpression[+In]
PropertyName `:` AssignmentExpression[+In]
MethodDefinition
`...` AssignmentExpression[+In]
MethodDefinition :
MethodPrefix? PropertyName `(` Expression[+In]? `)` Block
MethodPrefix :
`get`
`set`
`async`
`async` `*`
`*`
ClassElementList :
ClassElement
ClassElementList ClassElement
ClassElement :
MethodDefinition
`static` MethodDefinition
`;`
ImportClause :
Identifier
ImportExportSet
`*` `as` Identifier
Identifier `,` ImportExportSet
ImportExportSet :
`{` `}`
`{` ImportExportList `}`
`{` ImportExportList `,` `}`
ImportExportList :
IdentifierName
ImportExportList `,` IdentifierName
ImportExportList `as` IdentifierName
ExportClause :
ImportExportSet
FromClause :
`from` StringLiteral
Identifier ::
> implemented in Rust
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment