help-bison
[Top][All Lists]
Advanced

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

Re: 'yylval was not declared' on switch from Bison 2.4.1 to 3.0.2


From: Akim Demaille
Subject: Re: 'yylval was not declared' on switch from Bison 2.4.1 to 3.0.2
Date: Mon, 12 Jan 2015 11:41:05 +0100

> Le 8 nov. 2014 à 15:31, Evan Lavelle <address@hidden> a écrit :
> 
> Any idea how to fix this? I have a grammar which compiled without problems on 
> bison 2.4.1/gcc 4.4.7 (RHEL 6.5), but which won't now compile on bison 
> 3.0.2/gcc 4.8.2 (Ubuntu 14.04).
> 
> The bison.tab.cc output from 2.4.1 included a definition of yylval as:
> 
> semantic_type yylval;
> 
> The 3.0.2 output has no definition, and the compiler complains when it 
> reaches the first reference to yylval in the new bison.tab.cc, saying that 
> "'yylval' was not declared in this scope." This corresponds to my first use 
> of 'yylval' in my .y file.
> 
> I'm using the C++ skeleton (lalr1.cc), and not explicitly declaring a 
> pure-parser.
> 
> http://stackoverflow.com/questions/23685843/problems-with-yylval-and-yylloc-after-switching-to-bison-3-0
>  is the same question on stack overflow, from May 15th, with a suggestion to 
> use yyla.value instead.

Hi Evan!

Toying with yylval is dangerous business.  I currently don't even see
how to do that when variants are enabled.

Playing with it is clearly valid in C, but I did not expect users
to depend on this feature in the C++ skeletons.  Can you provide
me with more details to try to understand what is your use case?
Maybe that requires a new feature to be done properly, I don't know.

Thanks!


reply via email to

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