Machine Problem 4: Modifying an Interpreter
Out: Friday, 8 February 2008
Due: 5 PM Friday, 15 February 2008
Submission: Partners
This assignment is to be done in pairs. If you cannot find
a partner, please contact your instructor.
Purpose
The main goal of this assignment is to give you some
experience with interpreters for the languages we use
to illustrate basic concepts of programming languages.
Tasks
- [15pts]
Extend the provided
interpreter for the LET language
by making all changes necessary to implement and
to test the extensions described by
EoPL exercises 3.8, 3.9, and 3.16.
Don't forget to change the comments that will need changing,
and don't forget to add tests for every new feature of the language.
- [2pts]
Is it possible to write a program in the LET language
(as extended by task 1) that gets into an infinite loop
and runs forever?
Write a short justification of your answer.
- [6pts]
EoPL exercises 3.20 and 3.23.
You might want to test your solutions to these
exercises using an
interpreter for the PROC language,
not the LET language.
- [2pts]
Is it possible to write a program in the PROC language
PROC language,
that gets into an infinite loop and runs forever?
Write a short justification of your answer.
- [4pts]
Modify the provided
interpreter for the PROC language
to use dynamic scoping (as defined in EoPL exercise 3.28) instead
of lexical scoping.
Note that this is easier than EoPL exercise 3.28 because
we aren't asking you to do it twice.
(Hint: The
procedure
operation will ignore its third
argument, and the apply-procedure
operation will need
to take a third argument.)
Don't forget to change the comments and tests that will
need changing.
- [1pt]
EoPL exercise 3.29.
(Hint: You don't have to do any programming for this task,
and you can add an argument
b
to p
without changing the nature of the question.)
- [5pts]
Submit a photograph of yourself (preferably in the form of
a jpeg or similar file), suitable for public display in
the course photo gallery. Alternatively, submit a request
to be excused from this requirement (in the form of a plain
text file named
request.txt
).
Infrastructure
You are given the following interpreters:
The easiest way to copy these interpreters into one of your own
directories is to use the cp
command on a CCIS Solaris
machine:
cp -r /course/csg111/.www/interps/let-lang .
cp -r /course/csg111/.www/interps/proc-lang .
Deliverables
-
A complete interpreter for the LET language with
all of the extensions you implement for task 1.
You should submit all of the files needed to run
your extended interpreter, even if some of those
files are exactly the same as the files provided
by the instructors.
-
A text file
mp4.txt
that contains
your answers for tasks 2, 3, 4, and 6.
-
A complete interpreter for the PROC language with
the dynamic scoping you implement for task 5.
You should submit all of the files needed to run
your modified interpreter, even if some of those
files are exactly the same as the files provided
by the instructors.
-
A Development Diary
-
A digital picture of yourself for display in the
course photo gallery, or a request to be excused
from this requirement.
Back to Machine Problems
William D Clinger
Last modified: 8 February 2008