add machine specific macros for extracting inline data to support CCI (tahoe)
[unix-history] / usr / src / usr.bin / pascal / eyacc / ey0.c
CommitLineData
23001f38
KM
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
8char 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
14static char sccsid[] = "@(#)ey0.c 5.1 (Berkeley) %G%";
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
32int tbitset; /* size of lookahed sets */
33int nolook = 0; /* flag to suppress lookahead computations */
34struct looksets { int lset[ _tbitset ]; } ;
35struct item { int *pitem; } ;
36
37/* this file contains the definitions for most externally known data */
38
39int nstate = 0; /* number of states */
40struct item *pstate[_nstates]; /* pointers to the descriptions of the states */
41int apstate[_nstates]; /* index to the actions for the states */
42int tystate[_nstates]; /* contains type information about the states */
43int stsize = _nstates; /* maximum number of states, at present */
44int memsiz = _memsize; /* maximum size for productions and states */
45int mem0[_memsize] ; /* production storage */
46int *mem = mem0;
47int amem[_actsize]; /* action table storage */
48int actsiz = _actsize; /* action table size */
49int memact = 0; /* next free action table position */
50int nprod = 1; /* number of productions */
51int *prdptr[_nprod]; /* pointers to descriptions of productions */
52int prdlim = _nprod ; /* the maximum number of productions */
53 /* levprd - productions levels to break conflicts */
54int 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 */
63int nterms = 0; /* number of terminals */
64int tlim = _nterms ; /* the maximum number of terminals */
65/* the ascii representations of the terminals */
66int extval = 0; /* start of output values */
67struct sxxx1 {char *name; int value;} trmset[_nterms];
68char cnames[_cnamsz];
69int cnamsz = _cnamsz;
70char *cnamp;
71int maxtmp = _tempsize; /* the size of the temp1 array */
72int temp1[_tempsize]; /* temporary storage, indexed by terms + nterms or states */
73int temp2[_nnonterm]; /* temporary storage indexed by nonterminals */
74int 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 */
77struct sxxx2 { char *name; } nontrst[_nnonterm];
78int ntlim = _nnonterm ; /* limit to the number of nonterminals */
79int indgo[_nstates]; /* index to the stored goto table */
80int ***pres; /* vector of pointers to the productions yielding each nonterminal */
81struct looksets **pfirst; /* vector of pointers to first sets for each nonterminal */
82int *pempty = 0 ; /* table of nonterminals nontrivially deriving e */
83int nnonter = -1; /* the number of nonterminals */
84int lastred = 0; /* the number of the last reduction of a state */
85FILE *ftable; /* y.tab.c file */
86FILE *foutput; /* y.output file */
87FILE *cout = stdout;
88int arrndx; /* used in the output of arrays on y.tab.c */
89int zzcwset = 0;
90int zzpairs = 0;
91int zzgoent = 0;
92int zzgobest = 0;
93int zzacent = 0;
94int zzacsave = 0;
95int zznsave = 0;
96int zzclose = 0;
97int zzsrconf = 0;
98int zzrrconf = 0;
99char *ctokn;
100int lineno = 1; /* current input line number */
101int peekc = -1; /* look-ahead character */
102int tstates[ _nterms ]; /* states generated by terminal gotos */
103int ntstates[ _nnonterm ]; /* states generated by nonterminal gotos */
104int mstates[ _nstates ]; /* chain of overflows of term/nonterm generation lists */
105
106struct looksets clset;
107struct looksets lkst [ _lsetsize ];
108int nlset = 0; /* next lookahead set index */
109int lsetsz = _lsetsize; /* number of lookahead sets */
110
111struct wset { int *pitem, flag, ws[_tbitset]; } wsets[ _wsetsize ];
112int cwset;
113int wssize = _wsetsize;
114int lambdarule = 0;
115
116char stateflags[ _nstates ];
117unsigned char lookstate[ _nstates ];
118struct looksets lastate[ _maxlastate ];
119int maxlastate = _maxlastate;
120int savedlook = 1;
121
122int numbval; /* the value of an input number */
123int rflag = 0; /* ratfor flag */
124int oflag = 0; /* optimization flag */
125
126int ndefout = 3; /* number of defined symbols output */
127int nerrors = 0; /* number of errors */
128int fatfl = 1; /* if on, error is fatal */
129int machine; /* has a number describing the machine */
130