Chapter 6: Bottom-Up Parsing
Studio
Getting Started (5 minutes)
- Review the
Studio Guidelines if necessary.
- Locate and install the studio6 project into your
eclipse workspace as directed by your instructor,
following the usual instructions.
- Open report.txt in eclipse, fill in your team members' names, and
keep the file open so that you can record your findings.
- Browse this studio document to get an idea of the work you will do in this session.
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)
- Read/review the following
- If CUP can successfully generate a parser for your grammar, without
issuing any shift/reduce or reduce/reduce conflicts, then your grammar is
unambiguous and is suitable for deterministic, bottom-up parsing with one
symbol of lookahead.
- If not then one of the following must be true:
- Open the CUP User Manual
for quick reference.
- Follow the instructions for ant builds.
Not much will be working at this point, and most runs will die in CUP showing
Java Error: 100.
-
As you work on each of the problems below, simply rerun the ant build, and
the results will be displayed on the console. (Recall you can click on the toolbox
green button to rerun the build.)
- If things seem to be messed up, run
the clean task followed by the default (run) build, and that should fix any problems.
- If you need to see the states computed by parser construction, look for the
relevant file in the outermost autogen folder of your project,
Main Problems
- cup0
- This is a short grammar you'll type in yourself by now, having followed
the warm-up instructions above.
- cup1
- Follow the instructions in the grammar file -- be sure to
check your work with another group and the TA or prof.
- cup2
- Follow the instructions, ask questions as needed, check your
answers with other groups and the TA or prof.
- cup3
- Some lines of this file are NOT to be modified -- check this out before
you start changing things. Follow the instructions, but ask questions and
check your work as you go with others.
- cup4
- Same deal -- ambiguous, not? Figure it out and fix it up
What to submit
- Your cup files
- Your console run on all the grammars and test
files.
Finishing Up
Submit your work as directed by your instructor.
Copyright 2010 by Ron K. Cytron
Last modified 14:32:05 CDT 13 August 2010