GATE Computer ScienceHardGATE CSE · UGC NET

Left factoring is applied to A → a b c | a b d | a e | f, and the shared prefixes are factored as far as possible, with new non-terminals A′ and A″. How many productions does the resulting grammar have?

  1. A. 5
  2. B. 6
  3. C. 7
  4. D. 4

Correct answer: B. 6

A → a A′ | f; A′ → b A″ | e; A″ → c | d: 2 + 2 + 2 = 6 productions.

More Compiler Design questions

Exams that ask this topic