help-bison
[Top][All Lists]
Advanced

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

Re: %union problem in 2.4 version


From: Joel E. Denny
Subject: Re: %union problem in 2.4 version
Date: Wed, 25 Mar 2009 10:13:24 -0400 (EDT)

Hi Cleto,

On Wed, 25 Mar 2009, Cleto Martin Angelina wrote:

> Recently, i'm having troubles compiling my parser, which worked in bison
> 2.3. The output message is:
> 
> Parser.y:42: error: ISO C++ forbids declaration of ‘Invocation’ with no type
> Parser.y:42: error: expected ‘;’ before ‘*’ token
> Parser.y:43: error: ISO C++ forbids declaration of ‘Parameter’ with no type
> Parser.y:43: error: expected ‘;’ before ‘*’ token
> Parser.y:44: error: ISO C++ forbids declaration of ‘vector’ with no type
> Parser.y:44: error: invalid use of ‘::’
> Parser.y:44: error: expected ‘;’ before ‘<’ token
> 
> And header's .y file is:
> 
> %{
> #include <stdio.h>
> #include <stdlib.h>
> #include "Driver.h"
> %}

Without seeing the rest of your code, I can't be sure, but try changing 
the above to the following:

  %code require {
    #include <stdio.h>
    #include <stdlib.h>
    #include "Driver.h"
  }

If you don't need the std library includes in your .hh file, you might 
move them into a "%code {...}" or a "%code top {...}".  See the section 
"3.1.2 Prologue Alternatives" in the Bison 2.4 manual for a complete 
discussion.

> I've read about that in this mailing list, but i'm really lost. I don't know
> which features have changed in 2.4 version that are affecting my project.
> Can anyone guide me?.

For a list of changes over recent Bison releases, see NEWS in your Bison 
distribution.  In particular, see the entry "Handling of traditional Yacc 
prologue blocks" under the 2.3a heading.

reply via email to

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