help-bison
[Top][All Lists]
Advanced

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

RE: Upgrading from 1.35 to 1.875 breaks things...?


From: Nikolai Devereaux
Subject: RE: Upgrading from 1.35 to 1.875 breaks things...?
Date: Tue, 4 Mar 2003 09:08:21 -0800

Hi Akim, thanks for your response.  I have a few additional comments and
questions for you, if you don't mind.


nik> I just upgraded bison to 1.875 from 1.35 (cygwin/Win2k).  I had
nik> a project that compiled just fine, but now I get these errors
nik> in VC++:
nik>
nik> xpath.tab.c(1286) : warning C4065: switch statement contains
nik>                    'default' but no 'case' labels
nik>
nik> xpath.tab.c(1313) : warning C4065: switch statement contains
nik>                    'default' but no 'case' labels
nik>
nik> xpath.tab.c(1981) : warning C4102: 'yyerrlab1' : unreferenced label
nik>
nik> xpath.l(105) : error C2065: 'yytoknum' : undeclared identifier

akim> Huh???
akim>
akim> Please, first of all, use
akim> ftp://alpha.gnu.org/gnu/bison/bison-1.875a.tar.gz.


This is an alpha release, right?  Am I not better off using a production
release, even if it's an earlier version?

The switch stmt labels are due to this generated code in xpath.tab.c:

  switch (yytype)
    {
      default:
        break;
    }



nik> This is really strange to me.  I read in the Bison manual
nik> online that you can lookup values in the token table here:
nik>
nik>
http://www.gnu.org/manual/bison-1.35/html_node/Calling-Convention.html#Calli
ng%20Convention
nik>
nik>   (tiny version: http://tinyurl.com/6kpf)
nik>
nik>
nik> I used this code in a function to get the token number of
nik> multicharacter tokens from within some of my lexer rules:

akim> This code has not been checked, indeed :(

So, what are you saying?  Is this not a decent approach?


nik> Now it doesn't work... Can anyone suggest a workaround?  I
nik> can't just return i, since i != yytoknum[i], and it's the
nik> token number that I need to return from the lexical rules.

akim> Could be more specific?  Like giving a simple test case,
akim> the type of error etc.

Unfortunately I can't, because the program doesn't compile.  If I #define
YYPRINT somewhere (and therefore cause yytoknum to be defined), I still get
the empty switch stmt warnings but the program compiles and works correctly.


Take care,

Nik





reply via email to

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