On Wed, Apr 20, 2005 at 10:21:32AM -0700, Larry Wall wrote: > On Thu, Apr 21, 2005 at 12:50:56AM +0800, Autrijus Tang wrote: > : I see. Do you think preserving the /span/ (i.e. the character offset > ranges) > : of each AST element is enough to do that? That effectively means each > : node points to a substring inside the original source string. > > Yes, though making a copy isn't bad if it's not the default behavior. > It mostly just needs a "spot".
Okay. I'll make it happen then. Is this something we want to make available at the runtime language level, in addition to the compiler error/warnings level? > p5-to-p5 actually intercepts the op_free() calls and has a place > for all the optimized trees. But that's not the default behavior. > By default it only costs one empty "madprops" pointer per op node. > (MAD stands for miscellaneous attribute decorations.) Only if we > set the "madskills" option do we generate a linked list of madprops. Wow, nice trick. Mad props to you. :) > Then you don't have to worry about the overhead in the general case, > and you also don't have to worry about your two parses getting out > of sync in the specific case. You just have to know in advance when > you want to remember the details, which I think is not too much of > a constraint. As you noted in the followup mail, I think the compiler needs to remember the active subrule and source code range anyway, so that performance penalty is already there. > If you don't want to worry about this in the Haskell version of the > compiler, that's okay, as long as we think about it more when we > bootstrap the Perl 6 version. I do intend to bootstrap the Perl 6 version by simply compiling the Pugs source code from Haskell into Perl6 AST, then decompile it back into Perl 6 code. :-) That is, unless someone crazy enough comes around and recoded everything in Perl 6 by hand... Thanks, /Autrijus/
pgpSLpfMhGbK8.pgp
Description: PGP signature