|
|
The C language defines a block as a compound statement that begins and ends with braces, ``{'' and ``}''. An inner block is a block that occurs within a function (which is also a block).
For each inner block that has local symbols defined, a special symbol .bb is put in the symbol table immediately before the first local symbol of that block. Also a special symbol .eb is put in the symbol table immediately after the last local symbol of that block. The sequence is shown in ``Special symbols (.bb and .eb)''.
Special symbols (.bb and .eb)
| .bb |
| local symbols |
| for that block |
| .eb |
Because inner blocks can be nested by several levels, the .bb-.eb pairs and associated symbols may also be nested as shown below:
{ /* block 1 */
int i;
char c;
...
{ /* block 2 */
long a;
...
{ /* block 3 */
int x;
....
} /* block 3 */
} /* block 2 */
{ /* block 4 */
long i;
...
} /* block 4 */
} /* block 1 */
The symbol table would look like ``Example of the symbol table''
Example of the symbol table
| .bb for block 1 |
| i |
| c |
| .bb for block 2 |
| a |
| .bb for block 3 |
| x |
| .eb for block 3 |
| .eb for block 2 |
| .bb for block 4 |
| i |
| .eb for block 4 |
| .eb for block 1 |