Xref: news2.mv.net comp.os.msdos.djgpp:3723 From: John Bodfish Newsgroups: comp.os.msdos.djgpp Subject: Re: Problems with BISON Date: Thu, 09 May 96 18:09:07 PDT Organization: Northwestern University, Evanston, IL, US Lines: 52 Message-ID: References: <4mt50i$jba AT newsbf02 DOT news DOT aol DOT com> NNTP-Posting-Host: n472.als.ameritech.com Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp In article <4mt50i$jba AT newsbf02 DOT news DOT aol DOT com>, writes: > I wrote a small parser and wanted BISON to work in debug mode. > I therefore defined the following: > > %{ > > ..... > #define YYDEBUG 1 > > %} > > Bison was also invoked with option -t. > > The problem is that I do not see any debug information. I do not see > any states at all. > The info for bison says: "Once you have compiled the program with trace facilities, the way to request a trace is to store a nonzero value in the variable `yydebug'. You can do this by making the C code do it (in `main', perhaps), or you can alter the value with a C debugger." I have the following in my *.y file, in place of your #define: #ifdef DEBUG #define YYERROR_VERBOSE #endif and in main(): #ifdef DEBUG yydebug = 1; #endif Finally I use the --debug option (and the -v option is helpful; again, consult the info file) on the bison command line (which causes bison to emit a definition for YYDEBUG) and I define DEBUG on the compiler command line with "-DDEBUG". This seems to work fine; here's the kind of trace info I get: Starting parse Entering state 0 Reading a token: --(end of buffer or a NUL) --accepting rule at line 255 ("; This is file DOUTILS.ASM ") Next token is 264 (COMMENT) John