CS 2135 (A01) Homework 6: Finishing the Web Program Transformation

Due: October 11 (Thursday) at 11:59pm via turnin (assignment name hwk6).

Assignment Goals


The Assignment

You are not expected to implement any of the programs that this assignment asks you to describe. Do the required transformations manually.

CPS provides the first step in converting regular programs into web scripts. Last week's lab discussed the next step, which involves giving all of the nested lambdas names so that we can call scripts by name (as needed when you put a script name in the info for a SUBMIT item in HTML). This homework asks you to discover the remaining steps that are needed for the conversion and to describe (but not write) the remaining programs that you would need to implement this web-script compiler.

Specifically, do the following exercises starting from the pizza program code provided here. Your answers for the homework should show the program that exists at the end of each step. Do these exercises in Scheme syntax, not in our make-proc, etc data structures.

  1. Manually convert the textual version of the pizza program into CPS.

  2. Manually apply lambda lifting (described in the lab handout) to the CPSed pizza program.

  3. Look at the lambda-lifted program. If you loaded it into DrScheme, would it produce the same answer as the original? Either defend why your program would produce the same answer, or

  4. If you had implemented this pizza program as web scripts from the outset, which of your named functions would have been scripts, and which would just be helper functions inside the script? Based on this, can you propose a rule for which non-tail calls really need to be removed to create web programs?

  5. Describe what other steps need to occur before your current program is a full-fledged (ready to install and run) set of web scripts. Provide contract and purpose statements for the major functions you would need to write to automate these steps.


What to Turn In

Turn in a single file hwk6.ss (or hwk6.scm) containing all code and documentation for this assignment. Make sure that both students' names are in a comment at the top of the file.


Hints and Guidelines


Back to the Assignments page