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