[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Problem finding cause of memory exhausted
From: |
Frans Englich |
Subject: |
Problem finding cause of memory exhausted |
Date: |
Thu, 8 May 2008 16:46:51 +0200 |
User-agent: |
KMail/1.9.6 |
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
- Problem finding cause of memory exhausted,
Frans Englich <=