1: /*
   2:  * Copyright (c) 1979 Regents of the University of California.
   3:  * All rights reserved.  The Berkeley software License Agreement
   4:  * specifies the terms and conditions for redistribution.
   5:  */
   6: 
   7: #ifndef lint
   8: char copyright[] =
   9: "@(#) Copyright (c) 1980 Regents of the University of California.\n\
  10:  All rights reserved.\n";
  11: #endif not lint
  12: 
  13: #ifndef lint
  14: static char sccsid[] = "@(#)ey0.c	5.1 (Berkeley) 4/29/85";
  15: #endif not lint
  16: 
  17: #include <stdio.h>
  18: # define _actsize 2500
  19: # define _memsize 3000
  20: # define _nstates 700
  21: # define _nterms 95
  22: # define _nprod 300
  23: # define _nnonterm 150
  24: # define _tempsize 700
  25: # define _cnamsz 3500
  26: # define _lsetsize 600
  27: # define _wsetsize 400
  28: # define _maxlastate 100
  29: 
  30: # define _tbitset 6
  31: 
  32: int tbitset;  /* size of lookahed sets */
  33: int nolook = 0; /* flag to suppress lookahead computations */
  34: struct looksets { int lset[ _tbitset ]; } ;
  35: struct item { int *pitem; } ;
  36: 
  37: /* this file contains the definitions for most externally known data */
  38: 
  39: int nstate = 0;     /* number of states */
  40: struct item *pstate[_nstates];  /* pointers to the descriptions of the states */
  41: int apstate[_nstates];  /* index to the actions for the states */
  42: int tystate[_nstates];  /* contains type information about the states */
  43: int stsize = _nstates;  /* maximum number of states, at present */
  44: int memsiz = _memsize;  /* maximum size for productions and states */
  45: int mem0[_memsize] ; /* production storage */
  46: int *mem = mem0;
  47: int amem[_actsize];  /* action table storage */
  48: int actsiz = _actsize; /* action table size */
  49: int memact = 0;     /* next free action table position */
  50: int nprod = 1;  /* number of productions */
  51: int *prdptr[_nprod];    /* pointers to descriptions of productions */
  52: int prdlim = _nprod ;  /* the maximum number of productions */
  53:     /* levprd - productions levels to break conflicts */
  54: int levprd[_nprod] = {0,0};
  55:   /* last two bits code associativity:
  56:        0 = no definition
  57:        1 = left associative
  58:        2 = binary
  59:        3 = right associative
  60:      bit 04 is 1 if the production has an action
  61:      the high 13 bits have the production level
  62:      */
  63: int nterms = 0; /* number of terminals */
  64: int tlim = _nterms ; /* the maximum number of terminals */
  65: /*	the ascii representations of the terminals	*/
  66: int extval = 0;  /* start of output values */
  67: struct sxxx1 {char *name; int value;} trmset[_nterms];
  68: char cnames[_cnamsz];
  69: int cnamsz = _cnamsz;
  70: char *cnamp;
  71: int maxtmp = _tempsize; /* the size of the temp1 array */
  72: int temp1[_tempsize]; /* temporary storage, indexed by terms + nterms or states */
  73: int temp2[_nnonterm]; /* temporary storage indexed by nonterminals */
  74: int trmlev[_nterms];    /* vector with the precedence of the terminals */
  75:   /* The levels are the same as for levprd, but bit 04 is always 0 */
  76: /* the ascii representations of the nonterminals */
  77: struct sxxx2 { char *name; } nontrst[_nnonterm];
  78: int ntlim = _nnonterm ; /* limit to the number of nonterminals */
  79: int indgo[_nstates];        /* index to the stored goto table */
  80: int ***pres; /* vector of pointers to the productions yielding each nonterminal */
  81: struct looksets **pfirst; /* vector of pointers to first sets for each nonterminal */
  82: int *pempty = 0 ; /* table of nonterminals nontrivially deriving e */
  83: int nnonter = -1;   /* the number of nonterminals */
  84: int lastred = 0;    /* the number of the last reduction of a state */
  85: FILE *ftable;       /* y.tab.c file */
  86: FILE *foutput;      /* y.output file */
  87: FILE *cout = stdout;
  88: int arrndx; /* used in the output of arrays on y.tab.c */
  89: int zzcwset = 0;
  90: int zzpairs = 0;
  91: int zzgoent = 0;
  92: int zzgobest = 0;
  93: int zzacent = 0;
  94: int zzacsave = 0;
  95: int zznsave = 0;
  96: int zzclose = 0;
  97: int zzsrconf = 0;
  98: int zzrrconf = 0;
  99: char *ctokn;
 100: int lineno  = 1; /* current input line number */
 101: int peekc = -1; /* look-ahead character */
 102: int tstates[ _nterms ]; /* states generated by terminal gotos */
 103: int ntstates[ _nnonterm ]; /* states generated by nonterminal gotos */
 104: int mstates[ _nstates ]; /* chain of overflows of term/nonterm generation lists  */
 105: 
 106: struct looksets clset;
 107: struct looksets lkst [ _lsetsize ];
 108: int nlset = 0; /* next lookahead set index */
 109: int lsetsz = _lsetsize; /* number of lookahead sets */
 110: 
 111: struct wset { int *pitem, flag, ws[_tbitset]; } wsets[ _wsetsize ];
 112: int cwset;
 113: int wssize = _wsetsize;
 114: int lambdarule = 0;
 115: 
 116: char stateflags[ _nstates ];
 117: unsigned char lookstate[ _nstates ];
 118: struct looksets lastate[ _maxlastate ];
 119: int maxlastate = _maxlastate;
 120: int savedlook = 1;
 121: 
 122: int numbval;  /* the value of an input number */
 123: int rflag = 0;  /* ratfor flag */
 124: int oflag = 0;  /* optimization flag */
 125: 
 126: int ndefout = 3;  /* number of defined symbols output */
 127: int nerrors = 0;    /* number of errors */
 128: int fatfl = 1;      /* if on, error is fatal */
 129: int machine;   /* has a number describing the machine */

Defined variables

amem defined in line 47; used 8 times
arrndx defined in line 88; used 2 times
clset defined in line 106; used 12 times
cnames defined in line 68; used 2 times
cnamp defined in line 70; used 7 times
cnamsz defined in line 69; used 1 times
copyright defined in line 8; never used
ctokn defined in line 99; used 32 times
cwset defined in line 112; used 22 times
extval defined in line 66; used 2 times
lastate defined in line 118; used 2 times
lastred defined in line 84; used 16 times
lkst defined in line 107; used 4 times
lookstate defined in line 117; used 3 times
machine defined in line 129; used 4 times
maxlastate defined in line 119; used 2 times
maxtmp defined in line 71; never used
mstates defined in line 104; used 3 times
ndefout defined in line 126; used 3 times
ntstates defined in line 103; used 3 times
numbval defined in line 122; used 4 times
peekc defined in line 101; used 16 times
pempty defined in line 82; used 11 times
pfirst defined in line 81; used 4 times
prdlim defined in line 52; used 1 times
pres defined in line 80; used 10 times
pstate defined in line 40; used 26 times
sccsid defined in line 14; never used
stateflags defined in line 116; used 9 times
temp1 defined in line 72; used 40 times
temp2 defined in line 73; used 2 times
tstates defined in line 102; used 3 times
tystate defined in line 42; used 28 times
wsets defined in line 111; used 40 times
zzpairs defined in line 90; never used

Defined struct's

item defined in line 35; used 2 times
  • in line 40(2)
looksets defined in line 34; used 8 times
sxxx1 defined in line 67; never used
sxxx2 defined in line 77; never used
wset defined in line 111; never used

Defined macros

_actsize defined in line 18; used 2 times
_cnamsz defined in line 25; used 2 times
_lsetsize defined in line 26; used 2 times
_maxlastate defined in line 28; used 2 times
_memsize defined in line 19; used 2 times
_nnonterm defined in line 23; used 4 times
_nprod defined in line 22; used 3 times
_nstates defined in line 20; used 8 times
_nterms defined in line 21; used 4 times
_tbitset defined in line 30; used 2 times
_tempsize defined in line 24; used 2 times
_wsetsize defined in line 27; used 2 times
Last modified: 1985-04-30
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 3889
Valid CSS Valid XHTML 1.0 Strict