Homework 2
Due: start of class on Thursday, February 26th
- p.99 of PLP, Exercise 2.13, part (c).
To clarify the grammar, you can replace the right-hand-side of
rule 2 with cdr | a | b | c. If the left-hand-side of a rule
is absent, it means that the left-hand-side is the same as the left-hand-side
of the rule above it. If the right-hand-side is empty, it means that
the left-hand-side matches with the empty string (we have also represented
the empty string with an epsilon).
ALSO ANSWER THESE QUESTIONS: Is this grammar amenable to
LR parsing? Why or why not?
- p.152 of PLP, Exercise 3.4. The three examples have to show 3
fundamentally different ways for a live variable to be out of scope.
Don't write down one example and then search/replace the variable names
to come up with the other two.
- Take a look at the paper Array Bounds Check
Elimination for the Java Hotspot Compiler by Thomas Wuerthinger,
Christian Wimmmer, and Hanspeter Moessenboeck.
Answer the following questions (hint: read Section 2 of the paper).
- What is the difference between the Hotspot Server JIT compiler
and the Hotspot Client JIT compiler? Why do you need two versions?
- The Hotspot client compiler takes Java bytecode as input. That
means that there is already a previous ("javac") phase that
converted Java source into bytecode. How many intermediate forms
does the bytecode go through on its way to becoming machine code?
What are the names of these intermediate forms?
- Why is it helpful to have all these intermediate forms instead
of going straight from Java source code to machine code?