From d5f091c11cd63e763fef9c4ed366af9ca26ebefe Mon Sep 17 00:00:00 2001 From: "ben.franksen" <ben.franksen@online.de> Date: Sun, 8 Jan 2012 17:57:14 +0000 Subject: [PATCH] snc: fixed parser stack overflow This appeared when compiling deeply nested statements. The solution is to use a dynamically growing stack. --- src/snc/snl.lem | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/snc/snl.lem b/src/snc/snl.lem index a489e9b4..6777372b 100644 --- a/src/snc/snl.lem +++ b/src/snc/snl.lem @@ -31,6 +31,15 @@ in the file LICENSE that is included with this distribution. "syntax error near token '%s'\n", TOKEN.str); } +// %stack_overflow { +// report("parser stack overflow\n"); +// } + +// A stack size of 0 (zero) means stack size gets dynamically increased +// on demand i.e. stack size is essentially unlimited. This is important +// because some rules like the one for IF/ELSE statements employ left-recursion. +%stack_size 0 + %token_type { Token } %default_type { Expr* } -- GitLab