bug-bison
[Top][All Lists]
Advanced

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

Re: Bug repor for bison


From: Akim Demaille
Subject: Re: Bug repor for bison
Date: 15 Nov 2000 18:36:03 +0100
User-agent: Gnus/5.0807 (Gnus v5.8.7) XEmacs/21.1 (Channel Islands)

>>>>> "Vikrant" == Vikrant  <address@hidden> writes:

Vikrant> Hello,

Vikrant>  

Vikrant> We just figured that there is a bug with YYPRINT and
Vikrant> YYDEBUG. We defined YYDEBUG which bison also defined in side
Vikrant> on C code. After that we checked it once again check for
Vikrant> yydebug value which has not been initialized to 1. Condition
Vikrant> fails on linux - bison version 1.28 because it may take
Vikrant> random value when you define it.

Read the documentation: it is up to *you* to set yydebug.

Vikrant> YYPRINT is not documented. 

What documentation are you referring to?

Debugging Your Parser
*********************

[CUT]

   The debugging information normally gives the token type of each token
read, but not its semantic value.  You can optionally define a macro
named `YYPRINT' to provide a way to print the value.  If you define
`YYPRINT', it should take three arguments.  The parser will pass a
standard I/O stream, the numeric code for the token type, and the token
value (from `yylval').

   Here is an example of `YYPRINT' suitable for the multi-function
calculator (*note Declarations for `mfcalc': Mfcalc Decl.):

     #define YYPRINT(file, type, value)   yyprint (file, type, value)
     
     static void
     yyprint (file, type, value)
          FILE *file;
          int type;
          YYSTYPE value;
     {
       if (type == VAR)
         fprintf (file, " %s", value.tptr->name);
       else if (type == NUM)
         fprintf (file, " %d", value.val);
     }


Vikrant> Moreover we saw lines like follows in bison generated code.

Vikrant>  

Vikrant> #ifdef YYPRINT

Vikrant>       YYPRINT(stderr, yychar, yylval);

Vikrant> #endif

Vikrant>  

Vikrant> Could you please explain what it does.

It runs YYPRINT only when defined.



reply via email to

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