home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / OS2-YACC.ZIP / Y1IMP.C < prev    next >
C/C++ Source or Header  |  1980-01-04  |  3KB  |  83 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:      Y1IMP.C
  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. /* Impure data used by modules originally in Y1.C. External declarations in Y1.H */
  20.  
  21. #define y1imp yes
  22. #include "dtxtrn.h"
  23.  
  24. /* lookahead computations */
  25.  
  26. int tbitset;  /* size of lookahead sets */
  27. struct looksets lkst [ LSETSIZE ];
  28. int nlset = 0; /* next lookahead set index */
  29. int nolook = 0; /* flag to suppress lookahead computations */
  30. struct looksets clset;  /* temporary storage for lookahead computations */
  31.  
  32. /* working set computations */
  33.  
  34. struct wset wsets[ WSETSIZE ];
  35. struct wset *cwp;
  36.  
  37. /* state information */
  38.  
  39. int nstate = 0;         /* number of states */
  40. struct item *pstate[NSTATES+2]; /* pointers to the descriptions of the states */
  41. int tystate[NSTATES];   /* contains type information about the states */
  42. int indgo[NSTATES];             /* index to the stored goto table */
  43. int tstates[ NTERMS ]; /* states generated by terminal gotos */
  44. int ntstates[ NNONTERM ]; /* states generated by nonterminal gotos */
  45. int mstates[ NSTATES ]; /* chain of overflows of term/nonterm generation lists  */
  46.  
  47. /* storage for the actions in the parser */
  48.  
  49. int amem[ACTSIZE];      /* action table storage */
  50. int *memp = amem;       /* next free action table position */
  51.  
  52. /* other storage areas */
  53.  
  54. int temp1[TEMPSIZE]; /* temporary storage, indexed by terms + ntokens or states */
  55. int lineno= 1; /* current input line number */
  56. int fatfl = 1;          /* if on, error is fatal */
  57. int nerrors = 0;        /* number of errors */
  58.  
  59. /* storage for information about the nonterminals */
  60.  
  61. int **pres[NNONTERM+2];  /* vector of pointers to productions yielding each nonterminal */
  62. struct looksets *pfirst[NNONTERM+2];  /* vector of pointers to first sets for each nonterminal */
  63. int pempty[NNONTERM+1];  /* vector of nonterminals nontrivially deriving e */
  64.  
  65. /* accumulators for statistics information */
  66.  
  67. struct wset *zzcwp = wsets;
  68. int zzgoent = 0;
  69. int zzgobest = 0;
  70. int zzacent = 0;
  71. int zzexcp = 0;
  72. int zzclose = 0;
  73. int zzsrconf = 0;
  74. int * zzmemsz = mem0;
  75. int zzrrconf = 0;
  76.  
  77. /* data pulled from internal static to here */
  78. /* declared external only in user module    */
  79.  
  80. int *pyield[NPROD];             /* from ycpres */
  81. char sarr[ISIZE];               /* from ywritm */
  82.  
  83.