Compiler Design and Construction - Old Questions

6.  Show that the following grammar is not in a LL(1) grammar.

        

6 marks | Asked in 2069

Given Grammar,

        

The FIRST and FOLLOW of the grammar symbols are:

FIRST(S) = {c}

FIRST(A) = {a}

FOLLOW(S) = {$}

FOLLOW(A) = {b, d}

Then, constructing the LL(1) parsing table:

Non-terminals

Terminal Symbols

a

b

c

d

$

S

 

 

S → cAd

 

 

A

A → Ab

A → a

 

 

 

 

Since, there are two entries for A in the LL(1) parsing table, hence the given grammar is not in LL(1) grammar.