1: # include <stdio.h>
   2: # include <ctype.h>
   3: # include "files"
   4: 
   5:     /*  MANIFEST CONSTANT DEFINITIONS */
   6: 
   7:     /* base of nonterminal internal numbers */
   8: # define NTBASE 010000
   9: 
  10:     /* internal codes for error and accept actions */
  11: 
  12: # define ERRCODE  8190
  13: # define ACCEPTCODE 8191
  14: 
  15:     /* sizes and limits */
  16: 
  17: # ifdef HUGE
  18: # define ACTSIZE 12000
  19: # define MEMSIZE 12000
  20: # define NSTATES 750
  21: # define NTERMS 127
  22: # define NPROD 600
  23: # define NNONTERM 300
  24: # define TEMPSIZE 1200
  25: # define CNAMSZ 5000
  26: # define LSETSIZE 600
  27: # define WSETSIZE 350
  28: # endif
  29: 
  30: # ifdef MEDIUM
  31: # define ACTSIZE 4000
  32: # define MEMSIZE 5200
  33: # define NSTATES 600
  34: # define NTERMS 127
  35: # define NPROD 400
  36: # define NNONTERM 200
  37: # define TEMPSIZE 800
  38: # define CNAMSZ 4000
  39: # define LSETSIZE 450
  40: # define WSETSIZE 250
  41: # endif
  42: 
  43: # define NAMESIZE 50
  44: # define NTYPES 63
  45: 
  46: # ifdef WORD32
  47: # define TBITSET ((32+NTERMS)/32)
  48: 
  49:     /* bit packing macros (may be machine dependent) */
  50: # define BIT(a,i) ((a)[(i)>>5] & (1<<((i)&037)))
  51: # define SETBIT(a,i) ((a)[(i)>>5] |= (1<<((i)&037)))
  52: 
  53:     /* number of words needed to hold n+1 bits */
  54: # define NWORDS(n) (((n)+32)/32)
  55: 
  56: # else
  57: 
  58: # define TBITSET ((16+NTERMS)/16)
  59: 
  60:     /* bit packing macros (may be machine dependent) */
  61: # define BIT(a,i) ((a)[(i)>>4] & (1<<((i)&017)))
  62: # define SETBIT(a,i) ((a)[(i)>>4] |= (1<<((i)&017)))
  63: 
  64:     /* number of words needed to hold n+1 bits */
  65: # define NWORDS(n) (((n)+16)/16)
  66: # endif
  67: 
  68:     /* relationships which must hold:
  69: 	TBITSET ints must hold NTERMS+1 bits...
  70: 	WSETSIZE >= NNONTERM
  71: 	LSETSIZE >= NNONTERM
  72: 	TEMPSIZE >= NTERMS + NNONTERMs + 1
  73: 	TEMPSIZE >= NSTATES
  74: 	*/
  75: 
  76:     /* associativities */
  77: 
  78: # define NOASC 0  /* no assoc. */
  79: # define LASC 1  /* left assoc. */
  80: # define RASC 2  /* right assoc. */
  81: # define BASC 3  /* binary assoc. */
  82: 
  83:     /* flags for state generation */
  84: 
  85: # define DONE 0
  86: # define MUSTDO 1
  87: # define MUSTLOOKAHEAD 2
  88: 
  89:     /* flags for a rule having an action, and being reduced */
  90: 
  91: # define ACTFLAG 04
  92: # define REDFLAG 010
  93: 
  94:     /* output parser flags */
  95: # define YYFLAG1 (-1000)
  96: 
  97:     /* macros for getting associativity and precedence levels */
  98: 
  99: # define ASSOC(i) ((i)&03)
 100: # define PLEVEL(i) (((i)>>4)&077)
 101: # define TYPE(i)  ((i>>10)&077)
 102: 
 103:     /* macros for setting associativity and precedence levels */
 104: 
 105: # define SETASC(i,j) i|=j
 106: # define SETPLEV(i,j) i |= (j<<4)
 107: # define SETTYPE(i,j) i |= (j<<10)
 108: 
 109:     /* looping macros */
 110: 
 111: # define TLOOP(i) for(i=1;i<=ntokens;++i)
 112: # define NTLOOP(i) for(i=0;i<=nnonter;++i)
 113: # define PLOOP(s,i) for(i=s;i<nprod;++i)
 114: # define SLOOP(i) for(i=0;i<nstate;++i)
 115: # define WSBUMP(x) ++x
 116: # define WSLOOP(s,j) for(j=s;j<cwp;++j)
 117: # define ITMLOOP(i,p,q) q=pstate[i+1];for(p=pstate[i];p<q;++p)
 118: # define SETLOOP(i) for(i=0;i<tbitset;++i)
 119: 
 120:     /* I/O descriptors */
 121: 
 122: extern FILE * finput;       /* input file */
 123: extern FILE * faction;      /* file for saving actions */
 124: extern FILE *fdefine;       /* file for # defines */
 125: extern FILE * ftable;       /* y.tab.c file */
 126: extern FILE * ftemp;        /* tempfile to pass 2 */
 127: extern FILE * foutput;      /* y.output file */
 128: 
 129:     /* structure declarations */
 130: 
 131: struct looksets {
 132:     int lset[TBITSET];
 133:     };
 134: 
 135: struct item {
 136:     int *pitem;
 137:     struct looksets *look;
 138:     };
 139: 
 140: struct toksymb {
 141:     char *name;
 142:     int value;
 143:     };
 144: 
 145: struct ntsymb {
 146:     char *name;
 147:     int tvalue;
 148:     };
 149: 
 150: struct wset {
 151:     int *pitem;
 152:     int flag;
 153:     struct looksets ws;
 154:     };
 155: 
 156:     /* token information */
 157: 
 158: extern int ntokens ;    /* number of tokens */
 159: extern struct toksymb tokset[];
 160: extern int toklev[];    /* vector with the precedence of the terminals */
 161: 
 162:     /* nonterminal information */
 163: 
 164: extern int nnonter ;    /* the number of nonterminals */
 165: extern struct ntsymb nontrst[];
 166: 
 167:     /* grammar rule information */
 168: 
 169: extern int nprod ;  /* number of productions */
 170: extern int *prdptr[];   /* pointers to descriptions of productions */
 171: extern int levprd[] ;   /* contains production levels to break conflicts */
 172: 
 173:     /* state information */
 174: 
 175: extern int nstate ;     /* number of states */
 176: extern struct item *pstate[];   /* pointers to the descriptions of the states */
 177: extern int tystate[];   /* contains type information about the states */
 178: extern int defact[];    /* the default action of the state */
 179: extern int tstates[];   /* the states deriving each token */
 180: extern int ntstates[];  /* the states deriving each nonterminal */
 181: extern int mstates[];   /* the continuation of the chains begun in tstates and ntstates */
 182: 
 183:     /* lookahead set information */
 184: 
 185: extern struct looksets lkst[];
 186: extern int nolook;  /* flag to turn off lookahead computations */
 187: 
 188:     /* working set information */
 189: 
 190: extern struct wset wsets[];
 191: extern struct wset *cwp;
 192: 
 193:     /* storage for productions */
 194: 
 195: extern int mem0[];
 196: extern int *mem;
 197: 
 198:     /* storage for action table */
 199: 
 200: extern int amem[];  /* action table storage */
 201: extern int *memp ;      /* next free action table position */
 202: extern int indgo[];     /* index to the stored goto table */
 203: 
 204:     /* temporary vector, indexable by states, terms, or ntokens */
 205: 
 206: extern int temp1[];
 207: extern int lineno; /* current line number */
 208: 
 209:     /* statistics collection variables */
 210: 
 211: extern int zzgoent ;
 212: extern int zzgobest ;
 213: extern int zzacent ;
 214: extern int zzexcp ;
 215: extern int zzclose ;
 216: extern int zzrrconf ;
 217: extern int zzsrconf ;
 218:     /* define functions with strange types... */
 219: 
 220: extern char *cstash();
 221: extern struct looksets *flset();
 222: extern char *symnam();
 223: extern char *writem();
 224: 
 225:     /* default settings for a number of macros */
 226: 
 227:     /* name of yacc tempfiles */
 228: 
 229: # ifndef TEMPNAME
 230: # define TEMPNAME "yacc.tmp"
 231: # endif
 232: 
 233: # ifndef ACTNAME
 234: # define ACTNAME "yacc.acts"
 235: # endif
 236: 
 237:     /* output file name */
 238: 
 239: # ifndef OFILE
 240: # define OFILE "y.tab.c"
 241: # endif
 242: 
 243:     /* user output file name */
 244: 
 245: # ifndef FILEU
 246: # define FILEU "y.output"
 247: # endif
 248: 
 249:     /* output file for # defines */
 250: 
 251: # ifndef FILED
 252: # define FILED "y.tab.h"
 253: # endif
 254: 
 255:     /* command to clobber tempfiles after use */
 256: 
 257: # ifndef ZAPFILE
 258: # define ZAPFILE(x) unlink(x)
 259: # endif

Defined struct's

item defined in line 135; used 18 times
looksets defined in line 131; used 28 times
ntsymb defined in line 145; used 4 times
toksymb defined in line 140; used 4 times
wset defined in line 150; used 18 times

Defined macros

ACCEPTCODE defined in line 13; used 3 times
ACTFLAG defined in line 91; used 4 times
ACTNAME defined in line 234; used 4 times
ACTSIZE defined in line 31; used 11 times
ASSOC defined in line 99; used 2 times
BASC defined in line 81; never used
BIT defined in line 61; used 2 times
CNAMSZ defined in line 38; used 2 times
DONE defined in line 85; used 1 times
ERRCODE defined in line 12; used 3 times
FILED defined in line 252; used 2 times
FILEU defined in line 246; used 2 times
ITMLOOP defined in line 117; used 3 times
LASC defined in line 79; used 1 times
LSETSIZE defined in line 39; used 3 times
MEMSIZE defined in line 32; used 5 times
MUSTDO defined in line 86; used 4 times
MUSTLOOKAHEAD defined in line 87; used 3 times
NAMESIZE defined in line 43; used 5 times
NNONTERM defined in line 36; used 8 times
NOASC defined in line 78; never used
NPROD defined in line 35; used 8 times
NSTATES defined in line 33; used 7 times
NTBASE defined in line 8; used 55 times
NTERMS defined in line 34; used 8 times
NTLOOP defined in line 112; used 10 times
NTYPES defined in line 44; used 1 times
NWORDS defined in line 65; used 1 times
OFILE defined in line 240; used 2 times
PLEVEL defined in line 100; used 6 times
PLOOP defined in line 113; used 6 times
RASC defined in line 80; used 1 times
REDFLAG defined in line 92; used 2 times
SETASC defined in line 105; used 1 times
SETBIT defined in line 62; used 2 times
SETLOOP defined in line 118; used 5 times
SETPLEV defined in line 106; used 1 times
SETTYPE defined in line 107; used 2 times
SLOOP defined in line 114; used 3 times
TBITSET defined in line 58; used 1 times
TEMPNAME defined in line 230; used 4 times
TEMPSIZE defined in line 37; used 1 times
TLOOP defined in line 111; used 9 times
TYPE defined in line 101; used 4 times
WSBUMP defined in line 115; used 2 times
WSETSIZE defined in line 40; used 3 times
WSLOOP defined in line 116; used 10 times
YYFLAG1 defined in line 95; used 1 times
ZAPFILE defined in line 258; used 3 times

Usage of this include

Last modified: 1979-01-10
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 1044
Valid CSS Valid XHTML 1.0 Strict