[antlr-interest] Re: trees with payloads??

lgcraymer lgc at mail1.jpl.nasa.gov
Fri Nov 12 00:32:23 PST 2004



--- In antlr-interest at yahoogroups.com, "John D. Mitchell"
<johnm-antlr at n...> wrote:
> >>>>> "lgcraymer" == lgcraymer  <lgc at m...> writes:
> >>>>>> In antlr-interest at yahoogroups.com, "John D. Mitchell"
> [...]
> 
> >> I think you're talking about my demand, ahem :-), that there be a
> >> standard slot for a set of dynamic attributes.  The actual set would
> >> only be created if needed so the only required overhead is the
> >> reference/pointer.
> 
> > We part company here.  I can see that as part of an AST library
facility
> > (use this if you want to), but not as a default.  It adds a library
> > requirement for Hashmap which complicates porting.
> 
> IMNSHO, the dynamic attributes support is a fundamental feature of Antlr
> v3.

Well, maybe.  It is a feature that has not yet been put to
experimental test.  It might turn out to be extremely valuable, or it
might be just another bit of glitz.

Also, while Hashmaps might be required by ANTLR to support dynamic
attributes, that does not mean that they should be present in the
generated code.  Generating attribute classes or structures should be
pretty straightforward, and the runtime attribute containers should
probably be implemented as fields in the generated lexers, parsers,
and treewalkers so that they are accessible within rules.  That would
certainly help to ensure that analysis passes (most of the work done
in actions) can have good performance.  And the ANTLR 3 output
templates should make the code generation even easier.

> > On the other hand, if that requirement were added, I'd be willing
to see
> > syntactic support for symbol table manipulation in ANTLR--that
would be a
> > relatively small next step.
> 
> Hmm... Adding some stack support to the dynamic attribute stuff is a no
> brainer but what sort of syntactic support are you thinking of?

Structure definition for symbols, scoping support, and I don't know
what else.  It is possible that this could be handled within the
attribute syntax as that develops; however, I still don't see the
argument for ANTLR to directly support dictionaries/hashmaps in
generated code.  I'd much rather be able to generate Java code during
development and efficient C++ code for high-performance standalone
applications; generating attribute structures/classes is preferable to
requiring use of Hashmaps.

--Loring

> Take care,
> 	John





 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/antlr-interest/

<*> To unsubscribe from this group, send an email to:
    antlr-interest-unsubscribe at yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 





More information about the antlr-interest mailing list