Go to the previous, next section.

## Name Table

A name table (class `name_table`) is a list of name table entries. The first element of the name table always represents the constant value, and thus there is no name associated with it.

The following are functions and operations available for `name_table`. In this list of functions, the symbols `nt`, `nt1` and `nt2` are of the class `name_table`, the symbol `nte` is a `name_table_entry`, `i` and `j` are integers and `im1`, `im2` ... `im16` are `immed`s.

`name_table nt();`
`nt.init();`
Initializes an empty name table.

`name_table nt(nt1);`
`nt.init(nt1);`
Create a duplicate copy of `nt1`.

`name_table nt(im1);`
`name_table nt(im1, im2);`
`....`
`name_table nt(im1, im2, ..., im16);`
Create a name table where 1 to n entries are the names given in `im`1 to `im`n.

`name_table nt(i);`
`nt.init(i);`
Create a name table with i entries.

`i = nt.n();`
i is the number of entries of the name table ` i > 0 `.

`nte = nt[i];`
Return the ith entry of the name table, given that ``` 0 < i < nt.n() ```.

`i = nt.find(nte);`
`i = nt.find(im1);`
Find the position of the name nte (or `im1`) in the name table. If the name is not in the name table i `find()` will return -1.

`nt.remove(i);`
`nt.remove(i, j);`
Remove the ith entry (or entries i through j) from the name table.

`nt.insert(nte, i);`
`nt.insert(im1, i);`
Insert the name nte (or im1) at the ith postion of the name table.

`nt = nt1 & nt2;`
`nt = name_table::mk_align(nt1, nt2);`
Align the two name tables to produce a single name table. nt has an entry for all the variables in nt1 and nt2. For identical names in nt1 and nt2, there will be only a single entry in nt.

`boolean b = name_table::is_aligned(nt1, nt2);`
Returns TRUE if nt1 and nt2 are already aligned.

`FILE * fp;`
`nt.print(fp);`
Print the name table.

Go to the previous, next section.