This preview shows pages 1–3. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: print x main() set x(0) first() print x second() print x end What does this program print if the language uses static scoping? What does it print with dynamic scoping? Why? 4. Problem 4 (20 Points) Why don't we use PP[<program C>] = CC[C] o (lambda(m,i,o).o) instead of the definition of PP[<program C>] on PPT 26, slide 23 ? Explain. 5. Problem 5 (40 Points) Modify the attribute grammar for Tiny, so that "read" is no longer an intrinsic function, but instead a statement. Instead of assign i := read; we would have read(i); The read statement would handle exactly ONE identifier. 6. Problem 6 (40 Points) Add a 'swap' statement to Tiny. It would look like this: swap i :=: j; Assume a parser ensures i and j are names, not expressions. Also, assume they are type compatible. 7. Problem 7 (30 Points) Build the functional graph for the binary number 101.11, according to the attribute grammar for binary numbers developed in class....
View Full Document
- Fall '08