Machine-translated by Google. Questions are authored in English.
Top

Discussion

The equivalent grammar corresponding to the grammar G : S → aA, A → BB, B → aBb | ∈ is

  • A.S → aA, A → BB, B → aBb
  • B.S → a|aA, A → BB, B → aBb | ab
  • C.S → a | aA, A → BB | B, B → aBb
  • D.S → a |aA,A→ BB | B, B→ aBb | ab

Answer: D

The grammar has B going to aBb or to the empty string, and A going to BB, so B and A can both be empty. To remove the empty productions, add a version of each rule with the nullable variable left out: S goes to aA or to a, A goes to BB or to B, and B goes to aBb or to ab. This gives S to a | aA, A to BB | B, B to aBb | ab, option (D). Option (A) leaves the empty string out without compensating, and options (B) and (C) each miss the rule A to B or the rule B to ab.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.