CSC 272
Homework 1
Assigned Jan 25, due Feb 1

Reading & Discussion

Please read Dr. Krishnamurthi's rationale for his PLAI book, and keep this in mind while reading the book.

Sebesta chapter 1 presents a number of criteria for a “good programming language”. Keep these in mind while reading the following Paul Graham essays:

Programming

This assignment is to be done in Racket. 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.

Racket/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

Re-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 Jan 27. 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 Jan 27'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 ifpos operator, a kind of expression with three sub-expressions: if the first one evaluates to a positive number, 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: Tue Jan 24 13:02:18 EST 2012
Stephen Bloch / sbloch@adelphi.edu