Here, we have shown the two methods of implementing the symbol table which we discussed in the previous slide in detail.
As, we can see, the first one which is based on allotting fixed amount space for each lexeme tends to waste a lot of space by using a fixed amount of space for each lexeme even though that lexeme might not require the whole of 32 bytes of fixed space.
The second representation which stores pointers to a separate array, which stores lexemes terminated by an EOS, is a better space saving implementation. Although each lexeme now has an additional overhead of five bytes (four bytes for the pointer and one byte for the EOS). Even then we are saving about 70% of the space which we were wasting in the earlier implementation.
We allocate extra space for 'Other Attributes' which are filled in the later phases.
|