[go: up one dir, main page]

Menu

[r199]: / libpetey / symbol_table.h  Maximize  Restore  History

Download this file

34 lines (23 with data), 691 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
template <class sym_t>
class symbol_table {
protected:
long n; //number of entries
long nunq; //number of unique symbols
long array_size; //size of arrays
sym_t *sym; //the symbols
var_t *var; //the variables
long *sind; //indexes the variables in terms of the symbols
int update_flag;
void update();
public:
symbol_table();
~symbol_table();
long * collect_garbage(long &ndup);
//adds a new symbol to the table
long add(sym_t name);
//returns a unique, pervasive (until the death of the object) ID:
long lookup(sym_t name);
//looks up symbol based on ID:
sym_t get(long id);
long entries();
};