CS 1102: Lab 4


Lab Motivation and Goals

This lab is designed to give you more experience working with interpreters by having you extend the interpreter for slideshows.


Exercises

In a slideshow package 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 example, where each step builds on the previous ones.

For this lab, add overlays to the slideshow program. Start with the file from class, and modify it accordingly. You will need to modify the data definition for programs to allow someone to specify overlays, modify the 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 DrScheme

       Hand evaluation helps you learn how Scheme reduces programs to values
       ------------------------------
       n
       ------------------------------
       Title: Example 1
       
       ------------------------------
       n
       ------------------------------
       Title: Example 1
       
       1. (+ (* 2 3) 6)
       ------------------------------
       n
       ------------------------------
       Title: Example 1
       
       1. (+ (* 2 3) 6)
       2. (+ 6 6)
       ------------------------------
       n
       ------------------------------
       Title: Example 1
       
       1. (+ (* 2 3) 6)
       2. (+ 6 6)
       3. 12
       ------------------------------
       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 comes from one slide and 3 overlays. Note that the overlays taken together seem to form one complete slide (given the numbering on the steps).

Guidelines

How should overlays behave? Here are some assumptions you should or should not make:

You are free to modify the existing data definitions. You shouldn't need to modify them a lot though. If you find you are making lots of edits, 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.

Hint 1: Add a new kind of slide (like slide-with-overlays) that has the title and body like old slides, but also includes overlays. Initially allow only one overlay, get everything working, then extend it to support an arbitrary number of overlays.

Hint 2: The existing print-slide function knows how to handle slides without overlays. Can you find a way to reuse this function (without editing it) to display overlays? Could you do this if you had only one overlay?.