[antlr-interest] Re: trees with payloads??
John D. Mitchell
johnm-antlr at non.net
Fri Nov 12 10:47:01 PST 2004
>>>>> "lgcraymer" == lgcraymer <lgc at mail1.jpl.nasa.gov> writes:
>>>>>> In antlr-interest at yahoogroups.com, "John D. Mitchell"
[...]
>> 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.
It's more than just glitz.
Coming from a language designer's perspective, dynamically scoped
attributes fill a capability niche that is not provided for by any of the
statically scope capabilities.
In terms of praxis, look at how many times people have written their own
(buggy :-) version of dynamic attributes. Heck, I've done it a handful of
times myself on different translation projects.
> 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.
Again, in terms of implementation, I'm extremely open to allowing the
different code generators & runtime combinations to do whatever they want
as long as they provide all of the capabilities.
As I noted for the notes from the workshop, the dynamically scoped
attributes need to support cabilities for things like LIFO & FIFO access;
specification of things like at most one/n, exactly one/n, at least one/n;
pushing/popping bundles of attributes; search current scope for attribute,
search up stack for attribute; etc.
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