-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Labels
Description
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