0

```
program p;
var a,b:integer;
c:real;
forward p2; {for procedure p1 to call procedure p2}
procedure p1 (x:integer; var y:integer);
var c:integer;
pt:^integer; {pointer declaration}
begin { (1) }
writeln(a,b,x,y);
new (pt);
if (x<2) and (y<2) then
if x>y then begin
y:=x; writeln(a,b,x,y); p2(x,b)
end;
dispose(pt);
end;
procedure p2 (x:integer; var y:integer);
begin { (2) }
writeln(a,b,x,y);
c:=a;
if (a<2) and (b<2) then
if x=y then begin
x:=y+1; writeln(a,b,x,y); p1(a,y)
end;
end;
begin { (3) }
a:=1; b:=0; c:=0.0;
p1(a,b);
writeln(a,b);
end;
```

1) Find the output of the above PASCAL program using a) static b) dynamic scoping rules.

2) Show the lifetimes of the variables and parameters for the above program.

3) Write the environments of the above program using static and dynamic scoping rules at points (1), (2), and (3).

its my homework but i only use java language.if anyone know these problems. please help me

*Edited
by Reverend Jim*: Fixed formatting