Skip to content

Instantly share code, notes, and snippets.

@xcambar
Created March 7, 2012 00:34
Show Gist options
  • Save xcambar/1990115 to your computer and use it in GitHub Desktop.
Save xcambar/1990115 to your computer and use it in GitHub Desktop.
ECMAScript Harmony - conflicting states in grammar
Program ::= ProgramElement*
ProgramElement ::= Statement
| VariableDeclaration
| FunctionDeclaration
| ImportDeclaration
| ExportDeclaration
| ModuleDeclaration
ModuleSpecifier ::= StringLiteral | Path
ModuleDeclaration ::= "module" Id "at" String ";"
| "module" Id "is" ImportSource ";"
| "module" Id "{" ModuleBody "}"
ImportSource ::= Id ("from" ModuleSpecifier)?
ImportDeclaration ::= "import" ImportSpecifierSet "from" ModuleSpecifier ";"
ImportSpecifierSet ::= Id
| "*"
| "{" ImportSpecifier ("," ImportSpecifier)* "}"
ImportSpecifier ::= Id (":" Id)?
ExportDeclaration ::= "export" ExportSpecifierSet ("," ExportSpecifierSet)* ";"
| "export" VariableDeclaration
| "export" FunctionDeclaration
| "export" ModuleDeclaration
/**
*
* This rule holds the modification
*
**/
ExportSpecifierSet ::= "{" ExportSpecifier ("," ExportSpecifier)* "}"
| Id
| "*" ("from" Path)?
ExportSpecifier ::= Id (":" Path)?
ModuleBody ::= ModuleElement*
ModuleElement ::= Statement
| VariableDeclaration
| FunctionDeclaration
| ModuleDeclaration
| ImportDeclaration
| ExportDeclaration
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment