Java Reference
In-Depth Information
S ::= B a j a
B ::= c j b C B
C ::= c C j
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 j a
A ::= c j b B
B ::= c B j
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 ::= bd B j e B
B ::= c A j d B j
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 bdcea .
Exercise 3.12. Consider the following context-free grammar:
S ::= AS j b
A ::= SA j a
a. Compute first and follow for S and A.
b. Construct the LL(1) parsing table for the grammar.
c. Is this grammar LL(1)? Why or why not?
Exercise 3.13. Show that the following grammar is LL(1).
S ::= A a A b
S ::= B b B a
A ::=
B ::=
Exercise 3.14. Consider the following grammar:
E ::= E or T j T
T ::= T and F j F
F ::= not F j ( E ) j i
 
Search WWH ::




Custom Search