124 An Introduction to Compiler Construction in a Java World
S ::= B a | a
B ::= c | b C B
C ::= c C |
a. Compute first and follow for S, B, and C.
b. Construct the LL(1) parsing table for this grammar.
c. Is this grammar LL(1)? Why or why not?
Exercise 3.10. Consider the following context-free grammar:
S ::= A a | a
A ::= c | b B
B ::= c B |
a. Compute first and follow for S, A, and B.
b. Construct the LL(1) parsing table for the grammar.
c. Is this grammar LL(1)? Why or why not?
Exercise 3.11. Consider the following context-free grammar:
S ::= A a
A ::= b d B | e B
B ::= c A | d B |
a. Compute first and follow for S, A, and B.
b. Construct an LL(1) parsing table for this grammar.
c. Show the steps in parsing b d c e a.
Exercise 3.12. Consider the following ...