

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


COP4020 Spring 2008 Homework-3 Solutions
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
Answer: (a)
(b)
(c)
(d)
(e)
(f)
(g)
(h) No AST is possible.