Discussion
Consider the context free Grammar with 7 (seven) productions.
S \(\rightarrow\) Aa / B
B \(\rightarrow\) A / bb
A \(\rightarrow\) a / bc / B
After removing all unit productions the resulting equivalent grammar will contain ................................. productions.
Answer: C
The resulting grammar has 10 productions.
The unit productions are S \(\to\) B, B \(\to\) A and A \(\to\) B, so B and A can each derive the other, and S can derive both. Removing them, each variable takes the non-unit productions of every variable it can reach through unit productions. The non-unit productions are S \(\to\) Aa, B \(\to\) bb and A \(\to\) a | bc.
- S \(\to\) Aa | bb | a | bc: 4 productions
- B \(\to\) bb | a | bc: 3 productions
- A \(\to\) a | bc | bb: 3 productions
That makes 4 + 3 + 3 = 10. Counts such as 11, 12 or 18 come from keeping a unit production or duplicating a substituted one.
Post your comment
Please log in or register to post a comment.
Examination Categories
- SSC Exams
- Banking Exams
- Teaching Exams
- Civil Services Exams
- Railways Exams
- Engineering Recruitment Exams
- Defence Exams
- State Government Exams
- Police Exams
- Insurance Exams
- Nursing Exams
- Other Government Exams
- NRA CET
- PG Entrance Exams
- Campus Placement
- MBA Entrance Exams
- CUET and UG Entrance
- Judiciary Exams
- Regulatory Body Exams
- Software Development