[antlr-interest] C++ run-time and ref-counters (was TokenStreamRewriteEngine and C++)

Ric Klaren klaren at cs.utwente.nl
Wed Apr 21 04:24:30 PDT 2004


Hi,

On Tue, Apr 20, 2004 at 01:09:59PM -0700, Mark Lentczner wrote:
> 1) Please don't use Boost, or any other library. I have no beef with
> Boost, but we incorporate Antlr into our project, and and if we have to
> start including Antlr's dependent projects as well, it will get way to
> hairy. We'd never have used Antlr if it didn't stand on its own.

I want antlr to be as lightweight as possible. E.g. no boost installation
required if I'd grab boost then I'd only scrounge a few files and fit them
into the antlr build (if their license permits so) boost is a plain
nuisance to build (probably just me ;) )

For unicode support I'm already unhappy enough about probably having to
become dependent on the IBM icu library. (I hope templates can safe us from
having to install this thing even for simple ASCII parsers)

> 2)
>  > I'm not 100% sure but I think there's no smartpointer in C++ possible
>  > that's smart enough to behave like the pointer I'd like for
> heterogenous
>  > AST's.
> Bet there is!  If you are having trouble taming yours, let me know and
> I'd be happy to lend a hand.
> 3) I have ref counting pointer framework that you are welcome to take
> from and/or use. It has all the polymorphic properties one wants:
> ref_ptrT can be safely assigned to a ref_ptrS iff a T* can be assigned
> to S*, (basically S is T or an accessible base class of T). It does
> assume a common base class Countable of the things being counted -
> which shouldn't be a problem in Antlr since AST trees are never
> manipulated except through ref counted pointers. If it is, it would be
> an easy rewrite so that the ref counted thing doesn't contain the
> count. (I'm offering to do it, too.)

Stupid thing is that I did not make enough notes when toying with these
reference counter problems so I don't have a clear listing of the actual
cases that give problems. I only recall that it's around conversions up and
down AST-type hierarchies (so when using heterogenous AST's) I basically
have to spend some serious antlr time on looking at it again and trying a
few approaches (using custom allocator+garbage collection/change the
reference counter) The archive might turn some up in discussions with
Michael Tiller if I recall right.

Also my understanding of 'smart' pointers improved a lot since the last I
looked at it so there's hope ;)

A disadvantage of your reference counter is btw that we have to drop
support for some compilers due to the use of the member template (but I
guess that's not that big a deal except if VC6 has trouble with it, then
again those conversions can be implemented manually if the hierarchy isn't
too big)

Another thing that makes me hate the smartpointers is that current gdb's
still segfault like hell around their use :((((

Although I got a nice hunch from looking at your code :)

When 2.7.4 is out of the door I want to cut another development branch and
toy around with some approaches. For one I want to try out a plain pointer
with custom allocator/garbage collector strategy (how long have I been
saying that *doh*).

I'll remember your email adress for when I start looking at this again :)

Cheers,

Ric
--
-----+++++*****************************************************+++++++++-------
    ---- Ric Klaren ----- j.klaren at utwente.nl ----- +31 53 4893722  ----
-----+++++*****************************************************+++++++++-------
     Innovation makes enemies of all those who prospered under the old
   regime, and only lukewarm support is forthcoming from those who would
               prosper under the new. --- Niccolò Machiavelli



 
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