Mini-Project 1: You First Interpreter

For mini-project 1, you'll be building an interpreter for a small untyped subset of OCaml. This will mean building a parser and an evaluator. There will be no type checker for this project.

This mini-project is due on Thursday 11/6 8:00PM Friday 11/7 8:00PM. It cannot be dropped. This is the "landing page" for the project, it does not contain any information about the project specification. The details of the project are given in the file assigns/interp1/spec.pdf.

One-Week Check-in

To verify you're making progressing the mini-projects, you will be required to submit part of the mini-project, along with some written problems, by Thursday 10/30 8:00PM Monday 11/3 8:00PM.

This time around, you must submit:

Note. We will not re-test parts of the mini-project from the one-week check-in. To recieve full credit on the mini-project, you must successfully submit both the one-week check-in and the complete mini-project.

Written Problems

Both of the problems below will consider the following grammar.

<expr>  ::= let <var> = <expr> in <expr>
          | <expr> + <expr1>
          | <expr1>
<expr1> ::= <num> | <var> | ( <expr> )
<num>   ::= 1 | 2 | 3
<var>   ::= x | y | z

Parse Tree

Draw a parse tree in the above grammar for the following sentence.

1 + (let x = let y = 2 in y in x)

Ambiguity

Demonstrate that the above grammar is ambiguous. That is, give a sentence that has multiple parse trees in the above grammar. Also draw both parse trees.