edited by
479 views

1 Answer

0 votes
0 votes

For a grammar to LL(1), there should be no conflict in

  • FIRST(A) and FIRST(S)
  • FOLLOW (A) and FIRST(A)
  • FOLLOW(S) and FIRST(S)

Considering the above grammar, let us hit the condition that there is no common value in FIRST(A) and FIRST(S)

Option-1: A -> ep

Then FIRST(S) = {a,b}
FIRST(A) = {ep}
==> No Conflict

Option-2: A -> a/ep

Then FIRST(S) = {a,b}
FIRST(A) = {a}
==> Conflict

Option-3: A -> b/ep

Then FIRST(S) = {a,b}
FIRST(A) = {b}
==> Conflict
 

Option-4: A -> a/b

Then FIRST(S) = {a,b}
FIRST(A) = {a,b}
==> Conflict


So Option-1 is the Answer

Related questions