[antlr-interest] advocacy of C++ support in ANTLR 3.x

Jim Idle jimi at temporal-wave.com
Thu Apr 3 07:26:40 PDT 2008


As I said, if I have wandered away from that recently, it is a mistake as it is intended to do this, so I will fix it up for the release of 3.1. I have been talking as if it already was like this because it is supposed to be :-)

Jim

> -----Original Message-----
> From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-
> bounces at antlr.org] On Behalf Of Tomas Potrusil
> Sent: Thursday, April 03, 2008 12:27 AM
> To: ANTLR
> Subject: Re: [antlr-interest] advocacy of C++ support in ANTLR 3.x
> 
> > If they want to replace the entire tree structure, then they
> > ignore ANTLR3_COMMON_TREE and inherit from
> > ANTLR3_BASE_TREE_ADAPTOR; this requires them to implement all
> > methods, but means that their tree node could be some C++ type
> > completely divorced from ANTLR -- the adaptor carries the burden
> > of converting the interfaces.
> 
> This is exactly what I wanted to say. Thanks Gavin.
> 
> I think that this is exactly the reason why adaptors were introduced.
> To be
> completely independent of the ANTLR tree classes/structures. If you
> omit
> this independence then the adaptors are not real adaptors as they do
> not
> adapt your classes to something ANTLR can understand. In the current
> situation you can remove all the "adaptive" functions from
> ANTLR3_BASE_TREE_ADAPTOR and call the functions directly on
> ANTLR3_BASE_TREE
> - this change will preserve all other functionality, the uses will not
> need
> to notice it... But then the ANTLR3_BASE_TREE_ADAPTOR will consist of
> functions that do just some sugar (i.e. becomeRoot()), these could be
> also
> removed somewhere else, and the rest will be just "factory methods".
> And
> hence the ANTLR3_BASE_TREE_ADAPTOR will be renamed to
> ANTLR3_BASE_TREE_FACTORY :-) It will be perfectly correct, the current
> functionality will be entirely preserved, but this system will be
> obviously
> without adaptors...
> 
> Tom






More information about the antlr-interest mailing list