On Sun, 9 Jun 2002 [EMAIL PROTECTED] wrote: : The parsing of perl 6 is the application of a huge, compiled, regex, correct?
No, it's a system of compiled regexes which we're calling a grammar. : In order to parse the new syntax, perl6 is going to have to compile the : new rule, and stick it in the place of the old one, for the duration of the : scope, right? Doesn't exactly "stick it in place of" except in an abstract sense. It uses ordinary method overriding to hide the old rule. : Now what happens to the parser at large if you have dependencies on what has : changed - ex: if you change the rule for brackets, say so that all '[' are now : actually '[[' and all ']' are now ']]'. Won't the whole regex for parsing : perl need to be recompiled for the duration of the block, or at least the : dependencies on the things that you changed? And won't *that* be slow and/or : memory intensive? No, only the rule in question is compiled, and that only happens once regardless of how often you invoke the rule. There might possibly be a compilation phase when you derive a new grammar from an old one, but that's a tradeoff we can make when we get to it. It'd still only happen once for a given grammar. : And if the rules are somehow abstracted in the perl6 parser/parrot/regex engine : ,so that each 'rule' is in essence a pointer to the real code corresponding to : interpreting that rule (so it can be replaced easily by user defined ones) - : well won't that abstraction hurt the performance of parsing regular perl? If that becomes an issue we can always install a hard-wired lexer/parser as the base grammar. : And finally, if the regular expressions are in bytecode to get this flexibility : as opposed to native machine code, what sort of overhead will this impose on : the regex engine? Er, Perl 5's regexes are in their own pecurliar bytecode, not in native machine code. If anything, we'll be better off with Perl 6's JITable bytecode. : I know the above might be a bit simplistic, and since its an implementation : question I'm posting to perl6-internals instead, but the post is more for the : point of clarification about what's going on than anything else. I'd love to : see this happen, would use it all the time.. That's our dream. Larry