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