CSC 272
Homework 1
Assigned Feb 1, due Feb 12

This assignment is to be done in PLT Scheme. You are encouraged to do this in teams of two, both students working together on all parts of the assignment; if you do this, turn in one homework with both names on it.

For all functions, follow the design recipe: each function must have a contract, a good collection of test cases, and a function definition.

Scheme refresher

Work through as many of the tutorial exercises as you think you need from Dr. Krishnamurthi's CSC 173 Assignments page. If you get stuck, see the solutions he's posted. Do not turn these in.

A Rudimentary Interpreter

Read the assignment for last semester's Project 1, and be prepared for a code-walk through some of your classmates' solutions to it on Feb. 1. If you were in 270 last semester, re-read the comments I made on your assignment. If you weren't, try writing a little of it before Feb 1's class so you understand the issues.

Adding Conditionals to the Interpreter

Starting with either your own Project 1, or the one we worked through in class, extend the parser and interpreter to handle the if0 operator, a kind of expression with three sub-expressions: if the first one evaluates to 0, it evaluates and returns the second, and otherwise evaluates and returns the third.

Adding Functions to the Interpreter

Extend the parser and interpreter to handle calling user-defined functions, as in Chapter 4 of the PLAI textbook. Note that the interpreter will now take in two parameters rather than one: the additional parameter is a list of function definitions. Note: A lot of the work is done for you in Chapter 4. I just want to make sure you understand what's going on by applying these modifications to your own interpreter (from last semester's Project 1).

Questions in the Textbook

Answer questions 4.1.1 and 4.1.2 on paper or by e-mail. If you've got good test cases for both parts of this assignment, you've basically done question 4.3.1. Just to make sure, write and test a factorial function in your language.


Last modified: Thu Jan 28 14:42:46 EST 2010
Stephen Bloch / sbloch@adelphi.edu