too many gotos in bison (Nick Chapman)
17 Oct 2004 16:08:26 -0400

          From comp.compilers

Related articles
too many gotos in bison (2004-10-17)
Re: too many gotos in bison (2004-10-21)
| List of all articles for this month |

From: (Nick Chapman)
Newsgroups: comp.compilers
Date: 17 Oct 2004 16:08:26 -0400
Organization: Compilers Central
Keywords: yacc, question, comment
Posted-Date: 17 Oct 2004 16:08:26 EDT

I have a grammar which exceeds the limit on the number of gotos in
bison. I get this problem in versions 1.28 and 1.875.

The problem is that short is used for indexing the goto_map, which
limits the number of gotos to 32767.

        typedef short goto_number;

Making a quick change to my bison 1.875 sources, to avoid the abort, I
can see that my grammar has around 45000 gotos.

I understand that other limits have been increased/removed in the more
recent versions of bison - why not the number of gotos? Is this not a
common problem?

Is the solution just a `simple' matter of changing the typedef for
goto_number to be int, or are there other more subtle dependencies?

Or is it better to try transforming the grammar to reduce the number
of gotos? The problem is, I don't know what aspects of a grammar will
influence this.

[How many rules does your grammar have? I don't ever recall coming
close to the goto limit. -John]

Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.