



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!




Spring 2007 (Thursday, March 1) Name:
CS 3360 โ Design and Implementation of Programming Languages
This test has 10 questions and pages numbered 1 through 7.
This test is closed-notes and closed-book. However, you are allowed to bring 1 page (8.5 X 11) of notes (both sides). Your notes must be your own, they must be hand written, and they must be turned in with your test. You can also bring the AspectJ Quick Reference that summarizes AspectJ syntax. This test is to be done individually, and you are not to exchange or share materials with other students during the test. If you need more space, use the back of a page. Note when you do that on the front. This test is timed. Your test will not be graded if you try to take more than the time allowed. Therefore, before you begin, please take a moment to look over the entire test so that you can budget your time. Clarity is important; if your writing or code is sloppy or hard to read, you will lose points. Correct syntax also makes some difference. There are 110 points all, including 10 points of extra credit.
(a) (5 points) List five different binding times and give an example of each.
(b) (2 points) When a programming language is called strongly typed?
(c) (8 points) Discuss the relative advantages and disadvantages of static storage binding and stack- dynamic storage binding, and also evaluate them regarding support for recursive calls and history- sensitive variables.
(a) (10 points) Define an attribute grammar that also gives the corresponding decimal numbers. That is, introduce an integer-valued attribute, say value, for the start symbol
(b) (2 points) For each attribute that you introduced for (a), indicate whether it is a synthesized or inherited attribute.
(c) (3 points) Extend your attribute grammar to permit only binary numbers that are multiples of 5.
class ScopingRule { static int x = 200; static void print(int y) { System.out.println(x + y); } public static void main(String[] args) { int x = 100; print(x); } }
If a constructor invocation doesnโt satisfy the above constraints, the invocation should throw an IllegalArgumentException. You may assume that the class Method defines the following two meth- ods:
/** Returns true if this is a static method. */ public boolean isStatic();
/** Returns the formal parameter types, in declaration order, of this method.