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
clset
defined in line
106; used 12 times
cnamp
defined in line
70; used 7 times
ctokn
defined in line
99; used 32 times
cwset
defined in line
112; used 22 times
indgo
defined in line
79; used 2 times
lkst
defined in line
107; used 4 times
mem
defined in line
46; used 26 times
mem0
defined in line
45; used 5 times
nnonter
defined in line
83; used 24 times
- in /usr/src/ucb/PORT/pascal/eyacc/ey1.c line
209,
215-221(3)
- in /usr/src/ucb/PORT/pascal/eyacc/ey2.c line
211-213(3),
413
- in /usr/src/ucb/PORT/pascal/eyacc/ey3.c line
16-17(2),
40-41(2),
60,
71-74(2),
171-172(2),
218,
247,
253
- in /usr/src/ucb/PORT/pascal/eyacc/ey4.c line
177,
229,
242,
266
nprod
defined in line
50; used 16 times
nstate
defined in line
39; used 30 times
- in /usr/src/ucb/PORT/pascal/eyacc/ey1.c line
210,
222-229(3)
- in /usr/src/ucb/PORT/pascal/eyacc/ey3.c line
86-87(2),
115(2),
129-140(8),
150-154(3),
161,
200-205(2),
214
- in /usr/src/ucb/PORT/pascal/eyacc/ey4.c line
20,
100,
187,
196,
208,
272-275(2)
nterms
defined in line
63; used 38 times
- in /usr/src/ucb/PORT/pascal/eyacc/ey1.c line
83,
208-212(2),
220,
325
- in /usr/src/ucb/PORT/pascal/eyacc/ey2.c line
216-230(10),
237-246(5),
255,
276,
408
- in /usr/src/ucb/PORT/pascal/eyacc/ey3.c line
218,
239-253(6)
- in /usr/src/ucb/PORT/pascal/eyacc/ey4.c line
24,
39,
125,
320,
327,
338,
440,
474
ntlim
defined in line
78; used 3 times
peekc
defined in line
101; used 16 times
pempty
defined in line
82; used 11 times
prdptr
defined in line
51; used 19 times
pres
defined in line
80; used 10 times
pstate
defined in line
40; used 26 times
- in /usr/src/ucb/PORT/pascal/eyacc/ey1.c line
224
- in /usr/src/ucb/PORT/pascal/eyacc/ey3.c line
86-87(2),
104-105(2),
115(2),
129,
153-154(2),
161,
201-206(4),
228(2),
275-277(2)
- in /usr/src/ucb/PORT/pascal/eyacc/ey4.c line
276-277(2),
347-348(2),
373,
464-465(2)
rflag
defined in line
123; used 12 times
temp1
defined in line
72; used 40 times
- in /usr/src/ucb/PORT/pascal/eyacc/ey3.c line
218,
238-239(2),
245-253(6)
- in /usr/src/ucb/PORT/pascal/eyacc/ey4.c line
24-30(4),
41-46(6),
57,
66-71(2),
102-107(2),
242-243(2),
250-254(3),
266,
279,
318-328(5),
338(2),
441,
474
temp2
defined in line
73; used 2 times
tlim
defined in line
64; used 3 times
trmset
defined in line
67; used 23 times
tystate
defined in line
42; used 28 times
- in /usr/src/ucb/PORT/pascal/eyacc/ey3.c line
120,
139,
204,
216-217(2),
228(2)
- in /usr/src/ucb/PORT/pascal/eyacc/ey4.c line
21,
101-107(3),
188-196(4),
209-211(3),
272,
280-285(3),
403-404(2),
416,
454,
469-470(2)
wsets
defined in line
111; used 40 times
- in /usr/src/ucb/PORT/pascal/eyacc/ey3.c line
42-47(2),
64(3),
71,
222-224(3),
233-235(4),
278-280(3),
292-297(3),
308-309(3),
324,
337-341(4),
348-349(2),
357,
373-376(4)
- in /usr/src/ucb/PORT/pascal/eyacc/ey4.c line
26,
36-40(2),
61,
393,
434
Defined struct's
item
defined in line
35; used 2 times
sxxx1
defined in line
67;
never used
sxxx2
defined in line
77;
never used
wset
defined in line
111;
never used
Defined macros