Unfortunately it's not obvious how to implement precedence and associativity with named patterns.
This requires at least one lookahead for an operator.
Reimplementing the C code from Yacc and Lex would be quite slow.
I looked at CPAN for efficient recursive parsers allowing "precedence" but not much luck.
I'm giving up here.
While I'm sure it's possible to translate YACC rules to efficient regular expressions, it would be quite time consuming.
Parser generators are not trivial.
FWIW I found some good threads on the topic, but it'd be cool to transform YACC rules to efficient regexes, because we could easily adapt a parser to language changes.
NB: There are multiple versions of AWK available.
Some interesting threads
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
In reply to Re^3: YACC rules to regex rules ?
by LanX
in thread YACC rules to regex rules ? (UPDATED)
by LanX
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |