[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

"parser stack overflow" in bison-1.35, bad "#if" in bison.simple

From: Miko Nahum
Subject: "parser stack overflow" in bison-1.35, bad "#if" in bison.simple
Date: Sun, 25 Aug 2002 12:11:31 +0200

Hi All,

Here is a description of a problem: I am using bison to implement an
This is a pure_parser combined with flex and I compile everything in C++
as part of a class. This is of course in multi-platform env'. (Win, HP,

Under Windows currently use bison-1.28 whereas under all Unix platforms
using bison-1.35. Recently, UNDER UNIX, when run the parser on large scripts
with very long 'if statement' with many 'else if', got from bison "parser
stack overflow".
Under Windows same script does not make such problem.

After dig in to the details, found this in
"/usr/local/share/bison/bison.simple", line 72:

#if (! defined (yyoverflow) \
     && (! defined (__cplusplus) \

I'm not define yyoverflow,  so "! defined (yyoverflow)" put true.
In addition, using C++, so "(! defined (__cplusplus)" put false.
YYSTYPE_IS_TRIVIAL is true because I do have YYSTYPE (the "%union").
However, I do NOT have any location stuff, YYLTYPE is not defined, so
we got YYLTYPE_IS_TRIVIAL = false.

The result, stack enlargement code does not activated when needed and
all I have is the YYINITDEPTH which is 200 (which isnot enough).

To workaround this, I put in the following in the ".y:" file to satisfy the
#define YYLTYPE_IS_TRIVIAL      1

What should I do to have stack relocation code work if I working in C++,
using %union and not use location info ?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]