CS 5510 Homework 2

Due: Friday, September 11th, 2009 9:40am

Part 1 – Free Identifiers

Implement the function free-ids, which take a WAE (see PLAI §3 or the lecture slides) and produces a list of symbols. The list should contain a symbol for each free identifier in the given WAE, each symbol should appear at most once in the list, and the symbols should be ordered according to the following comparison procedure:

  (define (symbol<? a b)
    (string<? (symbol->string a) (symbol->string b)))

Hint 1: First, write a function that generates an unordered list of symbols with duplicates, and then write separate functions to re-order the list and then remove duplicates.

Hint 2: The free variables of a with form include all of the free variable of the named expression, plus all of the free variables in the body expression except for the name bound by with.

Hint 3: The PLAI language includes several helpful list-processing functions:

Part 2 – Binding Identifiers

Implement the function binding-ids, which is like free-ids, but the result list contains a symbol for each binding identifier in the given WAE (whether or not the binding identifier is ever referenced by a bound identifier). The result list of symbols must be sorted and have no duplicates.

Part 3 – Bound Identifiers

Implement the function bound-ids, which is like free-ids, but the result list contains a symbol for each bound identifier in the given WAE. The result list of symbols must be sorted and have no duplicates.

 

Submit your code using the Handin button in DrScheme. The submission process will look for suitable tests in your code using test, and it will provide immediate feedback by running your program on a private test suite that is built into the handin server. (Your code will be accepted even if it does not pass the server's tests.)

After submitting, you can confirm your submission through the web-based status server:

https://rains.cs.utah.edu:7980/servlets/status.ss


Last update: Thursday, December 3rd, 2009
mflatt@cs.utah.edu