yydebug in 4.2BSD yaccpar

stanonik at nprdc stanonik at nprdc
Thu Feb 21 06:51:05 AEST 1985


The value of yychar displayed with yydebug enabled is almost
always -1 due to yychar being discarded shortly after shifting.  
The devious logic of yaccpar defeated efforts to fix the display 
of yychar with yystate, so instead yaccpar was changed to display 
yychar while shifting and reducing.  Along the way an assignment 
was found which never seemed to be used.

Ron Stanonik
stanonik at nprdc

RCS file: RCS/yaccpar,v
retrieving revision 1.1
diff  -r1.1 yaccpar
40c40
< 	if( yydebug  ) printf( "state %d, char 0%o\n", yystate, yychar );
---
> 	if( yydebug  ) printf( "state %d\n", yystate );
56a57,59
> #ifdef YYDEBUG
> 	if( yydebug  ) printf( "shift %d\n", yychar );
> #endif
103d105
< 			   yyn = yypact[*yyps];
137c139
< 		if( yydebug ) printf("reduce %d\n",yyn);
---
> 		if( yydebug ) printf("reduce %d, token\n", yyn, yychar);



More information about the Comp.unix.wizards mailing list