Hi, colleague on the stack over the flow elements.
I am studying a compiler class. I realized that the “Surface Parser” should avoid left recursion and convert to the right recursive path.
Questions
a) I understand that the upper right parser is LL and the lower parser is LR?
b) I found that left-recursion is a rule that ex calls itself ex) Expr: == Expr '+' Term | A term that can cause an infinite loop to search for Expr. But be that as it may, any sample input handling code in C or Java? (I don’t need a parser or scanner code), what I need is an example code of a code with a conditional form, which occurs in an infinite loop on the left recursion.
c) What actually makes the difference in the way you use right recursion in the top Parser view?
ANS c) Elimination of the need for return. but something else?
ANS b) x - 2 * y, but also something else? because it works with a backtracking method.
For example, I found both non-left recursion and left recursion.
Left recursive grammar
A -> Ax
Left recursive grammar
A -> Bx
B -> Ay
Both fall into an endless cycle.
Thanks and appreciate for all your experts.
source
share