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