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

Mark Lentczner markl at glyphic.com
Tue Apr 20 13:09:59 PDT 2004


Some thoughts on the C++ library

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.

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.)

If you want to look at the code (all 100 lines of it):
	http://cvs.sourceforge.net/viewcvs.py/wheat/r1/wheat/countable.hpp? 
view=markup
	http://cvs.sourceforge.net/viewcvs.py/wheat/r1/wheat/countable.cpp? 
view=markup

Also there is a unit test for it at:
	http://cvs.sourceforge.net/viewcvs.py/wheat/r1/wheat/countable- 
test.cpp?view=markup

- Mark

Mark Lentczner
markl at wheatfarm.org
http://www.wheatfarm.org/



 
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