Re: Help with bison

Steve Horne <>
Fri, 27 Jul 2007 02:13:11 -0700

          From comp.compilers

Related articles
Help with bison (2007-07-26)
Re: Help with bison (Gene) (2007-07-26)
Re: Help with bison (Steve Horne) (2007-07-27)
| List of all articles for this month |

From: Steve Horne <>
Newsgroups: comp.compilers
Date: Fri, 27 Jul 2007 02:13:11 -0700
Organization: Compilers Central
References: 07-07-091
Keywords: yacc
Posted-Date: 27 Jul 2007 09:27:02 EDT wrote:

> The pertinent portion of Simple.y is:
> %union semrec /* The Semantic

I think that's your problem. You are only supposed to have one %union,
and Bison gives that the name YYSTYPE automatically. You have tried to
give it a name yourself, and so it ends up with two names.

A typical %union declaration might look like...

%union {
int m_Int_Result;
float m_Float_Result;

If you want to define other unions, just use the normal C syntax in
the %{ ... %} section.

For more complex parsers, it is more normal to define YYSTYPE as
either a base-class pointer or a simple integer (a key to access some
external data structure).

I don't think there's any way to give YYSTYPE another name. Section
3.8 of the manual (version 2.3) claims there's never any need.

Post a followup to this message

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