CPSC460/CPSC560
Spring 2008
Test 1 Review
The test will be on the material that we have covered since the
beginning of the semester.
I think that we have covered chapters 1, 2, 3, 4
and the C programming language.
The test will be mostly problem-solving with
some concept questions.
You should know these topics:
- Know how to write a C program.
- Know the phases of a compiler (figures 1.6 and 1.7, pages 5 and 7).
- Know how to draw parse trees given a grammar.
- Know what is input and output to
lexical analyzers and parsers.
- Know the difference between terminals and non-terminals, and know
what tokens are.
- Know the difference between a token and a lexeme.
- Know how to do rightmost and leftmost derivations.
- Know how to write a regular expression, and how to describe what
one is.
- Know how to trace through a
transition diagram for a regular expression.
- Know how to recognize an ambiguous grammar (can draw two distinct
parse trees).
- Know how associativity and precedence are modeled in parse trees
- Know what syntax directed definitions
and synthesized attributes are.
- Know what semantic translation schemes are.
- Know the difference between top-down and bottom-up parsing and
what kind of parsers do which (LL does top-down, LR does bottom up.
- Be able to trace through lex source code and create lex
rules.
- Be able to calculate first and follow sets. Know what they are
and why they're used.
-
Be able to build and trace through a recursive descent predictive
parser.
-
Be able to build and trace through a non-recursive descent predictive
parser given the tables.
-
Know the difference between LL and LR parsers, what LL and LR means,
and what the numbers in the parentheses mean (e.g., LR(1) ). Know the
advantages of LR parsing (pp. 241-242).
-
Know how to left factor and why you
would want to do that.
Know why you would want to eliminate left recursion,
and what left recursion is.
-
Be able to
trace through a shift-reduce
parser given the state table and input.
- Be able to construct annotated parse trees for CFGs with
a translation scheme.
Working problems is probably the best way to study
for the test. Work the problems at the end of
each section.