# Show that CFG is not a LR(1) Grammar

Let G b the following CFG (Where S is the start symbol):

S→aB|aDc
B→bBc|c
D→bc|c


(a) Show that G is ambiguous.
(b) Show that G is not an LR(1) grammar.
(c) Modify G into an equivalent grammar G′ that is LR(1). Explain why G′ is an LR(1) grammar and why G and G′ are equivalent.

(a) I showed that there exists two left derivation trees for string abcc - therefore it is ambiguous.

(b) I simply stated that an LR(1) grammar is not ambiguous by definition, and since (a) shows it is ambigious it follows that G is not an LR(1) grammar.

(c)
G':

S→aB
B→bBc|c


I removed the nonterminal D, which makes it unambiguous.

Questions:

Is there a more suiting answer for (b)?

How do I explain why G' is an LR(1) grammar in (c)?

Thank you!

• Your G' does not generate acc – rici May 10 '19 at 19:49