# include # include # include "files" /* 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 2500 # define MEMSIZE 3700 /* bumped from 3000 */ # define NSTATES 500 # define NTERMS 127 # define NPROD 300 # define NNONTERM 200 # define TEMPSIZE 600 # define CNAMSZ 3000 # define LSETSIZE 300 # define WSETSIZE 150 # endif # 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