Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re^3: YACC rules to regex rules ?

by LanX (Saint)
on Sep 02, 2020 at 13:01 UTC ( [id://11121290]=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11121290]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (2)
As of 2024-04-16 23:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found