Turning on debug mode for a parser generated by the yacc command

You can access the debugging code either by invoking the yacc command with the -t option or compiling the y.tab.c file with -DYYDEBUG.

For normal operation, the yydebug external integer variable is set to 0. However, if you set it to a nonzero value, the parser generates a description of the input tokens it receives and actions it takes for each token while parsing an input stream.

Set this variable in one of the following ways:

  • Put the following C language statement in the declarations section of the yacc grammar file:
    int yydebug = 1;
  • Use the dbx program to execute the final parser, and set the variable ON or OFF using dbx commands.