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