3 votes 3 votes Which grammar causes recursive-descent parser to go into infinite loop? LL(1) Left recursive grammar Right recursive grammar Grammar with left factors Compiler Design tbb-cd-1 compiler-design grammar + – Bikram asked Nov 25, 2016 edited Sep 14, 2020 by ajaysoni1924 Bikram 266 views answer comment Share Follow See all 0 reply Please log in or register to add a comment.
Best answer 3 votes 3 votes The production is left-recursive if the leftmost symbol on the right side is the same as the non-terminal on the left side. For example, $expr\rightarrow expr + term$. If one were to code this production in a recursive-descent parser, the parser would go in an infinite loop. References: http://www.personal.kent.edu/~rmuhamma/Compilers/MyCompiler/leftRecursion.htm https://web.cs.wpi.edu/~kal/PLT/PLT4.1.2.html So,the correct answer is $(B)$. Lakshman Bhaiya answered Aug 22, 2019 selected Aug 23, 2019 by Bikram Lakshman Bhaiya comment Share Follow See 1 comment See all 1 1 comment reply logan1x commented Nov 14, 2019 reply Follow Share Why not option D? Recursive-descent parser will not work in case of left factoring too. 0 votes 0 votes Please log in or register to add a comment.