Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

Re: Re: Perl and Context Free Grammar

by Anonymous Monk
on Nov 19, 2003 at 14:20 UTC ( #308299=note: print w/replies, xml ) Need Help??

in reply to Re: Perl and Context Free Grammar
in thread Perl and Context Free Grammar

A push-down automata <sp?> (or stack machine) is required to read a Context Free Grammer. The Perl "Regular expression engine" is a stack machine due to the way it processes expressions in () and (?...). I would argue (and take the time to flesh out my logic) that the Perl RE Engine is actually a CFG engine.

Replies are listed 'Best First'.
Re: Perl and Context Free Grammar
by Abigail-II (Bishop) on Nov 19, 2003 at 15:00 UTC
    It's not able to parse CFG grammers due to it being a stack machine so it can do backreferencing. I believe it can parse CFGs due to its ability to do "delayed regexes" - the (??{ }) construct. 5.004 for instance also uses a stack to parse regexes, but there's no way you can match balanced parens with a 5.004 regex. But you can make a CFG to match balanced parens.


Log In?

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (5)
As of 2021-04-13 18:01 GMT
Find Nodes?
    Voting Booth?

    No recent polls found