[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: yacc2bison: int/int * confusion causes segfault
From: |
Tom Jones |
Subject: |
RE: yacc2bison: int/int * confusion causes segfault |
Date: |
Mon, 26 Mar 2007 17:35:00 -0700 |
Turns out there was a name collision - the orginal author never
envisaged that bison would use the name 'yytoken'. Fixed it. ~Tom
-----Original Message-----
From: address@hidden
[mailto:address@hidden On Behalf Of Tom
Jones
Sent: Monday, March 26, 2007 10:12 AM
To: address@hidden
Subject: yacc2bison: int/int * confusion causes segfault
Hello,
I am a neophyte trying to convert a yacc grammar to bison. The grammar
in question runs fine with yacc but my requirements are to be able to
run under linux and/or cygwinix - I'd rather fix the grammar for bison
than try to find a yacc executable for win32.
Anyway, I had some initial problems getting YYSTYPE properly defined for
yylval - perhaps they're not completely resolved. YYSTYPE is a union
here but defined in a two stage process. To get past the compiler
errors I merely #defined YYSTYPE right after the union declaration
inside the .h file that defines the union.
If I run the resultant parser I get a segfault but the compiler warnings
are a pretty good clue to what's happening:
warning: passing arg 1 of `stricmp' makes pointer from integer
without a cast
What's happening is bison is creating an 'int yytoken' - however, the
hand-rolled lexical analyzer already declared a char *yytoken (it's
actually a fixed array). If I comment out the "int yytoken" it compiles
with fewer warnings but there is clearly a cognitive dissonance here.
Any help on this matter would be greatly appreciated.
~Tom
_______________________________________________
address@hidden http://lists.gnu.org/mailman/listinfo/help-bison