On Tue, Apr 17, 2001 at 09:23:56AM -0400, John Porter wrote:
> Tim Bunce wrote:
> > If the file doesn't start with Perl 6 thingy then
> > it's Perl 5. Period.
> 
> To mandate the impossible is to mandate failure.
> 
> "Nothing can parse perl like Perl."
> 
> Why is that?

Because perl has a bunch of special conditions/extensions. And of course I 
wouldn't expect any first generation of perl6 to handle them correctly.

But second generations, third generations should be able to handle them 
effectively. The goal would be to make the multi-parserness of perl6 
as robust as possible.

And we've got the biggest regression test for this as we could possibly imagine:
most CPAN modules have inbuilt regression tests that could be used to see how 
well the perl6-perl5 translation is doing.

> > the parsers are going to be in perl, remember.
> 
> Sorry, Tim, I must have missed that.  Reference, please?
> 

I remember Larry saying that too. I would say it with a caveat, though - I 
would make the 'parser' perl(5 at first) that generates C and that was usable
both to compile perl and to use in perl6.

That way you could say:

        load python-syntax;

in the front of your scripts as pragma, where 'python-syntax' is a perl module
that first time round, or on changes, generates c, autocompiles itself, and 
loads itself like XS does currently.

And you could use the same method inside of perl to do the internal perl5/perl6
switch - a function could return the syntax in a given code block used 
(perl5 or perl6) and then pass the text to the appropriate parser (which could 
theoretically follow the same autocompile/autoload rules up above).



Having two mechanisms to do this - one parser to handle the 'parse perl'
case and another to handle the 'add additional syntax' case is not what we want
in perl6 IMO.

But that's exactly what we have right now - byacc generated source for perl, 
and a perl5 module Parse::RecDescent, to use in perl scripts. And anybody who 
uses both byacc and Parse::RecDescent knows which one is the easier to use, by
an order of magnitude.

Ed

Reply via email to