Homework 6: Interpreting Elementary Expressions

Due: 2020-10-29 at 23:59

In this homework, you will build an interpreter for several increasingly powerful versions of Scheme, starting with a “language” that just recognizes numbers, and moving through variables, arithmetic and primitive procedures, conditional expressions, and finally let-expressions.

For each version of the language we will create a grammar, a parser, and an evaluator. Because we implement the languages one small step at a time, you should never find yourself overwhelmed with details. Check your work carefully as you go. Writing all of the code and then debugging is a receipe for disaster.

Your implementations will be in several files. The start of each file should be

#lang racket
; Your name(s) here.

Preliminaries

Click on the assignment link. If you’re working with a partner, one partner should create a new team. The second partner should click the link and choose the appropriate team. (Please don’t choose the wrong team, there’s a maximum of two people and if you join the wrong one, you’ll prevent the correct person from joining.)

Once you have accepted the assignment and created/joined a team, you can clone the repository on your computer by following the instruction and begin working. But before you do, read the entire assignment and be sure to check out the expected coding style from the first homework.

Be sure to ask any questions on Piazza.

Submission

To submit your homework, you must commit and push to GitHub before the deadline.

Your repository should contain the following files

It may also a .gitignore file which tells Git to ignore files matching patterns in your working directory.

Any additional files you have added to your repository should be removed from the main branch. (You’re free to make other branches, if you desire, but make sure main contains the version of the code you want graded.)

Make sure you put your name (and your partner’s name if you’re working with one) as a comment at the top of each file.

Your task to to implement Part 4: MiniScheme A through Part 8: MiniScheme E of the MiniScheme project.

Each part builds a new version of MiniScheme, adding functionality step by step. Each part requires testing. You’ll definitely want to add testing for each part as you’re working on it.

Start by copying your env.rkt and env-test.rkt from homework 5 into your repository.

Remove the line (run-tests env-tests) from env-test.rkt. All of the tests will be run by the provided tests.rkt. You will replace the individual tests in env-tests.rkt (which you have already written), parse-tests.rkt, and interp-tests.rkt.

Create files parse.rkt and interp.rkt. Make sure they include the #lang line and your name.

You’ll need to add these to the repository.

$ git add env.rkt env-tests.rkt parse.rkt interp.rkt
$ git commit
$ git push

Start with MiniScheme A and work your way through in order.

  1. MiniScheme A (20 points).
  2. MiniScheme B (20 points).
  3. MiniScheme C (20 points).
  4. MiniScheme D (20 points).
  5. MiniScheme E (20 points).