help-bison
[Top][All Lists]
Advanced

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

Re: Query regarding Parser stack


From: Laurence Finston
Subject: Re: Query regarding Parser stack
Date: Tue, 12 Oct 2004 14:26:56 +0200 (MEST)

On Tue, 12 Oct 2004, Rachna Khanna wrote:

>
> Hello,
>
> I am using Bison version 1.875.
>
> My project requires to be tested under environment where files having
> many source lines can be specified. But in such a situation, the parser
> stack overflow occurs and unintialized memory is being accessed which
> leads to the application getting terminated.
>


On Tue, 12 Oct 2004, Rachna Khanna wrote:

> My project requires to be tested under environment where files having
> many source lines can be specified. But in such a situation, the parser
> stack overflow occurs and unintialized memory is being accessed which
> leads to the application getting terminated.
>

There is no necessary correllation between the
size of the input files and a minimum size of the
parser stack to prevent overflow.  The stack will overflow if too many
objects representing states are pushed onto it.  I strongly suspect that the
default size of the stack is large enough for most purposes.  I think a
more promising approach would be to examine your grammar and
try to get it to shift states less often and reduce them more often.

> Can anybody please clarify that is there any other method to increase
> the stack size other than changing the static way?
>

The only forms of memory allocation are static (in the data segment of
the executable), automatic (on the program stack), and dynamic (on the
free store).  I don't think using the program stack would be a good idea
in this case, so if you don't want to increase the size of the stack
statically, you're stuck with allocating memory for it on the free store.
To do this, you would need to change the skeleton file, or perhaps Bison's
source code itself.

Laurence




reply via email to

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