Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to make a symbol table?

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I need help. How do you start on making a symbol table?? What should i do? I need that table and how to use that table?? thankz
 
Depends what you want your symbol table to store. Lets say it is a string and a class of base type Symbol. This would look like

#include <map>
#include <string>
using namespace std;

class Symbol;
map<string,Symbol*> lookup;

You may have to add #pragma ... if you don't want the warnings about the symbols being over 255 characters.

Anyway, to add something to the table

lookup[something] = new SymbolChild ();

To get the symbol

Symbol* sym = lookup[something];

It will return 0 if the symbol has not been added.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top