On Thu, Dec 08, 2005 at 01:46:51PM -0500, Rob Kinyon wrote: : > As for the original question, I think that the Perl 6 grammar will : > be a much better example for how to parse other languages than a : > Perl 5 grammar would be, since one of the underlying design currents : > from the beginning has been that Perl 6 had to be a language that : > was amenable to parsing by Perl 6 rules (with a little help from a : > bottom-up operator-precedence expression parser.) : : Once Patrick is done with PGE, will it be able to parse Perl5? If so, : why aren't we focusing on that?
Sure, but if you want to parse it *correctly* and know what it actually means, I estimate it'll take about 20 times as much effort as you're thinking it will, because there are an incredible number of foibles in the Perl 5 parser. Otherwise you might as well just use perl5:PPI. I'm not trying to malign the PPI approach here. It works most of the time, and when it works, it works fine. I don't doubt that it will produce better translations of certain programs, especially source-filtered programs where the filtering can essentially be ignored. But with the "PPD" approach I'm aiming first for a correct semantic translation and secondarily for a close syntactic translation, so what you'll get out of my approach is a post-source-filtered translation that is likelier to work but less likely to be readable. For a known source filter we can perhaps then refactor that back to a more readable form. In the long run these different approaches will complement each other, and help us better understand each approach's weaknesses and strengths. It's just that I have to take the PPD approach because no one else is simultaneously knowledgable enough and nutty enough to attempt it and succeed. (Whether I am myself knowledgable enough and nutty enough to succeed is yet to be decided. Recent signs are encouraging, especially in the latter department.) Larry