Skip to content

Babel plugin for the parser/grammar language #36

@ultraq

Description

@ultraq

Using the operators of the parser to build out the grammar can get quite long, eg: to code the standard variable expression syntax, I have to write this JavaScript: Sequence(/\${/, 'Chain', /\}/).

One idea of simplifying this is to maybe write a Babel plugin that can take some marker and then convert everything inside it to the relevant code, ie: so I could express the above as something like this instead: ${ Chain }.

While that gain might not look like much, it becomes more apparent with longer sequences like the definition of "chain":
Sequence(Optional('Negation'), 'ChainLink', ZeroOrMore(Sequence(/\./, 'ChainLink')))

In the grammar notation, that could be written as:
Negation? ChainLink .* ChainLink

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions