[antlr-interest] Re: Summary of ANTLR Issues
lgcraymer
lgc at mail1.jpl.nasa.gov
Wed Jul 9 15:12:09 PDT 2003
You misunderstand. An attribute syntax would also need to be added
(not a problem--that would provide a base for specifications that
could be for used automatic AST class generation) to properly support
heterogeneous AST classes, but I think that we should do that anyway.
The idea of using a "smart custom allocator" sounds good in theory,
but may not save much in practice--initialization still has to be done
for each "new", and a good allocator is already fairly efficient for
reusing memory blocks.
As far as the usage that you mention, the major impact would be to
move some AST processing from the parsing pass to a tree walker
pass. I don't see that as being a problem.
ANTLR 3 tree support (including heterogeneous AST) will be better and
more actively maintained--my version of antlr.g uses heteroASTs
for tree grammar construction--than in ANTLR 2.
--Loring
--- In antlr-interest at yahoogroups.com, "Tiller, Michael (M.M.)"
<mtiller at f...> wrote:
> > From: lgcraymer [mailto:lgc at m...]
> > Subject: [antlr-interest] Re: Summary of ANTLR Issues
> >
> >
> > Actually, immediate invocation of an AST method is something that
> > ANTLR 3 probably won't support--we are likely to change the way
ASTs
> > are constructed to optimize away the problem of excessive AST node
> > allocation (creating a node and then never using it). The idea is
> > that ANTLR would construct a list of AST operations (node
creation,
> > add sibling, make root) and then apply them at the end of a
> > rule. You would have to have "MyMethod" called by the
constructor.
> >
> > --Loring
>
> Really! That seems a little extreme to me. Not only does it remove
the
> ability to work on the heterogeneous ASTS, it seems to remove the
ability to
> work on the current AST completely?!? Do you really think it will
be worth
> it do this? Wouldn't a clever allocator (that recycled ASTs) be
much
> better?
>
> This would be really disappointing (in my opinion) because I work on
the
> current AST all the time (providing scoping information, annotating
the AST
> nodes with relationship information). Sure I have to do a silly
cast now
> (because of the lack of heteroAST support), but I couldn't even use
my
> casting trick in this case! (if I'm understanding you correctly)
>
> --
> Mike
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list