Today:
Review exam.
Reading questions from Lecture 9.
Homework 6.
For next time:
Reading questions below.
Finish Homework 6.
No quiz. We'll have one next Thursday.
Use the formal or informal definition of PDA?
How to handle determinism?
Just decide, or build the parse tree?
1) Let's say you are trying to match parentheses. What's wrong with the following grammar (from page 103):
S -> aSb | SS | e
What can we do to solve this problem?
2) Strategies for building the parse tree?
Practical parsing is a major topic in a compilers class.
Bottom-up parsing works for a subset of CFLs called LR because they can be parsed Left-to-right and produce a Rightmost derivation.
The most common algorithm is called a shift-reduce parser.
The basic operations are
a) input tokens are scanned one at a time and pushed onto a stack
b) when the top elements of the stack match a rule, they are popped and replaced by a variable
It can take some effort to re-write a CFG as an LR grammar.
2) Top-down parsing works for a smaller subset of CFLs called LL.
The most natural implementation is a recursive-descent parser.
The critical property of an LL grammar is that you can look at a finite prefix of the input and know which rule to invoke.
1) Declarative programming in Prolog
2) Church-Turing Thesis (Chapter 3)
3) Decidability and the halting problem (Chapter 4)
4) Godel's incompleteness theorem (my materials)
5) Analysis of algorithms (Chapter 7)
6) P == NP? (Chapter 7)
Sipser, pages 123-132
1) How are the conditions for the CFL pumping lemma different from the conditions for the RL pumping lemma?
2) How do you compute p for a given CFG?
3) In the proof of the CFL pumping lemma, why do we choose the parse tree with the fewest nodes?
4) In the proof of the CFL pumping lemma, why do we choose the lowest |V| + 1 variables in the path?
5) Looking at the examples on pages 126 and 127, can you give an intuitive explanation of what PDAs cannot do and why?
6) Do exercise 2.4 on page 128, "Give context-free grammars..."
7) Do exercise 2.9 on page 129, "Give a context free grammar...
8) Do exercise 2.16 on page 129, "Show that the class..." You might find it helpful to read Exercise 2.15 first.