Luke Palmer writes: : > You can do anything you like if you mess with the parser. Changing : > the rules for recognizing an identifier would be trivial. : : Does this refer to messing with the parser... compile time (that is, when : Perl compiles, not when Perl is compiled)? Or are you actually talking : about screwing with the Perl source? That'd sure be cool (albeit a little : weird) to change parsing rules at compile time.
When Perl starts out parsing Perl 6, it starts with a standard set of Perl 6 grammar rules. At any point during the parse, any "immediate" subroutine could switch you to a different grammar object, either one entirely unrelated, such as embedded C or Java, or more likey, a slight variant, probably written as a derived class of the standard Perl grammar, where one or two rule methods are overridden. Any grammar production in Perl 6 will be able to be overridden in this way, so you could redefine a block as easily as an identifier. Such a grammar switching routine could operate either over a lexical scope or over the rest of the file. The only restriction is that one module not clobber the grammar of a different module. Basically, we're trying to make the opposite mistake of the one we made with source filters. :-) Larry