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.

    Abigail