/*
* Canged for RT11
* $01 Kovrigin D.A. 07-Aug-85
*/
# include
# include
# ifdef unix /* $01 */
# include "files"
# endif /* $01 */
# ifdef rt11 /* $01+ */
# include "files.h"
# endif
/* MANIFEST CONSTANT DEFINITIONS */
/* base of nonterminal internal numbers */
# define NTBASE 010000
/* internal codes for error and accept actions */
# define ERRCODE 8190
# define ACCEPTCODE 8191
/* sizes and limits */
# ifdef HUGE
# define ACTSIZE 12000
# define MEMSIZE 12000
# define NSTATES 750
# define NTERMS 127
# define NPROD 600
# define NNONTERM 300
# define TEMPSIZE 1200
# define CNAMSZ 5000
# define LSETSIZE 600
# define WSETSIZE 350
# endif
# ifdef MEDIUM
# define ACTSIZE 4000
# define MEMSIZE 5200
# define NSTATES 600
# define NTERMS 127
# define NPROD 400
# define NNONTERM 200
# define TEMPSIZE 800
# define CNAMSZ 4000
# define LSETSIZE 450
# define WSETSIZE 250
# endif
#ifdef SMALL
#define ACTSIZE 2000
#define MEMSIZE 3700
#define NSTATES 500
#define NTERMS 127
#define NPROD 250
#define NNONTERM 150
#define TEMPSIZE 400
#define CNAMSZ 2000
#define LSETSIZE 200
#define WSETSIZE 200
#endif SMALL
#ifdef K56 /* $01+ */
#define ACTSIZE 2000
#define MEMSIZE 4000
#define NSTATES 400
#define NTERMS 127
#define NPROD 200
#define NNONTERM 100
#define TEMPSIZE 200
#define CNAMSZ 1200
#define LSETSIZE 130
#define WSETSIZE 130
/* And 2 KB free - size 54 KB */
#endif K56 /* $01- */
# define NAMESIZE 50
# define NTYPES 63
# ifdef WORD32
# define TBITSET ((32+NTERMS)/32)
/* bit packing macros (may be machine dependent) */
# define BIT(a,i) ((a)[(i)>>5] & (1<<((i)&037)))
# define SETBIT(a,i) ((a)[(i)>>5] |= (1<<((i)&037)))
/* number of words needed to hold n+1 bits */
# define NWORDS(n) (((n)+32)/32)
# else
# define TBITSET ((16+NTERMS)/16)
/* bit packing macros (may be machine dependent) */
# define BIT(a,i) ((a)[(i)>>4] & (1<<((i)&017)))
# define SETBIT(a,i) ((a)[(i)>>4] |= (1<<((i)&017)))
/* number of words needed to hold n+1 bits */
# define NWORDS(n) (((n)+16)/16)
# endif
/* relationships which must hold:
TBITSET ints must hold NTERMS+1 bits...
WSETSIZE >= NNONTERM
LSETSIZE >= NNONTERM
TEMPSIZE >= NTERMS + NNONTERMs + 1
TEMPSIZE >= NSTATES
*/
/* associativities */
# define NOASC 0 /* no assoc. */
# define LASC 1 /* left assoc. */
# define RASC 2 /* right assoc. */
# define BASC 3 /* binary assoc. */
/* flags for state generation */
# define DONE 0
# define MUSTDO 1
# define MUSTLOOKAHEAD 2
/* flags for a rule having an action, and being reduced */
# define ACTFLAG 04
# define REDFLAG 010
/* output parser flags */
# define YYFLAG1 (-1000)
/* macros for getting associativity and precedence levels */
# define ASSOC(i) ((i)&03)
# define PLEVEL(i) (((i)>>4)&077)
# define TYPE(i) ((i>>10)&077)
/* macros for setting associativity and precedence levels */
# define SETASC(i,j) i|=j
# define SETPLEV(i,j) i |= (j<<4)
# define SETTYPE(i,j) i |= (j<<10)
/* looping macros */
# define TLOOP(i) for(i=1;i<=ntokens;++i)
# define NTLOOP(i) for(i=0;i<=nnonter;++i)
# define PLOOP(s,i) for(i=s;i