in reply to Recursive Regex: Update

On a slight tangent, is anyone else interested in the idea of (as an experiment) hacking perl to use the PCRE library in place of its built-in engine? I don't think it would be all that hard.

It took me a week to hack three new operators into toke.c and perly.y and add the corresponding opcodes, and Perl's tokenizer is second only to its regex engine in how difficult it is to modify. In other words, have fun--the sane people will watch from a safe distance. :^)

=cut
--Brent Dax
There is no sig.

Replies are listed 'Best First'.
Re: Re: Recursive Regex: Update
by robin (Chaplain) on Apr 24, 2002 at 08:54 UTC
    Oh, I'm not planning to touch the regex engine. That would be lunacy, as you say! Just bypassing the current engine altogether will be much less difficult.

    I'm appropriately respectful of your bravery in venturing into the tokeniser. It scares the hell out of me.

      My things have come a long way since this thread. :-)

      Id say hacking this into the regex engine is probably a good thing. And i suspect that its probably easier to do so than to hack PCRE into perl. Even perls own regex engine is not easily properly pluggable due to a lack of hooks into sv.c's re_dup(). I suspect that getting the PCRE engine would have the same problems. Which actually reminds me, we need to make sure that Perl 5.10 has the appropriate hooks so that making pluggable regex engines for perl 5.10 and later is easier.

      ---
      $world=~s/war/peace/g

        You're right that things have come a long way. I'm not scared of the tokeniser any more, for example. The regex code still gives me the willies, but I guess you're happier with it than you were in 2002. :-) The most unsatisfactory thing about the PCRE recursion code is that the match data is still a plain list, when morally it ought to be a tree. If we could get that sorted, you could write an entire parser as a single regex!