Studio 3: Bottom Up Parsing

Studio Sessions Overview:

The results of your studio session are to be reported and documented in a file that you save in your workspace. You are to print and turn in one copy of that report for your group. In the descriptions of the studio exercises, verbs like report and document are indications of activities you should summarize and discuss in your report.

In your groups, take turns documenting results, looking over shoulders, and staffing the keyboard.

It is unacceptable to copy anything without understanding it. At any point, the TA or instructor can point to something you've done and ask you why it works, or change it and ask what would happen with the modification.


In each of the following sections, go as far as you can in the time allotted, but move on to the next section so you'll have a chance to work on each section while in studio.

Warm Up: (10 minutes)

  1. Open the CUP User Manual for quick reference.
  2. Open eclipse and carefully follow the following steps. If these steps do not work for you, switch to a new workspace and try again.
  3. Import (File..Import) this zip file using the Existing projects into workspace method (Do not choose the archive file method). After clicking on "Existing projects into workspace" select, as the archive file, the file you downloaded earlier.
  4. You need to add the CUP runtime jar file to the build path for this project in eclipse:
    1. Select the project
    2. Choose File...Properties
    3. Chose the Java Build Path
    4. Add an external jar file
    5. The jar you want to add is situated in the Tools subdirectory of this project, and is called java-cup-11a.jar.
  5. Right-click on the build.xml file and run it as an Ant Build...

  6. The build should work and you should see the output from running all of the parsers in the console window.


    Hereafter, you can run this build by clicking on the arrow with the red toolbox.

  7. This should produce some output in the console window. The parse of problem 1a should be fine, but the rest will have various problems -- don't worry about that yet.
  8. If you have time, glance at the build.xml file. Discuss how it controls the build process you witnessed.

Main Problems

You will consider a success of problems to be solved by bottom-up parsing. The nature of this studio is to study syntax-directed parsing, which means that we will be translating inputs into some form as we parse.

Your work will be done in the various cup files found in the root directory for this studio.


Part 1 (20 minutes)

Part 2 (20 minutes)

Part 3 (20 minutes)

Part 4 (20 minutes)

Finally

Be sure to mail yourself a copy of the work you did on lab 2 in studio, so you can submit it with the rest of your lab 2 work.

Be sure to submit the following before leaving studio:



Last modified 10:46:52 CST 17 February 2008 by Ron K. Cytron