Exercise 1
Using the RPAL string-to-tree-transduction grammar, construct the abstract syntax tree (if possible) for each of the following programs:

--------------
(a) x or y -> x | z -> x | y
(b) a < b -> c -> a | b | a
(c) x aug y, z, 3
(d) x, y, z aug 3
(e) let f (x) = x + 2 * 1 in f (z) where z = 6
(f) let x = z and y = 2 * z where z = 3 in x ** y ** y
(g) let a = c in a * b ** c where ( z = 3 and y = 2 * z )
(h) let a = c in a * b ** c where z = 3 and y = 2 * z

Exercise 2
Write RPAL Programs:

--------------
Write, test, and debug an RPAL program that computes the “tuple reverse” function, i.e. Rev (3, ‘hello’, (2, 3), (fn x.x+1), true) = (true, (fn x.x+1), (2, 3), ‘hello’, 3).

Exercise 3
Scoping Rules:
(Scott Exercise 3.4 P 152)
--------------
Give three concrete examples drawn from programming languages with which you are familiar in which a variable is live but not in scope.

Link to the Word Format