0 votes 0 votes Consider the following Grammar G S-->SX|SSb|XS|a X-->a|Xb The number of productions in the grammar(including epsilon production) after removing left recursion is ? Compiler Design gateforum-test-series compiler-design + – Gupta731 asked Nov 29, 2018 Gupta731 634 views answer comment Share Follow See all 6 Comments See all 6 6 Comments reply arya_stark commented Nov 29, 2018 i edited by arya_stark Nov 30, 2018 reply Follow Share $S ->SX|SSb|XS|a$ $X ->a|Xb$ After Removing Left Recursion $S -> XSS'/aA'$ $S'->XS'/SBS'/ε$ $X->aX'$ $X'->bX'/ε$ Whats in ans??? Am i right?? 0 votes 0 votes Gupta731 commented Nov 29, 2018 reply Follow Share Yes. I was able to do for the 2nd production. Please explain the first prod. 0 votes 0 votes arya_stark commented Nov 29, 2018 i edited by arya_stark Nov 29, 2018 reply Follow Share I Used Trick: $ A-> Aα/ β $ --> It means $βα* => A-> βα*$ We can write like this $A->βA'$ $A'->αA'/ε$ If Extend this problem like this $A-> Aα1/Aα2/Aα3............/β1/β2/β3/β4.......$ Using same mathod we get $A->β1A'/β2A'/β3A'/β4A'/..........$ $A'->α1A/'α2A'/α3A'/.....$ (With $/ε$) 0 votes 0 votes arya_stark commented Nov 29, 2018 reply Follow Share So here , $α1$ is $X$ $α2$ is $Sb$ $β1$ is $XS$ and $β2$ is $a$ 0 votes 0 votes Gupta731 commented Nov 29, 2018 reply Follow Share Yeah got it. I knew that process. Just some confusion was there in application of it. Thank you. 1 votes 1 votes arya_stark commented Nov 29, 2018 reply Follow Share Yoo Bro😃🤘 1 votes 1 votes Please log in or register to add a comment.