CS 341 - Survey of Programming Languages
Homework #6

Due: Tuesday 10/3 at the beginning of class #11

Note: This work is to be done in pairs.  Each pair will submit one assignment.  Although you may divide the work, both team members should be able to present/describe their partner's work upon request. 

To submit this homework, change into the directory containing all necessary files: MiniScheme1.jj and supporting abstract syntax tree .java files, and enter the command "submit341 ms1".

MiniScheme Project Phase 1

In this phase of the project, you will implement an interpreter for a very small initial subset of the MiniScheme language (which is in turn a subset of Scheme).  This phase will implement simple I/O and simple integer expressions.

It is recommended that you begin with simple classes to represent an abstract syntax tree (AST) node, environment, and value-environment pair, such as these.  You will add your own AST nodes for the more specific classes corresponding to grammar elements below.  Your code should first parse the grammar into an AST, and then evaluate that AST (which in the future could mean that a node is visited for evaluation many times).


Common Errors


Grammar notes:

<program> --> { <expression> }*

<expression> --> <literal>
| <defined expression>

<literal> --> <integer>
<integer> --> { + | - }? { <digit> }+
<digit> --> [0-9]

<defined expression> --> ( read )
| ( write <expression> )
| ( newline )
| ( + <expression> <expression> )
| ( - <expression> <expression> )
| ( * <expression> <expression> )
| ( quotient <expression> <expression> )