[antlr-interest] C++ library code reference counting classes

Ric Klaren ric.klaren at gmail.com
Thu Jun 30 01:59:24 PDT 2005


On 6/30/05, Paul Johnson <gt54-antlr at cyconix.com> wrote:
> I'm working my way through the C++ library code, and I have a couple of
> questions (by the way, who wrote this code? Is it 'new', or was it
> translated from a Java source?)

AFAIK it was very direct java port. E.g. many java-isms.

> There are at least 3 reference counting classes (RefCount<>,
> ASTRefCount<>, and ASTRef). Is there any particular reason for this, or
> is it just historical? 

Part historical, part necessity to accomodate the codegenerator. The
AST stuff requires some extra functionality over the standard
refcounter supplied. (for conversions/casting)

Before 2.7.5 I worked on replacing the lot with a single
implementation but due to lack of time I was not able to make the
codegenerator compatible with the new refcounter.

>Is there also any reason not to replace the whole
> lot with the Boost/TRI smart pointer classes? This would clean up the
> code a lot.

I don't want boost dependency for the support lib. When the boost
stuff gets integrated into the standard (I think there were some plans
for it or parts thereof) and if enough compilers support it then it
may be an option. Although if i'm not mistaken the boost smart
pointers will require extensive modifcation to the codegenerator to
make it work for all currently supported things (heterogeneous AST's).
My guess is that antlr 2 will not see that modification.

Antlr 3 will have a support library made from scratch C++ style.

Cheers,

Ric


More information about the antlr-interest mailing list