Question: Symbol table: Consider the following program is lexically-scoped language such as C. int x, y; int f (int p) { int y, z; { int
Symbol table: Consider the following program is lexically-scoped language such as C.
int x, y;
int f (int p) {
int y, z;
{
int i, j;
/* point A*/
}
/* point B*/
/* point C*/
How can the compiler organize symbol table information at compile time to handle nested scoping? Draw the logical state of the symbol tables(s).
Answer: The compiler can use nested symbol tables, one table per scope. Symbol table contain a pointer to the table of their enclosing scope.
What symbols are visible at points A, B, C?
Answer:
A: x, f, p, y, z, i, j
B: x, f, p, y, z
C: x, y, f
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
