CS 1102 (A16): Lab 4

To get your participation credit, make sure you
upload your Definitions file to turnin before you leave the lab!
(This work will not be graded---full credit just for submitting.)


Lab Motivation and Goals

The main point of this lab is to illustrate the inherent extensibility of the language/interpreter model by having you extend the slideshow program.

You need to use Advanced Student language level for this lab!


Exercises

Put your name in a comment at the top of the Definitions area.

In a slideshow application such as powerpoint, overlays let the presenter add details to the slide that's already on the screen. This is useful when showing several steps in a single topic, where each step builds on the previous ones.

For this lab, you will add overlays to the slideshow program. Start with the file from class, and modify it accordingly. (NB: Save the file on your Desktop and then open it in DrRacket!)

You will need to modify the data definition for programs to allow someone to specify overlays, modify the example talk program to use overlays, and modify the interpreter to process the overlays.

As an example, here's how a run of the program with overlays might look:

       ------------------------------
       Title: Hand Evals in DrRacket

       Hand evaluation helps you learn how Racket reduces programs to values
       ------------------------------
       n
       ------------------------------
       Title: Example 1
       
       - (+ (* 2 3) 6)
       ------------------------------
       n
       ------------------------------
       Title: Example 1
       
       - (+ (* 2 3) 6)
       - (+ 6 6)
       ------------------------------
       n
       ------------------------------
       Title: Example 1
       
       - (+ (* 2 3) 6)
       - (+ 6 6)
       - 12
       ------------------------------
       n
       ------------------------------
       Title: Summary: How to Hand Eval

       ------------------------------
       n
       ------------------------------
       Title: Summary: How to Hand Eval

       1. Find the innermost expression
       ------------------------------
       n
       ------------------------------
       Title: Summary: How to Hand Eval

       1. Find the innermost expression
       2. Evaluate one step
       ------------------------------
       n
       ------------------------------
       Title: Summary: How to Hand Eval

       1. Find the innermost expression
       2. Evaluate one step
       3. Repeat until have a value
       ------------------------------
       n
       End of show

Things to note from this example

The example slide sequence above comes from one regular slide, followed by a slide with 2 overlays, followed by a slide with 3 overlays. Note that the overlays taken together seem to form one complete slide (e.g., if a numbered point list is broken into overlays, the numbering should be consistent).

Hints and Guidelines

Hint 1: Add a new type of slide (e.g., slide-with-overlays) that has a title, a body and a list of overlays. Initially allow only one overlay, get everything working, then extend the code to support an arbitrary number of overlays.

Hint 2: The existing print-slide function knows how to handle regular slides (without overlays). Can you find a way to reuse this function (without editing it) to display slides with overlays? Consider making a temporary instance of a regular slide using material from overlays.

You are free to modify anything, but the goal is to reuse as much of the existing design as possible. If you find you are making lots of edits and duplicating code, ask for help!

Everyone should be able to extend the data definitions, modify the talk program to specify the above example, and figure out where to edit the interpreter to process the overlays.