Consider the grammar S → AbBaCc | ε A → aAb | ba B → bBC | cb

Consider the grammar

S → AbBaCc | ε

A → aAb | ba

B → bBC | cb
|

Consider the grammar

S → AbBaCc | ε

A → aAb | ba

B → bBC | cb

C → cCa |ac

Find the First ( ) of S

A. {a, b, c, ε}

B. {a, b, ε}

C. { ε }

D. {a, ε}

Please scroll down to see the correct answer and solution guide.

Right Answer is: B

SOLUTION

First( ) of S = { First ( ) of A , First( ) of  ε }

First( ) of A = { First( ) of aAb, First( ) of ba } = { a , b }

First( ) of ε = ε itself is First( ) of ε

Hence First of S = {a, b, ε}

Option 2 is the correct answer