A grammar is regular if it is either right-linear or left-linear. This tutorial claims that because of that it has the special property:
A regular grammar has a special property: by substituting every nonterminal (except the root one) with its righthand side, you can reduce it down to a single production for the root, with only terminals and operators on the right-hand side... The reduced expression of terminals and operators can be written in an even more compact form, called a regular expression
So I've decided to test that idea and convert the regular EcmaScript grammar for IdentifierName into regular expressions:
IdentifierName ::
IdentifierStart
IdentifierName IdentifierPart
Suppose IdentifierStart and IdentifierPart are limited to the following:
IdentifierStart :: IdentifierPart ::
A A
B C
C &
$
_
But I'm not sure how to proceed since the grammar for IdentifierName has both recursion and alternation. Any help?
I'm more interested in the approach rather than in finding the resulting regexp which as @Bergi showed is [ABC$_][AC&]*.
[ABC$_][AC&]*- Bergi