Question discussion

For the grammar S → AB, A → a | ε, B → b | ε, the set FIRST(S) is

2539Medium DSSSB TGT Computer Science 0 replies

For the grammar S → AB, A → a | ε, B → b | ε, the set FIRST(S) is

  • A{a}
  • B{a, b}
  • C{b, epsilon}
  • D{a, b, epsilon}
Correct answer: D

Explanation

FIRST(A) = {a, ε} and FIRST(B) = {b, ε}; because A can vanish, FIRST(S) also contains b, and because both A and B can derive ε, S can derive ε too.

Discussion 0

Nobody has replied yet. Start the discussion!