Luke has answered this better than I would have. In particular, he wrote:

> Perl's contextual sensitivity is part of the language.  So the best you
> can do is to track everything like you mentioned.  It's going to be
> impossible to parse Perl without having perl around to do it for you.

That first sentence is the critical point to remember. Without C<use> and C<BEGIN> and the new macro facilities, Perl just wouldn't be Perl.

I would just add that we have indeed "Ma[d]e Perl 6 easier to parse". In concrete terms, to parse Perl 6 (in Perl 6) you'll simply write the following one line:

        $parse_tree = ( $source_text ~~ m:keepall/ <Perl.prog> / );

which will completely parse your source. Because *during* its parse it will run any C<BEGIN> blocks or macros and C<use> any modules, thereby *lexically* adapting its own grammar as it goes. What you'll get back is a tree of submatches (including whitespace and comments, if you want them), which you can then reprocess as you wish.

Damian


PS: Yes, I'll be at OSDC <www.osdc.com.au> next week (giving the opening and closing keynotes, in fact). And, yes, you're most welcome have a chat with me about Perl 6 sometime during the conference.



Reply via email to