Andy Wardley wrote: > > If my understanding of the design of Perl 6 is correct, the lexer, parser > and any other related components will be highly configurable and/or > replaceable. The goal is to provide support for "little languages" by > separating Perl the language from perl the interpreter. It will be > possible to modify or replace Perl the grammar so that perl the program > can parse other languages, including Python, Ruby and presumably, XML.
I think that you're a bit mistaken : the goal is to have (a) parrot execute other languages (once compiled to parrot bytecode) and (b) perl's parser able to modify itself at runtime. The fact that Perl's grammar can evolve doesn't mean that the basic entities it operates on will also evolve, and, as a Python string can't be seamlessly mapped to a Perl string, one can't have perl behave as a Python interpreter only by modifying its parser. > So instead of writing Perl programs to parse and manipulate XML, it > should be possible to modify Perl itself so that it parses the XML directly > into some internal form suitable for programmatical manipulation. And moreover XML by itself is not a programming language, so I don't see how it's possible to build a generic interpreter for it. > How exactly this will manifest itself, I cannot tell. If you wave hands very fast, bushes might start burning ;-) > Nor can I say if this > is actually a sensible thing to do or not. But unless my understanding is > warped, support for parsing XML and other markup languages could be moved > down into the core of the parser internals for Perl 6. I think you're overriding too much the meaning of 'parser' here. Basically I think that perl6's internal parser, even after heavy reconfiguration, will remain an engine to parse context-free languages, with a few improvements. That's very different from a parser for markup languages. (Of course, with a mechanism comparable to perl 5's source filters, one can plug everything. So, as Leon was saying, you can begin to implement a Perl5::XML source filter module right now.)