|
|
1.1 root 1: /* static char *sccsid = "@(#)ey.h 4.2 (Berkeley) 8/30/82"; */
2: /* (c) 1979 Regents of the University of California */
3: #include <stdio.h>
4: /* MANIFEST CONSTANT DEFINITIONS */
5:
6: # define NTBASE 010000
7:
8: /* internal codes for error and accept actions */
9:
10: # define ERRCODE 8190
11: # define ACCEPTCODE 8191
12:
13: # define errfileno stderr /* file number for erros and reduction message */
14: # define _tbitset 6 /* 16*_tbitset - 1 >= _nterms */
15:
16: extern int tbitset; /* number of wds of lookahead vector */
17: extern int nolook; /* flag to turn off lookahed computations */
18: struct looksets { int lset[ _tbitset ]; } ;
19: struct item { int *pitem; struct looksets *look; } ;
20:
21: /* output actions */
22:
23: # define ERRACT 4096
24: # define SHIFTACT 8192
25: # define REDUCACT 12288
26: # define ACCEPTACT 16384
27:
28: # define _REGISTER register
29:
30: extern int nstate ; /* number of states */
31: extern struct item *pstate[]; /* pointers to the descriptions of the states */
32: extern int apstate[]; /* index to actions in amem by state */
33: extern int actsiz; /* size of the action table array */
34: extern int tystate[]; /* contains type information about the states */
35: /* 0 = simple state, completely generated
36: 1 = state awaiting generation
37: 2 = state with an empty production in closure
38: */
39: extern int stsize ; /* maximum number of states, at present */
40: extern int memsiz ; /* maximum size for productions and states */
41: extern int mem0[] ; /* added production */
42: extern int *mem ;
43: extern int amem[]; /* action table storage */
44: extern int actsiz; /* action table size */
45: extern int memact ; /* next free action table position */
46: extern int nprod ; /* number of productions */
47: extern int *prdptr[]; /* pointers to descriptions of productions */
48: extern int prdlim; /* the number of productions allowed */
49: extern int levprd[] ; /* contains production levels to break conflicts */
50: /* last two bits code associativity:
51: 0 = no definition
52: 1 = left associative
53: 2 = binary
54: 3 = right associative
55: bit 04 is 1 if the production has an action
56: the high 13 bits have the production level
57: */
58: extern int nterms ; /* number of terminals */
59: extern int nerrors; /* number of errors */
60: extern int fatfl; /* if on, error is fatal */
61: /* the ascii representations of the terminals */
62: extern int extval; /* start of output values */
63: extern struct sxxx1 {char *name; int value;} trmset[];
64: extern char cnames[];
65: extern int cnamsz;
66: extern char *cnamp;
67: extern int maxtmp ; /* the size of the temp arrays */
68: /* temporary vectors, indexable by states, terms, or nterms */
69: extern int temp1[];
70: extern int temp2[];
71: extern int trmlev[]; /* vector with the precedence of the terminals */
72: /* The levels are the same as for levprd, but bit 04 is always 0 */
73: /* the ascii representations of the nonterminals */
74: extern struct sxxx2 { char *name; } nontrst[];
75: extern int indgo[]; /* index to the stored goto table */
76: extern int ***pres; /* vector of pointers to the productions yielding each nonterminal */
77: extern struct looksets **pfirst; /* vector of pointers to first sets for each nonterminal */
78: extern char *pempty; /* table of nonterminals nontrivially deriving e */
79: extern char stateflags[]; /* flags defining properties of a state (see below) */
80: #define GENLAMBDA 1 /* the state can nontrivially derive lambda */
81: #define SINGLE_NT 2 /* the state has a single nonterminal before its dot */
82: #define NEEDSREDUCE 4 /* the state needs a full reduce state generated */
83: extern struct looksets lastate[]; /* saved lookahead sets */
84: extern unsigned char lookstate[]; /* index mapping states to saved lookaheads */
85: extern int savedlook; /* number of saved lookahead sets used */
86: extern int maxlastate; /* maximum number of saved lookahead sets */
87: extern int nnonter ; /* the number of nonterminals */
88: extern int lastred ; /* the number of the last reduction of a state */
89: extern FILE *ftable; /* y.tab.c file */
90: extern FILE *foutput; /* y.output file */
91: extern FILE *cin; /* current input file */
92: extern FILE *cout; /* current output file */
93: extern int arrndx;
94: extern int zzcwset;
95: extern int zzpairs ;
96: extern int zzgoent ;
97: extern int zzgobest ;
98: extern int zzacent ;
99: extern int zzacsave ;
100: extern int zznsave ;
101: extern int zzclose ;
102: extern int zzrrconf ;
103: extern int zzsrconf ;
104: extern char *ctokn;
105: struct {int **ppi;} ;
106: extern int ntlim ; /* maximum number of nonterminals */
107: extern int tlim ; /* maximum number of terminals */
108: extern int lineno; /* current line number */
109: extern int peekc; /* look-ahead character */
110: extern int tstates[];
111: extern int ntstates[];
112: extern int mstates[];
113:
114: extern struct looksets clset;
115: extern struct looksets lkst[];
116: extern int nlset; /* next lookahead set index */
117: extern int lsetsz; /* number of lookahead sets */
118:
119: extern struct wset { int *pitem, flag, ws[ _tbitset ]; } wsets[];
120: extern int cwset;
121: extern int wssize;
122: extern int lambdarule; /* index to rule that derives lambda */
123:
124: extern int numbval; /* the value of an input number */
125: extern int rflag; /* ratfor flag */
126: extern int oflag; /* optimization flag */
127: extern int ndefout; /* number of defined symbols output */
128:
129: extern int machine;
130:
131: # define UNIX 1
132: # define GCOS 2
133: # define IBM 3
134:
135: struct looksets *flset();
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.