CS 250 - Programming Languages
Spring 2004
Assignment 3 -- Due 5:00pm February 27.
Read appropriate sections of chapters 3 and 4, and answer the
following questions. You may turn them in either in hardcopy or by
e-mail to allen@bowdoin.edu
- Answer questions 3.13 (but using Java instead of C/C++), 3.14,
3.15, 3.17, and 3.18 on pages 80-81 of your text.
- Answer questions 4.1-4.4, 4.6, and 4.9 on pages 116-117 of your
text.
- Question 4.12 has already been answered, since all the type
checking functions V and semantic functions M are fully developed in
Chapter
4 and Appendix B. Exercise this complete Jay interpreter by
running
it to examine the validity of various "almost-Jay" programs. The
following
files are available for this task:
To test this interpreter, copy these files to your cs250
directory, and then run the driver program with the command:
java interpreter
program.jay
Confirm that the program is correct by comparing its output
with
the file
interpreter.output , which shows the complete abstract syntax tree,
type checking results, and final state that should appear.
Finally, run this interpreter using each of the files program0.jay
-
program9.jay as input. For each error, write down the kind of
error (syntax, type error, or run-time error) that occurred and the
source
statement in the Jay program that caused the error.
- Answer question 4.13 in your text, but do not need to implement
your
answer. That is, just write your answers to parts a-d on paper.
This
question may be completed either individually or by working in teams of
two
- discussions about the addition of floating point variables and
arithmetic
to Jay can be valuable, since there are significant design choices
involved.
If you work as a team, just turn in one copy of your answers with
both
names on it.