[comp.os.minix] Another yacc - part 2 - missing makefile & yaccpar

U5569462@ucsvc.unimelb.edu.au (DAVID CLUNIE) (07/22/89)

I forgot to include makefile & yaccpar in the previous
shell archive of yacc that I posted, so here they are.

#! /bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".
# You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..
# If this archive is complete, you will see the following message:
#		"End of archive."
#
# Contents:
#
#    makefile
#    yaccpar
#
if test -f 'makefile' ; then
  echo shar: Will not clobber existing file \"'makefile'\"
else
echo shar: Extracting \"'makefile'\" \( 2846 characters \)
sed "s/^X//" >'makefile' <<'END_OF_FILE'
X#  Copyright 1987,1988,1989 David A. Clunie. All rights reserved.
X#  PO Box 811, Parkville 3052 AUSTRALIA.
X#  This program may be freely distributed for non-commercial use.
X
X.c.obj :
X	ztc -c -mc -s $*
X
Xyacc.exe : \
X	yacc.obj\
X	yautil.obj\
X	ya1.obj\
X	yalex.obj\
X	yasym.obj\
X	yafunc.obj\
X	yaaug.obj\
X	yaparse.obj\
X	yafdef.obj\
X	yafrule.obj\
X	yainit1.obj\
X	yaophead.obj\
X	yaopsym.obj\
X	ya2.obj\
X	yabit.obj\
X	yaread.obj\
X	yafirst.obj\
X	yalr0.obj\
X	yardtx.obj\
X	yafrtx.obj\
X	yagoto.obj\
X	yasort.obj\
X	yatxsort.obj\
X	yareln.obj\
X	yafrreln.obj\
X	yaincon.obj\
X	yafrin.obj\
X	yalook.obj\
X	yardprec.obj\
X	yafrprec.obj\
X	yatable.obj\
X	yaconf.obj\
X	yapack.obj\
X	yaoppars.obj
X	ztc -oyacc -mc -g ya*.obj
X
Xyacc.obj:	yacc.c		yadefs.h yavers.h yasystem.h
Xyautil.obj:	yautil.c	yadefs.h yavers.h yasystem.h
Xya1.obj:	ya1.c		yadefs.h yavers.h yasystem.h
Xyalex.obj:	yalex.c		yadefs.h yavers.h yasystem.h yalex.h
Xyasym.obj:	yasym.c		yadefs.h yavers.h yasystem.h
Xyafunc.obj:	yafunc.c	yadefs.h yavers.h yasystem.h
Xyaaug.obj:	yaaug.c		yadefs.h yavers.h yasystem.h
Xyaparse.obj:	yaparse.c	yadefs.h yavers.h yasystem.h
Xyafdef.obj:	yafdef.c	yadefs.h yavers.h yasystem.h
Xyafrule.obj:	yafrule.c	yadefs.h yavers.h yasystem.h
Xyainit1.obj:	yainit1.c	yadefs.h yavers.h yasystem.h
Xyaophead.obj:	yaophead.c	yadefs.h yavers.h yasystem.h
Xyaopsym.obj:	yaopsym.c	yadefs.h yavers.h yasystem.h
Xya2.obj:	ya2.c		yadefs.h yavers.h yasystem.h
Xyabit.obj:	yabit.c		yadefs.h yavers.h yasystem.h
Xyaread.obj:	yaread.c	yadefs.h yavers.h yasystem.h
Xyafirst.obj:	yafirst.c	yadefs.h yavers.h yasystem.h
Xyalr0.obj:	yalr0.c		yadefs.h yavers.h yasystem.h
Xyardtx.obj:	yardtx.c	yadefs.h yavers.h yasystem.h
Xyafrtx.obj:	yafrtx.c	yadefs.h yavers.h yasystem.h
Xyagoto.obj:	yagoto.c	yadefs.h yavers.h yasystem.h
Xyasort.obj:	yasort.c	yadefs.h yavers.h yasystem.h
Xyatxsort.obj:	yatxsort.c	yadefs.h yavers.h yasystem.h
Xyareln.obj:	yareln.c	yadefs.h yavers.h yasystem.h
Xyafrreln.obj:	yafrreln.c	yadefs.h yavers.h yasystem.h
Xyaincon.obj:	yaincon.c	yadefs.h yavers.h yasystem.h
Xyafrin.obj:	yafrin.c	yadefs.h yavers.h yasystem.h
Xyalook.obj:	yalook.c	yadefs.h yavers.h yasystem.h
Xyardprec.obj:	yardprec.c	yadefs.h yavers.h yasystem.h
Xyafrprec.obj:	yafrprec.c	yadefs.h yavers.h yasystem.h
Xyatable.obj:	yatable.c	yadefs.h yavers.h yasystem.h
Xyaconf.obj:	yaconf.c	yadefs.h yavers.h yasystem.h
Xyapack.obj:	yapack.c	yadefs.h yavers.h yasystem.h
Xyaoppars.obj:	yaoppars.c	yadefs.h yavers.h yasystem.h
X
Xyaparse.c:	yaparse.y
X	yacc -dtvg yaparse.y
X	del yaparse.c
X	rename ytab.c yaparse.c
X	del yalex.h
X	rename ytab.h yalex.h
X
Xyalex.h:	yaparse.y
X	yacc -dtvg yaparse.y
X	del yaparse.c
X	rename ytab.c yaparse.c
X	del yalex.h
X	rename ytab.h yalex.h
X
Xyasystem.h:	yapcdos.h
X	copy yapcdos.h yasystem.h
X
Xyadefs.h:	yavers.h yasystem.h
X
END_OF_FILE
if test 2846 -ne `wc -c <'makefile'`; then
    echo shar: \"'makefile'\" unpacked with wrong size!
fi
# end of 'makefile'
fi
if test -f 'yaccpar' ; then
  echo shar: Will not clobber existing file \"'yaccpar'\"
else
echo shar: Extracting \"'yaccpar'\" \( 5627 characters \)
sed "s/^X//" >'yaccpar' <<'END_OF_FILE'
X/* yaccpar	19-Dec-86	Parser to interpret yacc output tables */
X/* 14-May-88 */
X
X#ifndef YYDEBUG
X#define YYDEBUG		1	/* debugging is available, but not on yet */
X#endif
X
X#ifndef YYFULLERR
X#define YYFULLERR 	0	/* full error messages are not available */
X#endif
X
X#ifndef YYUNION
X#define YYUNION 	0	/* 0 == C compiler supports union assignment */
X#endif
X
X#if YYDEBUG
X#define YYDESC	1
X#else
X#if YYFULLERR
X#define YYDESC	1
X#endif /* YYFULLERR */
X#endif /* YYDEBUG */
X
X#if YYDEBUG
Xstatic int yyyylex();	/* !!! */
X#else
X#define yyyylex()	yylex()
X#endif
X
Xstatic void yygetchar();
X
X#if YYDESC
Xstatic char *yydesc();
X#endif
X
X#if YYFULLERR
Xstatic void yyterror();
X#endif
X
X#if YYUNION
X#define _yyassign(to,from)	yyunion(&to,&from)
X#else
X#define	_yyassign(to,from)	(to=from)
X#endif
X
X#define YYFLAG		(-1000)
X#define YYERROR		goto yyerrlab
X#define YYACCEPT	return(0)
X#define YYABORT		return(1)
X
X#if YYDEBUG
Xint	yydebug=0;		/* set to 1 to turn on debugging */
X#endif
X
XYYSTYPE yyvalue[YYMAXDEPTH];	/* parser value stack */
Xint yystack[YYMAXDEPTH];	/* parser state stack */
Xint yychar=(-1);		/* current input token (-1 == none) */
Xint yynerrs=0;			/* number of errors */
Xint yyerrflag=0;		/* error recovery in progress */
X
Xyyparse()
X{
X    int yystate;
X    int *yypstack;
X    YYSTYPE *yypvalue;
X    int yyindex;
X    int *yyxi;
X    int yypush;
X
X    yystate=0;
X    yychar=(-1);
X    yynerrs=0;
X    yyerrflag=0;
X    yypstack= &yystack[-1];	/* beware of old assignment operators !!! */
X    yypvalue= &yyvalue[-1];
X    yypush=1;
X
X    for (;;) {
X	if (yypush) {		/* put a state and value onto the stack */
X#if YYDEBUG 
X	    if (yydebug)
X		printf("[yydebug] state %d, token %s\n",
X		    yystate,yydesc(yychar,yytoks));
X#endif
X	    if (++yypstack > &yystack[YYMAXDEPTH]) {
X		yyerror("yacc stack overflow");
X		YYABORT;
X	    }
X	    *yypstack=yystate;
X	    ++yypvalue;
X	    _yyassign(*yypvalue,yyval);
X	}
X
X	yyindex=yypact[yystate];
X	if (yyindex>YYFLAG
X	  && (yygetchar(),
X	       (yyindex+= yychar) >= 0 && yyindex < YYLAST
X               && yychk[ yyindex=yyact[ yyindex ] ] == yychar
X	     )
X          ) {			/* valid shift */
X	    yychar=(-1);
X	    _yyassign(yyval,yylval);
X	    yystate=yyindex;
X	    if (yyerrflag > 0) --yyerrflag;
X	    yypush=1;
X	}
X	else {			/* default state action */
X	    if ( (yyindex=yydef[yystate]) == -2 ) {
X		yygetchar();
X		/* look through exception table */
X#if YYDEBUG
X		if (yydebug)
X		    printf("[yydebug] on lookahead %s\n",
X			yydesc(yychar,yytoks));
X#endif
X		for (yyxi=yyexca; (*yyxi!=(-1))||(yyxi[1]!=yystate); yyxi+=2);
X		for (yyxi+=2; *yyxi >= 0 && *yyxi != yychar; yyxi+=2);
X		if ((yyindex=yyxi[1]) < 0) {
X#if YYDEBUG
X		    if (yydebug) printf("[yydebug] accept\n");
X#endif
X		    YYACCEPT;
X		}
X	    }
X
X	    if (yyindex == 0) {	/* error ... attempt to resume parsing */
X		switch(yyerrflag) {
X		    case 0:	/* brand new error */
X#if YYFULLERR
X			yyindex=yypact[yystate];
X			if (yyindex>YYFLAG && yyindex<YYLAST) {
X			    int token,index;
X			    for (index=(yyindex>0)?yyindex:0;
X			      index<YYLAST; ++index) {
X				token=index-yyindex;
X				if (yychk[yyact[index]] == token
X				  && token != YYERRCODE) {
X				    yyterror(yydesc(token,yytoks));
X				}
X			    }
X			}
X			yyterror(NULL);
X#else
X			yyerror("syntax error");
X#endif
Xyyerrlab:
X			++yynerrs;
X		    case 1:
X		    case 2:	/* incompletely recovered error */
X			yyerrflag=3;
X	/* find a state where "error" is a legal shift action */
X			yypush=0;	/* use as local flag */
X			while(yypstack >= yystack) {
X			    yyindex=yypact[*yypstack] +YYERRCODE;
X			    if ( yyindex>=0 && yyindex<YYLAST
X			      && yychk[yyact[yyindex]] == YYERRCODE) {
X				yystate=yyact[yyindex];	/* shift error */
X				yypush=1;
X				break;			/* ... out of loop */
X			    }
X			    else {		/* no shift on error */
X#if YYDEBUG
X				if (yydebug) printf(
X		"[yydebug] error recovery pops state %d, uncovers %d\n",
X					*yypstack,yypstack[-1]);
X#endif
X				--yypstack;		/* pop stack */
X				--yypvalue;
X			    }
X			}
X			if (!yypush)	/* no error shift state on stack */
X			    YYABORT;
X
X			break;		/* else stack error state */
X			
X		    case 3:		/* no shift yet; discard input char */
X#if YYDEBUG
X			if (yydebug)
X			    printf("[yydebug] error recovery discards %s\n",
X				yydesc(yychar,yytoks));
X#endif
X			if (yychar == 0) YYABORT;	/* don't discard EOF */
X			yychar=(-1);
X			yypush=0;	/* try again in SAME state */
X		}
X	    }
X	    else {		/* reduction by production yyindex */
X		YYSTYPE *yypvt;
X		int yynont;
X		int yyrule;
X
X		yyrule=yyindex;
X#if YYDEBUG
X		if (yydebug)
X		    printf("[yydebug] reduce by (%d) \"%s\"\n",
X			yyrule,yyreds[yyrule]);
X#endif
X		yypstack -= yyr2[yyrule];
X		yypvt=yypvalue;
X		yypvalue -= yyr2[yyrule];
X		_yyassign(yyval,yypvalue[1]);
X		/* consult goto table to find next state */
X		yynont=yyr1[yyrule];
X		yyindex=yypgo[yynont] + *yypstack + 1;
X		if (yyindex>=YYLAST
X		  || yychk[yystate=yyact[yyindex]] != -yynont)
X		    yystate=yyact[yypgo[yynont]];
X		switch(yyrule) {
X		    $A
X		}
X		yypush=1;	/* stack new state and value */
X	    }
X	}
X    }
X}
X
X
Xstatic void
Xyygetchar()
X{
X    if (yychar < 0) if ((yychar=yyyylex()) < 0) yychar=0;
X}
X
X#if YYDEBUG
X
Xstatic int
Xyyyylex()
X{
X    int ch;
X
X    ch=yylex();
X    if (yydebug)
X	printf("[yydebug] received token %s\n",yydesc(ch,yytoks));
X    return ch;
X}
X
X#endif /* YYDEBUG */
X
X#if YYDESC
X
Xstatic char *
Xyydesc(ch,table)
Xint ch;
Xyytoktype *table;
X{
X    register yytoktype *p;
X    char *s;
X
X    if (ch == 0)
X	s="end-of-file";
X    else if (ch < 0)
X	s="-none-";
X    else {
X	for (p=table; p->t_val != ch && p->t_val >= 0; ++p);
X	s=p->t_name;
X    }
X    return s;
X}
X
X#endif /* YYDESC */
X
END_OF_FILE
if test 5627 -ne `wc -c <'yaccpar'`; then
    echo shar: \"'yaccpar'\" unpacked with wrong size!
fi
# end of 'yaccpar'
fi
echo "End of archive."