On Jul-04, Jeff 'japhy' Pinyan wrote: > I want to make sure I haven't misunderstood anything. *What* purpose will > my module that will be able to parse Perl 6 regexes into a tree be? You > must be aware that I have no power Damian does not possess, and I cannot > translate *all* Perl 6 regexes to Perl 5 regexes. All I can promise is a > tree structure and limited (albeit correct) translation to Perl 5.
In general, it could perhaps be used as a piece of the implementation of Perl6-style regexes for any Parrot-hosted language. Personally, I could see using it with the current prototype perl6 compiler to take over the parsing whenever a regex is seen. The resulting tree structure would then be translated into a languages/regex-style tree, and from there converted into PIR instructions. The translation step could perhaps be skipped if your parser uses some extensible factory-like pattern so that I could produce my preferred regex tree nodes directly -- or if I converted my regex compiler to use your tree nodes as their native representation. In order to get the parsing correct, however, I would need the ability to call back into my native perl6 parser when you encounter perl6 code during your parse -- and perhaps call you again within that code. I don't know if this is in the scope of what you were planning for your parser; now I'm wondering if you were intending to write something akin to Perl6::Rules in that it translates Perl6 rules into perl5-edible chunks, and all this business of reentrancy and external parsing callouts is not at all what you're interested in dealing with. If so, then I would still find a use for it in providing a better Perl6-style regex parser for languages/regex. It would be used mostly for testing, but eventually I hope to get around to plugging languages/regex into Parrot as a directly-callable compiler. This has the same reentrancy etc. issues for the host language, but then they're that language's author's problem, not mine. :-) I'll go download Regexp::Parser now, just so I'm not speculating quite so much.