Q76: Remove null production from the grammar

Question 76: Remove null production from the following grammar:

grammar

Options:

1. S -> AB | A | B

A -> aAA | a

B -> bBB | b

 

2. S -> AB

A -> aAA | aA | a

B -> bBB | bB | b

 

3. S -> AB | A | B

A -> aAA | aA | a

B -> bBB | bB | b

 

4. S -> AB | A | B

A -> aA | a

B -> bB | b

 

Solution: In option 1, the productions of A don’t have aA. In option 2, the productions of S don’t have A and B alone. In option 4, the productions of A don’t have aAA. The correct answer is option 3.