Question: Deep and Shallow Binding Consider the following pseudocode, assuming dynamic scoping rules: 1 procedure main ( ) 2 x : int : = 3 3

Deep and Shallow Binding
Consider the following pseudocode, assuming dynamic scoping rules:
1 procedure main ()
2 x : int :=3
3 y : int :=5
4
5 procedure mult ()
6 x := x * y
7 print ( x )
8
9 procedure three ( f : procedure )
10 x : int :=7
11 f ()
12
13 procedure two ()
14 y : int :=9
15 one ( three , mult )
16
17 procedure one ( f1 : procedure , f2 : procedure )
18 x : int :=1
19 f1( f2)
20
21// main body
22 two ()
23 print ( x )
1. If the language uses deep binding, what will the output be? Explain your answer.
2. If the language uses shallow binding, what will the output be? Explain your answer.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!