[antlr-interest] Re: symbol table in C++

lgcraymer lgc at mail1.jpl.nasa.gov
Thu May 29 22:40:22 PDT 2003


The trick is that Java uses references--each of the cross-referenced 
items is actually a pointer, but the compiler hides this--and all 
pointers are of fixed size which makes memory allocation easy.  To 
do the same thing in C++, you will have to make the references 
explicit--"HashTable& foo" for example instead of "Hashtable foo".  
You may also need to declare a forward reference to the class--that 
should just be a line of the form
class Hashtable;

--Loring

--- In antlr-interest at yahoogroups.com, "Fan Yang" <yhhf_dy at y...> 
wrote:
> Hi,
> 
> I want to reimplement the symbol table by using C++ and STL, which 
is 
> described on 
> 
http://developer.java.sun.com/developer/technicalArticles/Parser/Seri
e
> sPt4.
> 
> I'm stuck at compiling this implementation. The problem seems 
forward 
> reference or compile order. For example JavaHashtable, Definition 
and 
> SymbolTable, they use each other in the declarations of their 
class 
> members. it compiles correctly in java. but c++ is not the case.
> 
> Is there a way to compile it without major modification of the 
> design. Or how to modify the symbol table design in order to 
comform 
> with c++ compier?
> 
> thank you at advance.


 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 




More information about the antlr-interest mailing list