Next: Exercise
Up: No Title
Previous: A reduce-reduce Conflict
- first(X) are the terminals X can start with.
- A terminal t is in first(X) if there
is a parse tree, such that t is the leftmost
leaf under X.
- leaves do not count.
- Example:
first(A) = { b, a, d }
- follow(X) are terminals which can follow X.
- A terminal t is in follow(X) if there is
a parse tree such that t is the leftmost
leaf after the leaves under X
- Again, leaves do not count.
- Example: follow(B) = { d }
- A non-terminal is nullable if it can derive the empty
string (it may have only -leaves (Example: B is
nullable)
Christoph Zenger
4/6/2000