Consider the grammar S → AbBaCc | ε A → aAb | ba B → BBC | cb C → cCa | ac…
2020
Consider the grammar
S → AbBaCc | ε
A → aAb | ba
B → BBC | cb
C → cCa | ac
Find the First () of S.
- A.
{a, b, ε}
- B.
{ε}
- C.
{a, ε}
- D.
{a, b, c, ε}
Attempted by 103 students.
Show answer & explanation
Correct answer: A
Given Grammar:
S → AbBaCc | ε
A → aAb | ba
B → BBC | cb
C → cCa | ac
FIRST(A) = { a, b }
Since:
S → AbBaCc | ε
and A does not derive ε,
FIRST(S) = FIRST(A) ∪ { ε }
Therefore,
FIRST(S) = { a, b, ε }