0 votes 0 votes The following grammar $\text{G}$ is left recursive. $\text{E} \rightarrow \text{E + T}\; \mid \; \text{T} $ $\text{T} \rightarrow \text{T * F} \; \mid \; \text{F} $ $\text{F} \rightarrow \text{(E)} \mid \textbf{id} $ Which of the following is a correct left-recursive variant of $\text{G}$? $\text{E} \rightarrow \text{E}’\text{T} \\ \text{E}' \rightarrow \text{+TE}’ \mid \epsilon \\ \text{T} \rightarrow \text{T}’\text{F} \\ \text{T}' \rightarrow \text{*FT}’ \mid \epsilon \\ \text{F} \rightarrow \text{(E)} \mid \textbf{id} $ $\\ \text{E} \rightarrow \text{TE}' \\ \text{E}' \rightarrow \text{+TE}’ \mid \epsilon \\ \text{T} \rightarrow \text{FT}' \\ \text{T}' \rightarrow \text{FT}’* \mid \epsilon \\ \text{F} \rightarrow \text{(E)} \mid \textbf{id} $ $\text{E} \rightarrow \text{TE}' \\ \text{E}' \rightarrow \epsilon \mid \text{TE}' \\ \text{T} \rightarrow \text{FT}' \\ \text{T}' \rightarrow \text{*FT}’ \mid \epsilon \\ \text{F} \rightarrow \text{(E)} \mid \textbf{id} $ $\text{E} \rightarrow \text{TE}' \\ \text{E}' \rightarrow \text{T + E}' \\ \text{T} \rightarrow \text{FT}' \\ \text{T}' \rightarrow \text{F* + T}' \\ \text{F} \rightarrow \text{(E)} \mid \textbf{id} $ Compiler Design uppcl2018 compiler-design context-free-grammar left-recursion + – admin asked Jan 5, 2019 • retagged Jun 29, 2022 by Lakshman Bhaiya admin 368 views answer comment Share Follow See all 0 reply Please log in or register to add a comment.
0 votes 0 votes T--->FT` T`-->*FT`|{ F-->(E)|id E-->TE` E`-->+TE`|{ would be right as E-->T+E` would run infinitely Raghav Khajuria answered May 3, 2019 Raghav Khajuria comment Share Follow See all 0 reply Please log in or register to add a comment.