On Fri, Jul 01, 2005 at 11:11:01AM -0500, Patrick R. Michaud wrote: > On Fri, Jul 01, 2005 at 08:38:01AM +0100, Nicholas Clark wrote:
> > Does this mean that you're using the same recursive approach that the perl 5 > > regular expression engine uses? (Not that I understand much of the perl 5 > > engine, except that uses recursion to maintain parts of state) > > Well, I don't know if I'm using the "same" recursive approach that > perl 5 uses, but yes PGE uses a subroutine call chain to maintain > certain parts of its backtracking status. The only recursive call is for > quantified group expressions of various sorts -- subpatterns and > subrules. Outside of that, it's just a linear chain of subroutine Does that include simple quantifiers such as * and + ? > I certainly won't claim this is the best way to do it, but for the > time being it seemed easier and more straightforward to just use bsr/ret > to maintain state than to build a separate chain to avoid using the > execution stack. Each pattern gets its own Coroutine and its own It's just that I'm wondering whether you're going the same way as the Perl 5 regexp engine and hence the current implementation will share its biggest weakness - repetitive matches against long strings blowing the stack. Nicholas Clark