EECS 321 Programming Languages: Homework 1

Due: Friday, January 14th, 2011, 5pm

Part 1 – Set up DrRacket

Be sure you have version 5.0.2 of Racket installed. This is the latest version from the web page. Open Racket, set the language to “Use the language declared in the source” (via the Language|Choose Language menu item), put the following program into the upper window, and click “Run”

#lang plai
(expt 2 100)
You should see the prompt in the interactions window (a >) and the number 1267650600228229401496703205376.

Part 2 – Create Handin Account

Install nwu-eecs-pl.plt by using DrRacket’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:

http://www.eecs.northwestern.edu/~robby/courses/321-2011-winter/nwu-eecs321.plt
 
Wait for the line setup-plt: done.

After restarting DrRacket, select the Manage EECS 321 PL Handin Account... menu item from DrRacket'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. DON'T use your real password.)

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

Part 3 – Sign up for the mailing list

Sign up for the mailing list; follow this link and the instructions you find there. Warning: the subscription confirmation may end up in your spam folder.

Part 4 – 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

  "t!"

and for the program

  ("filename.scm" @ ".")

the interpreter should produce

  "scm"

Submit your interpreter as a single file using the Handin button in DrRacket (even if you use a programming language other than Racket). The Handin button submits whatever file you have opened in DrRacket. 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:

https://penghu.eecs.northwestern.edu:8082/

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


Last update: Friday, January 7th, 2011
robby@eecs.northwestern.edu