home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / OS2-YACC.ZIP / YHDPRD.3C < prev    next >
Text File  |  1989-09-30  |  1KB  |  48 lines

  1. /*
  2.   HEADER: CUG     nnn.nn;
  3.   TITLE:     YACC - Yet Another Compilier-Compilier
  4.   VERSION:     1.0 for IBM-PC
  5.   DATE:      JAN 28, 1985
  6.   DESCRIPTION:     LALR(1) Parser Generator. From UNIX
  7.   KEYWORDS:     Parser Generator Compilier-Compilier YACC
  8.   SYSTEM:     IBM-PC and Compatiables
  9.   FILENAME:      YHDPRD.3C
  10.   WARNINGS:     This program is not for the casual user. It will
  11.          be useful primarily to expert developers.
  12.   CRC:         N/A
  13.   SEE-ALSO:     LEX and PREP
  14.   AUTHORS:     Scott Guthery 11100 leafwood lane Austin, TX 78750
  15.   COMPILERS:     DESMET-C
  16.   REFERENCES:     UNIX Systems Manuals
  17. */
  18.  
  19. #include "y1.h"
  20. #include "y3.h"
  21.  
  22. void hideprod( void )
  23.    {
  24.    /* in order to free up the mem and amem arrays for the optimizer,
  25.         /* and still be able to output yyr1, etc., after the sizes of
  26.         /* the action array is known, we hide the nonterminals
  27.         /* derived by productions in levprd.
  28.         */
  29.  
  30.    register i, j;
  31.  
  32.    j = 0;
  33.    levprd[0] = 0;
  34.    PLOOP(1,i)
  35.       {
  36.       if( !(levprd[i] & REDFLAG) )
  37.          {
  38.          ++j;
  39.          if( foutput != NULL )
  40.             {
  41.             fprintf( foutput, "Rule not reduced:   %s\n", writem( prdptr[i] ) );
  42.             }
  43.          }
  44.       levprd[i] = *prdptr[i] - NTBASE;
  45.       }
  46.    if( j ) fprintf( stdout, "%d rules never reduced\n", j );
  47.    }
  48.