I have the following productions

A -> Aa
A -> b

so it is clear that there is left recursion like

parseA() {
   parseA();//recursion
   parsea();
}

It is said that the left recursion can be avoided using the following rule

A -> bA'
A' -> aA'|null

How is left recursion avoided here?.There is still recursion in function A'. Can anybody explain me this.I am a beginner in this subject?

有帮助吗?

解决方案

How is left recursion avoided here?.There is still recursion in function A'.

Read this again. Left recursion is avoided. Non-left recursion is not.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top