Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

Aptitude | GATE CS 1998 | Question 61

  • Last Updated : 05 Aug, 2020

Consider the grammar

S →  Aa | b
A → Ac | Sd | ε

Construct an equivalent grammar with no left recursion and with minimum number of production rules.


Answer:

Explanation: Given,

S →  Aa | b
A → Ac | Sd | ε 

We can write this grammar as-

S →  Aa | b
A → Ac | Aad | bd | ε 

After removing left factor we get :-

S → Aa | b
A → A’ | bdA’
A’ → cA’ | adA’ |  ε 


Quiz of this Question

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!