Scope of Identifiers
•
Problem:
Symbol t
able
Program P1;
var
x
,
y
: integer;
Procedure Proc1;
var
x
,
y
:
integer;
begin
…
x := 1;
…
end;
begin
…
x := 2;
…
end.
?
?
y
…
5
:
x
…
4
:
Proc1
…
3
:
y
…
2
:
x
…
1:
•
Solution:
Scope Rules
(Stack structure of ST)
2
5/35