Hi,

I'm running into "memory exhausted" and from reading section 2.3 this is 
apparently caused by doing right recursion instead of left recursion. My 
grammar is fairly large(grammar file is 3400 lines) and I simply have trouble 
finding where I do right recursion.

How should I approach this problem? How can I find out where my right 
recursion is? What patterns in the .output file should I look for?

If one wants to look at my code specifically, the details follows.

The input causing the error is:

if (1) then 1
else if (1) then 1
else if (1) then 1
else if (1) then 1
else if (1) then 1
else if (1) then 1
else if (1) then 1
else if (1) then 1
else if (1) then 1
else if (1) then 1
else if (1) then 1
else if (1) then 1
else if (1) then 1
else if (1) then 1
else if (1) then 1
else if (1) then 1
else if (1) then 1
else if (1) then 1
else if (1) then 1
else if (1) then 1
else if (1) then 1
else if (1) then 1
else if (1) then 1
else if (1) then 1
else if (1) then 1
else if (1) then 1
else if (1) then 1
else if (1) then 1
else ()

My grammar for the if-expression is:

IfExpr: IF LPAREN Expr RPAREN THEN ExprSingle ELSE ExprSingle

I don't understand why this causes an error. The way the parser reduces is the 
way I would expect it too -- it has to read in all the tokens before it can 
start reducing the first statement(or?).

The debugging output is:

http://www.codepaster.com/code.php?code=4865

The .output file is:

http://www.codepaster.com/code.php?code=4864


Cheers,

                Frans


_______________________________________________
help-bison@gnu.org http://lists.gnu.org/mailman/listinfo/help-bison

Reply via email to