Given grammar G: S->aS| AB A-> e B-> e D-> b Reduce the grammar, removing all the e productions:

Giang Phạm

New member
Given grammar G:
S->aS| AB
A-> e
B-> e
D-> b
Reduce the grammar, removing all the e productions:
A. S->aS| AB| A| B, D-> b
B. S->aS| AB| A| B| a, D-> b
C. S->aS| AB| A| B
D. None of the mentioned
 
Answer: B
Explanation: We will replace all the nullables wherever they appear in the right hand side of any production. D will not be erased as we are just removing nullable variables not completely simplifying the grammar.
 

Tìm kiếm

Back
Top