Question: Consider the following program in a block-structured language. The simplest symbol-table organization in such a situation is the stack symbol table described in class. program
Consider the following program in a block-structured language.
The simplest symbol-table organization in such a situation is the
stack symbol table described in class.
program tst;
var
x, y, z: integer;
procedure P( x, y, z: integer);
var
a, b: integer;
begin (* P *)
...
end; (* P *)
procedure Q( n: integer);
procedure R( m, n: integer);
var
x, y: integer;
z: boolean;
begin (* R *)
...
end; (* *)
begin (* Q *)
...
P( 2*n, 5+n, n div 2)
...
end; (* Q *)
begin (* tst *)
...
Q( x + y*z);
...
end.
Assume that 'read', 'write', and 'abs', are the only predefined names.
a) Show the contents of the symbol table and the scope table (display)
prior to completing the compilation of procedure P.
b) Show the contents of the symbol table and display prior to
completing the compilation of procedure R.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
