in reply to Re^2: YACC rules to regex rules ?
in thread YACC rules to regex rules ? (UPDATED)

> perlretut#Defining-named-patterns plus embedded Perl code

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.

Update

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

Replies are listed 'Best First'.
Re^4: YACC rules to regex rules ?
by tybalt89 (Monsignor) on Sep 02, 2020 at 13:24 UTC

    There is or used to be a Parse::Yapp

Re^4: YACC rules to regex rules ?
by Anonymous Monk on Sep 04, 2020 at 03:03 UTC