« Return to Thread: "Left recursion detected" when translating from BNF

"Left recursion detected" when translating from BNF

by Bertram :: Rate this Message:

Reply to Author | View in Thread


Hello,

I am new to Javacc, so there might be a very obvious solution to this.
This is a left recursion problem (Left recursion detected:).

Here the 1:1 translation of the related BNF description:

void searchExp():
{}
{
    relExp()
    |  searchExp() logOp() searchExp()  // this line is the problem
    | "(" searchExp() ")"
       
}  

void logOp():
{}
{
         <T_OR>
         | <T_AND>
}


All solutions I found so far, do not cover all scenarios.

Any help much appreciated !!

Bertram

 « Return to Thread: "Left recursion detected" when translating from BNF