EECS 395 Programming Languages: Homework 1

Due: Friday, January 8th, 2010, 5pm

Important: Your code may be shown to the entire class (along with programs from several others) during Monday's lecture.

Part 1 – Set up PLAI support in DrScheme

Be sure you have version 4.2.3 of PLT installed. This is the latest version from the web page. Open DrScheme, set the language to “Module”, put the following program into the upper window, and click “Run”

#lang scheme
(require (planet plai/plai:1:6))
This will take a little while as DrScheme downloads and installs PLAI support (there should be no error messages). You can watch the progress by clicking the Show Log button at the bottom of the window.

Part 2 – Create Handin Account

Install nwu-eecs-pl.plt by using DrScheme's “File|Install .plt file...” menu item. In the dialog box, make sure the “Web” option at the top is selected and paste this url into the box:
Wait for the line setup-plt: done.

After restarting DrScheme, select the Manage EECS 395 PL Handin Account... menu item from DrScheme's File menu. Change to the New User panel, and pick a username and password. (Use your real name and real NetID, so that we can connect your homework submissions with you.)

You will have to install nwu-eecs-pl.plt for DrScheme on each different filesystem that you want to have Handin button. However, after creating a handin account once from any machine, you can use DrScheme's Handin button on any other machine.

Part 3 – String-Processing Language

Using a programming language of your choice, implement an interepreter for a little language of string operations. Your interpreted language must include

Also, it must allow arbitrary expressions for the arguments of operations, so that multiple operations can be applied in an expression.

Pick your own syntax and input method; document them in comments and with test cases. Chose a syntax that minimizes parsing effort for your interpreter.

For example, using a fully-parenthesized infix notation where & is the concatenation operator and @ is the rest-after operator, for the program

  (("hello" & " ") & "world")

the interpreter should produce

  "hello world"

and for the program

  (("hello" @ "l") & ("a world" @ "a"))

the interpreter should produce

  "lo world"

and for the program

  (("a lot" @ ("hello" @ "l")) & "!")

the interpreter should produce


and for the program

  ("filename.scm" @ ".")

the interpreter should produce


Submit your interpreter as a single file using the Handin button in DrScheme (even if you use a programming language other than Scheme). The Handin button submits whatever file you have opened in DrScheme. Of course, when you click Handin, provide the username and password that you chose for part 1.

After submitting, you can confirm your submission via the handin button, or via the web-based status server:

Submitting a plain-text file turns it into a DrScheme-format file, so use DrScheme to read any file that you download from the status server.

Last update: Friday, January 8th, 2010