32 votes 32 votes Consider the following expression grammar $G$: $E \rightarrow E-T \mid T$ $T \rightarrow T + F \mid F$ $F \rightarrow (E) \mid id$ Which of the following grammars is not left recursive, but is equivalent to $G$? $E \rightarrow E-T \mid T$ $T \rightarrow T +F \mid F$ $F \rightarrow (E) \mid id$ $E \rightarrow TE’$ $E’ \rightarrow -TE’ \mid \epsilon$ $T \rightarrow T + F \mid F$ $F \rightarrow (E) \mid id$ $E \rightarrow TX $ $X \rightarrow -TX \mid \epsilon$ $T \rightarrow FY$ $Y \rightarrow +FY \mid \epsilon$ $F \rightarrow (E) \mid id$ $E \rightarrow TX \mid (TX)$ $X \rightarrow -TX \mid +TX \mid \epsilon$ $T \rightarrow id$ Compiler Design gatecse-2017-set2 grammar + – Arjun asked Feb 14, 2017 • edited Dec 2, 2017 by kenzou Arjun 11.0k views answer comment Share Follow See all 2 Comments See all 2 2 Comments reply rahul sharma 5 commented Oct 15, 2017 reply Follow Share Arjun sir, Please verify option d,statement number:- T−>+FY∣ϵ Is it Y or X? 0 votes 0 votes rahul sharma 5 commented Oct 15, 2017 reply Follow Share Also, option c has 5 productions in the actual paper.Please cross check once 0 votes 0 votes Please log in or register to add a comment.
0 votes 0 votes here we need to remove left recursion E->TE' E'->-TE'/ epsilon T->FT' T->+FT'/ epsilon F->(E)/id above by applying rule A->Ax/y then A->yA' A'->xA'/ epsilon were by expansion of the same we got the same strings. akankshadewangan24 answered Apr 10, 2017 akankshadewangan24 comment Share Follow See all 0 reply Please log in or register to add a comment.
0 votes 0 votes option C 1gate_cracker answered Dec 24, 2017 1gate_cracker comment Share Follow See 1 comment See all 1 1 comment reply Kripa commented Dec 27, 2017 reply Follow Share Can we say that left recursion of grammar does not produce same language as the original grammar..? 0 votes 0 votes Please log in or register to add a comment.
0 votes 0 votes Options A and B shows left recursion, while option D can’t make a parse tree for the following input for which the given CFG can make. ankit3009 answered Nov 5, 2021 ankit3009 comment Share Follow See all 0 reply Please log in or register to add a comment.