home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / INFO / C / YACCUNX.ZIP / YCPRES.1C < prev    next >
Encoding:
Text File  |  1983-12-23  |  954 b   |  40 lines

  1. #include "y1.h"
  2. /*
  3.  * 12-Apr-83 (RBD) Add symbolic exit status
  4.  */
  5. extern int * pyield[NPROD];
  6.  
  7. cpres()
  8.    {
  9.    /* compute an array with the beginnings of  productions yielding given nonterminals
  10.         The array pres points to these lists */
  11.    /* the array pyield has the lists: the total size is only NPROD+1 */
  12.    register **pmem;
  13.    register c, j, i;
  14.  
  15.    pmem = pyield;
  16.  
  17.    NTLOOP(i)
  18.       {
  19.       c = i+NTBASE;
  20.       pres[i] = pmem;
  21.       fatfl = 0;  /* make undefined  symbols  nonfatal */
  22.       PLOOP(0,j)
  23.          {
  24.          if (*prdptr[j] == c) *pmem++ =  prdptr[j]+1;
  25.          }
  26.       if(pres[i] == pmem)
  27.          {
  28.          error("nonterminal %s not defined!", nontrst[i].name);
  29.          }
  30.       }
  31.    pres[i] = pmem;
  32.    fatfl = 1;
  33.    if( nerrors )
  34.       {
  35.       summary();
  36.       exit(EX_ERR);
  37.       }
  38.    if( pmem != &pyield[nprod] ) error( "internal Yacc error: pyield %d", pmem-&pyield[nprod] );
  39.    }
  40.