Skip to content

Commit

Permalink
Grammars for ES2015-ES2022 (#452)
Browse files Browse the repository at this point in the history
From #451:

> I have added preliminary grammars for all JavaScript releases from ES2015 through ES2022
>
> - `generate-ecmascript-grammar.mjs` and `grammarkdown.ohm` have been updated to parse later ES specs
> - `extract-grammarkdown.mjs` and `dedent.py` have been included to create a clean Grammarkdown grammar from an ES spec
> - Extracted & manually cleaned ES grammars for each release
> - Per-grammar overrides have been moved from `generate-ecmascript-grammar.mjs` to an `override.json` file, along with productions containing reserved words
> - Grammarkdown grammars & overrides have been organized into folders for each version of ES
> - Generated Ohm grammars for each ES version
>   - Grammars appear to parse JS programs correctly in the Ohm editor
>   - Using the esm module loader syntax is only supported if the start symbol is changed to `Module`
  • Loading branch information
pdubroy committed May 12, 2023
1 parent be831b7 commit 1a88964
Show file tree
Hide file tree
Showing 32 changed files with 24,603 additions and 933 deletions.
8 changes: 4 additions & 4 deletions examples/ecmascript/gen/es2015.grammar.ohm
Original file line number Diff line number Diff line change
Expand Up @@ -960,19 +960,19 @@ ES2015 {

withYield = /* fixme */

noYield = /* fixme */
noYield = ~any /* is this right? */

withIn = /* fixme */

noIn = /* fixme */
noIn = ~any /* is this right? */

withReturn = /* fixme */

noReturn = /* fixme */
noReturn = ~any /* is this right? */

withDefault = /* fixme */

noDefault = /* fixme */
noDefault = ~any /* is this right? */

break = "break" ~identifierPart
do = "do" ~identifierPart
Expand Down
Loading

0 comments on commit 1a88964

Please sign in to comment.