date and time created 91/04/16 14:58:59 by bostic
[unix-history] / usr / src / usr.bin / pascal / eyacc / ey.h
CommitLineData
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
23extern int tbitset; /* number of wds of lookahead vector */
24extern int nolook; /* flag to turn off lookahed computations */
25struct looksets { int lset[ _tbitset ]; } ;
26struct 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
37extern int nstate ; /* number of states */
38extern struct item *pstate[]; /* pointers to the descriptions of the states */
39extern int apstate[]; /* index to actions in amem by state */
40extern int actsiz; /* size of the action table array */
41extern 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 */
46extern int stsize ; /* maximum number of states, at present */
47extern int memsiz ; /* maximum size for productions and states */
48extern int mem0[] ; /* added production */
49extern int *mem ;
50extern int amem[]; /* action table storage */
51extern int actsiz; /* action table size */
52extern int memact ; /* next free action table position */
53extern int nprod ; /* number of productions */
54extern int *prdptr[]; /* pointers to descriptions of productions */
55extern int prdlim; /* the number of productions allowed */
56extern 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 */
65extern int nterms ; /* number of terminals */
66extern int nerrors; /* number of errors */
67extern int fatfl; /* if on, error is fatal */
68 /* the ascii representations of the terminals */
69extern int extval; /* start of output values */
70extern struct sxxx1 {char *name; int value;} trmset[];
71extern char cnames[];
72extern int cnamsz;
73extern char *cnamp;
74extern int maxtmp ; /* the size of the temp arrays */
75 /* temporary vectors, indexable by states, terms, or nterms */
76extern int temp1[];
77extern int temp2[];
78extern 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 */
81extern struct sxxx2 { char *name; } nontrst[];
82extern int indgo[]; /* index to the stored goto table */
83extern int ***pres; /* vector of pointers to the productions yielding each nonterminal */
84extern struct looksets **pfirst; /* vector of pointers to first sets for each nonterminal */
85extern char *pempty; /* table of nonterminals nontrivially deriving e */
86extern 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 */
90extern struct looksets lastate[]; /* saved lookahead sets */
91extern unsigned char lookstate[]; /* index mapping states to saved lookaheads */
92extern int savedlook; /* number of saved lookahead sets used */
93extern int maxlastate; /* maximum number of saved lookahead sets */
94extern int nnonter ; /* the number of nonterminals */
95extern int lastred ; /* the number of the last reduction of a state */
96extern FILE *ftable; /* y.tab.c file */
97extern FILE *foutput; /* y.output file */
98extern FILE *cin; /* current input file */
99extern FILE *cout; /* current output file */
100extern int arrndx;
101extern int zzcwset;
102extern int zzpairs ;
103extern int zzgoent ;
104extern int zzgobest ;
105extern int zzacent ;
106extern int zzacsave ;
107extern int zznsave ;
108extern int zzclose ;
109extern int zzrrconf ;
110extern int zzsrconf ;
111extern char *ctokn;
112struct {int **ppi;} ;
113extern int ntlim ; /* maximum number of nonterminals */
114extern int tlim ; /* maximum number of terminals */
115extern int lineno; /* current line number */
116extern int peekc; /* look-ahead character */
117extern int tstates[];
118extern int ntstates[];
119extern int mstates[];
120
121extern struct looksets clset;
122extern struct looksets lkst[];
123extern int nlset; /* next lookahead set index */
124extern int lsetsz; /* number of lookahead sets */
125
126extern struct wset { int *pitem, flag, ws[ _tbitset ]; } wsets[];
127extern int cwset;
128extern int wssize;
129extern int lambdarule; /* index to rule that derives lambda */
130
131extern int numbval; /* the value of an input number */
132extern int rflag; /* ratfor flag */
133extern int oflag; /* optimization flag */
134extern int ndefout; /* number of defined symbols output */
135
b123b2d7 136struct looksets *flset();