Skip to content
Snippets Groups Projects
Commit d5f091c1 authored by ben.franksen's avatar ben.franksen
Browse files

snc: fixed parser stack overflow

This appeared when compiling deeply nested statements.
The solution is to use a dynamically growing stack.
parent 2d1f8aa2
No related branches found
No related tags found
No related merge requests found
...@@ -31,6 +31,15 @@ in the file LICENSE that is included with this distribution. ...@@ -31,6 +31,15 @@ in the file LICENSE that is included with this distribution.
"syntax error near token '%s'\n", TOKEN.str); "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 } %token_type { Token }
%default_type { Expr* } %default_type { Expr* }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment