[antlr-interest] setTreeAdaptor and delegates

Terence Parr parrt at cs.usfca.edu
Fri Jun 20 12:48:06 PDT 2008


INteresting....i wonder if you'd ever want the delegates to have  
different tree ctors.

I guess the setTreeAdaptor should announce.  Hmm...i wonder what else  
falls into same category.  Added:

http://www.antlr.org:8888/browse/ANTLR-302

Ter
On Jun 20, 2008, at 1:20 PM, Dimitrios Kolovos wrote:

> In the composite grammar (3.1.b) that I'm working on, I need to set  
> the TreeAdaptor of the generated parser to a custom one. I expected  
> that setting the TreeAdaptor to the top-level parser would also  
> propagate it in the delegates but this doesn't seem to be the case.
>
> If implementing such a TreeAdaptor-propagating behaviour would be  
> too much of a problem, it would be nice to at least have a field  
> (e.g. "delegates") that contains a collection of all the delegates  
> in the generated parser (in addition to the individual fields) so  
> that one can implement this propagating behaviour in a recursive  
> manner using a generic algorithm that doesn't need to know the  
> names of each delegate. (Such a generic algorithm would also  
> require the getTreeAdaptor() and setTreeAdaptor() methods to be  
> moved to a core base-class such as Parser or Base Recognizer)



More information about the antlr-interest mailing list