Skip to content

Assignment 4: Loops: the Loop language

Overview

In this assignment, you will be extending the "Cond" language compiler from the last assignment to create the "Loop" language. This language will add the following features:

  • loops (while statements)
  • mutable variables (set! statements)
  • sequence expressions (begin statements)
  • the Void type and the (void) expression

Textbook coverage

This assignment is based on chapter 5 of Essentials of Compilation.

Due date

This assignment is due on Friday, November 15th at 6 PM.

Starting code base

The starting code base is the zipfile ch5.zip, which is posted on the course Canvas site. You should unzip this file in your Github repo, inside the src/ directory. It contains partial implementations of all the code for the assignment.

Inside the ch5 directory will be the usual subdirectories:

  • The tests/ subdirectory contains the test programs for the compiler.

  • The reference/ subdirectory contains the output from the instructor's version of the compiler.

  • The scripts/ subdirectory contains scripts for testing your code.

README or README.md file

Create a README or README.md file in your ch5 directory, and in it, identify which person wrote which passes. (If both partners worked on a pass, indicate that too.) Also, if you used any late days on the assignment, indicate how many late days you used.

New language features

The new language features are described in the textbook and the lectures, but in brief, they are:

  • a Void type
  • new expressions:
    • while (looping construct)
    • begin (sequencing expression)
    • set! (mutating (re-assigning) variables to new values)
  • a print function has been added