DataMuseum.dk

Presents historical artifacts from the history of:

DKUUG/EUUG Conference tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about DKUUG/EUUG Conference tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - metrics - download
Index: T g

⟦fae0ec37c⟧ TextFile

    Length: 17138 (0x42f2)
    Types: TextFile
    Names: »grammar.c«

Derivation

└─⟦b20c6495f⟧ Bits:30007238 EUUGD18: Wien-båndet, efterår 1987
    └─⟦this⟧ »EUUGD18/General/Trek73/src/grammar.c« 

TextFile

# define NUMBER 257
# define NAME 258
# define ABORT 259
# define ALL 260
# define CONTROL 261
# define CORB 262
# define COURSE 263
# define DAMAGE 264
# define DEAD 265
# define DELAY 266
# define DEMAND 267
# define DESTR 268
# define DET 269
# define DISPLAY 270
# define ELUDE 271
# define ENG 272
# define FIRE 273
# define HELP 274
# define JETT 275
# define LAUNCH 276
# define LOAD 277
# define LOCK 278
# define PARAM 279
# define PHASER 280
# define POWER 281
# define PROBE 282
# define PROXIMITY 283
# define PURSUE 284
# define ROTATE 285
# define SAVE 286
# define SCAN 287
# define SPREAD 288
# define STATUS 289
# define SURREND 290
# define SURV 291
# define TACTIC 292
# define TOWARD 293
# define TUBE 294
# define UNLOAD 295
# define VERSION 296
# define WARP 297

# line 51 "grammar.y"
#ident "@(#) TREK73 $Header: grammar.y,v 1.2 87/10/09 12:24:34 okamoto Exp $"
/*
 * $Source: /ccc/okamoto/src/trek/src/RCS/grammar.y,v $
 *
 * $Header: grammar.y,v 1.2 87/10/09 12:24:34 okamoto Exp $
 *
 * $Log:	grammar.y,v $
 * Revision 1.2  87/10/09  12:24:34  12:24:34  okamoto (Jeff Okamoto)
 * Added many extra stuff
 * 
 * Revision 1.1  87/10/09  12:22:55  12:22:55  okamoto (Jeff Okamoto)
 * Initial revision
 * 
 */
#include "union.h"
	extern char parsed[];
	char string[80];
	double num1;
	double num2;
	double num3;
	double num4;
#define yyclearin yychar = -1
#define yyerrok yyerrflag = 0
extern int yychar;
extern short yyerrflag;
#ifndef YYMAXDEPTH
#define YYMAXDEPTH 150
#endif
YYSTYPE yylval, yyval;
# define YYERRCODE 256

# line 358 "grammar.y"


#include "lex.yy.c"

yywrap() { return(1); }

yyerror(s) char *s; { fprintf(stderr, "%s", s); }
short yyexca[] ={
-1, 1,
	0, -1,
	-2, 0,
	};
# define YYNPROD 122
# define YYLAST 287
short yyact[]={

   2, 124, 124,  86,  86, 107, 104, 100, 113, 111,
  97,  73,  71,  68,  80,  78, 147,  77,  76, 108,
 105, 101, 151, 128, 127,  83,  98, 137,  95,  94,
  82,  74,  70,  67,  86,  84,  86,  88,  88, 154,
  91, 141, 122, 120, 118,  75,  72,  69,  81,  79,
 149, 124, 150,  86,  87,  85,  35, 123,  34,  33,
  32,  31,  30,  29,  28,  27,  26,  25,  24,  23,
  22,  21,  20,  19,  18,  17,  16,  15,  14,  13,
  12,  11,  10,   9,   8,   7,   6,   5,   4,   1,
 153, 148,   0,   0,   0,   0,   0,   0,   0,   0,
   0,   0,   0,   0,  89,   0,  90,  92,  93,   0,
   0,  96,   0,   0,   0,   0,   0,   0,   0,   0,
   0,   0,   0,  99,   0, 102, 103,   0, 106,   0,
 109, 110,   0,   0,   0, 112,   0, 114, 115, 116,
 117,   0,   0, 119,   0, 121,   0, 125,   0,   0,
 126,   0,   0,   0,   0,   0,   0,   0, 129, 130,
 131, 132,   0, 133, 134,   0,   0, 135, 136,   0,
   0,   0,   0,   0, 138,   0, 139,   0,   0,   0,
 140,   0,   0, 142, 144, 143,   0,   0,   0,   0,
   0,   0,   0,   0,   0, 145,   0,   0,   0, 146,
   0,   0,   0,   0,   0, 152,   0,   0,   0,   0,
   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
   0,   0,   0,   0,   0,   0,   3,   0,   0,  62,
   0,  44,  58,  50,  51,  56,   0,  60,  61,  55,
  47,  49,   0,  36,  66,  54,  43,  41,  37,  57,
  39,  53,  45,   0,  48,  38,  65,  52,   0,   0,
  59,  63,  46,   0,  40,  42,  64 };
short yypact[]={

 -10,-1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000,
-1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000,
-1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000,
-1000,-1000,-1000,-1000,-1000,-1000,-247,-248,-249,-271,
-272,-245,-246,-252,-257,-226,-1000,-204,-220,-220,
-223,-1000,-221,-1000,-243,-244,-220,-1000,-1000,-1000,
-280,-1000,-242,-1000,-1000,-1000,-1000,-204,-273,-204,
-204,-274,-204,-275,-204,-204,-1000,-1000,-285,-204,
-286,-204,-204,-204,-204,-1000,-1000,-253,-1000,-254,
-255,-204,-1000,-1000,-1000,-220,-1000,-1000,-1000,-264,
-265,-1000,-1000,-220,-220,-220,-220,-204,-204,-206,
-206,-1000,-1000,-1000,-1000,-239,-1000,-1000,-204,-1000,
-204,-1000,-206,-1000,-1000,-256,-1000,-206,-204,-1000,
-1000,-1000,-1000,-1000,-1000,-1000,-1000,-206,-1000,-1000,
-1000,-206,-1000,-1000,-1000,-267,-1000,-207,-241,-1000,
-220,-218,-1000,-1000,-1000 };
short yypgo[]={

   0,  55,  57,  91,  90,  54,  89,  88,  87,  86,
  85,  84,  83,  82,  81,  80,  79,  78,  77,  76,
  75,  74,  73,  72,  71,  70,  69,  68,  67,  66,
  65,  64,  63,  62,  61,  60,  59,  58,  56 };
short yyr1[]={

   0,   6,   6,   6,   6,   6,   6,   6,   6,   6,
   6,   6,   6,   6,   6,   6,   6,   6,   6,   6,
   6,   6,   6,   6,   6,   6,   6,   6,   6,   6,
   6,   6,   6,   6,   6,   6,   1,   2,   3,   4,
   5,   7,   7,   7,   7,   7,   8,   8,   8,   9,
   9,   9,   9,   9,  10,  10,  10,  10,  10,  11,
  11,  11,  11,  12,  12,  12,  12,  13,  14,  15,
  15,  15,  15,  15,  15,  16,  16,  16,  16,  16,
  16,  17,  17,  17,  17,  18,  19,  19,  20,  20,
  20,  20,  21,  21,  21,  21,  22,  22,  22,  22,
  22,  22,  23,  24,  24,  24,  25,  26,  27,  27,
  29,  28,  28,  30,  31,  32,  33,  34,  35,  36,
  37,  38 };
short yyr2[]={

   0,   0,   1,   1,   1,   1,   1,   1,   1,   1,
   1,   1,   1,   1,   1,   1,   1,   1,   1,   1,
   1,   1,   1,   1,   1,   1,   1,   1,   1,   1,
   1,   1,   1,   1,   1,   1,   1,   1,   1,   1,
   1,   5,   3,   5,   3,   2,   3,   3,   2,   4,
   3,   4,   3,   2,   4,   3,   4,   3,   2,   4,
   3,   4,   3,   4,   3,   4,   3,   2,   2,   3,
   3,   3,   3,   2,   2,   2,   3,   5,   7,   9,
   9,   3,   2,   3,   2,   1,   2,   1,   4,   3,
   2,   1,   4,   3,   2,   1,   4,   3,   2,   5,
   4,   3,   1,   2,   2,   1,   1,   2,   3,   2,
   1,   2,   1,   1,   1,   2,   1,   2,   1,   1,
   1,   1 };
short yychk[]={

-1000,  -6,  10, 256,  -7,  -8,  -9, -10, -11, -12,
 -13, -14, -15, -16, -17, -18, -19, -20, -21, -22,
 -23, -24, -25, -26, -27, -28, -29, -30, -31, -32,
 -33, -34, -35, -36, -37, -38, 273, 278, 285, 280,
 294, 277, 295, 276, 261, 282, 292, 270, 284, 271,
 263, 264, 287, 281, 275, 269, 265, 279, 262, 290,
 267, 268, 259, 291, 296, 286, 274, 280, 260, 294,
 280, 260, 294, 260, 280, 294, 289, 289, 260, 294,
 260, 294, 282, 282, 261,  -1, 257,  -5, 258,  -5,
  -1, 263,  -5,  -1, 272, 272,  -5, 290, 268,  -1,
 280, 294,  -1,  -1, 280, 294,  -1, 280, 294,  -1,
  -1, 294,  -1, 294,  -1,  -1,  -1,  -1, 297,  -1,
 297,  -1, 297,  -2, 257,  -1,  -5, 288, 288,  -5,
  -5,  -5,  -5,  -1,  -1,  -2,  -2, 266,  -1,  -1,
  -2, 297,  -2,  -2,  -1,  -2,  -2, 283,  -3, 257,
 293, 263,  -5,  -4, 257 };
short yydef[]={

   1,  -2,   2,   3,   4,   5,   6,   7,   8,   9,
  10,  11,  12,  13,  14,  15,  16,  17,  18,  19,
  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,
  30,  31,  32,  33,  34,  35,   0,   0,   0,   0,
   0,   0,   0,   0,   0,   0,  85,  87,  91,  95,
   0, 102, 105, 106,   0,   0, 112, 110, 113, 114,
   0, 116,   0, 118, 119, 120, 121,  45,   0,  48,
  53,   0,  58,   0,   0,   0,  67,  68,   0,  73,
   0,  74,  75,  82,  84,  86,  36,  90,  40,  94,
  98,   0, 103, 104, 107, 109, 111, 115, 117,  42,
  44,  47,  46,  50,  52,  57,  55,  60,  64,  62,
  66,  69,  71,  70,  72,  76,  81,  83,   0,  89,
   0,  93,   0,  97,  37, 101, 108,   0,   0,  49,
  51,  56,  54,  59,  63,  61,  65,   0,  88,  92,
  96,   0, 100,  41,  43,  77,  99,   0,  78,  38,
   0,   0,  79,  80,  39 };
#ifndef lint
static char yaccpar_sccsid[] = "@(#)yaccpar	4.1	(Berkeley)	2/11/83";
#endif not lint

#
# define YYFLAG -1000
# define YYERROR goto yyerrlab
# define YYACCEPT return(0)
# define YYABORT return(1)

/*	parser for yacc output	*/

#ifdef YYDEBUG
int yydebug = 0; /* 1 for debugging */
#endif
YYSTYPE yyv[YYMAXDEPTH]; /* where the values are stored */
int yychar = -1; /* current input token number */
int yynerrs = 0;  /* number of errors */
short yyerrflag = 0;  /* error recovery flag */

yyparse() {

	short yys[YYMAXDEPTH];
	short yyj, yym;
	register YYSTYPE *yypvt;
	register short yystate, *yyps, yyn;
	register YYSTYPE *yypv;
	register short *yyxi;

	yystate = 0;
	yychar = -1;
	yynerrs = 0;
	yyerrflag = 0;
	yyps= &yys[-1];
	yypv= &yyv[-1];

 yystack:    /* put a state and value onto the stack */

#ifdef YYDEBUG
	if( yydebug  ) printf( "state %d, char 0%o\n", yystate, yychar );
#endif
		if( ++yyps> &yys[YYMAXDEPTH] ) { yyerror( "yacc stack overflow" ); return(1); }
		*yyps = yystate;
		++yypv;
		*yypv = yyval;

 yynewstate:

	yyn = yypact[yystate];

	if( yyn<= YYFLAG ) goto yydefault; /* simple state */

	if( yychar<0 ) if( (yychar=yylex())<0 ) yychar=0;
	if( (yyn += yychar)<0 || yyn >= YYLAST ) goto yydefault;

	if( yychk[ yyn=yyact[ yyn ] ] == yychar ){ /* valid shift */
		yychar = -1;
		yyval = yylval;
		yystate = yyn;
		if( yyerrflag > 0 ) --yyerrflag;
		goto yystack;
		}

 yydefault:
	/* default state action */

	if( (yyn=yydef[yystate]) == -2 ) {
		if( yychar<0 ) if( (yychar=yylex())<0 ) yychar = 0;
		/* look through exception table */

		for( yyxi=yyexca; (*yyxi!= (-1)) || (yyxi[1]!=yystate) ; yyxi += 2 ) ; /* VOID */

		while( *(yyxi+=2) >= 0 ){
			if( *yyxi == yychar ) break;
			}
		if( (yyn = yyxi[1]) < 0 ) return(0);   /* accept */
		}

	if( yyn == 0 ){ /* error */
		/* error ... attempt to resume parsing */

		switch( yyerrflag ){

		case 0:   /* brand new error */

			yyerror( "syntax error" );
		yyerrlab:
			++yynerrs;

		case 1:
		case 2: /* incompletely recovered error ... try again */

			yyerrflag = 3;

			/* find a state where "error" is a legal shift action */

			while ( yyps >= yys ) {
			   yyn = yypact[*yyps] + YYERRCODE;
			   if( yyn>= 0 && yyn < YYLAST && yychk[yyact[yyn]] == YYERRCODE ){
			      yystate = yyact[yyn];  /* simulate a shift of "error" */
			      goto yystack;
			      }
			   yyn = yypact[*yyps];

			   /* the current yyps has no shift onn "error", pop stack */

#ifdef YYDEBUG
			   if( yydebug ) printf( "error recovery pops state %d, uncovers %d\n", *yyps, yyps[-1] );
#endif
			   --yyps;
			   --yypv;
			   }

			/* there is no state on the stack with an error shift ... abort */

	yyabort:
			return(1);


		case 3:  /* no shift yet; clobber input char */

#ifdef YYDEBUG
			if( yydebug ) printf( "error recovery discards char %d\n", yychar );
#endif

			if( yychar == 0 ) goto yyabort; /* don't discard EOF, quit */
			yychar = -1;
			goto yynewstate;   /* try again in the same state */

			}

		}

	/* reduction by production yyn */

#ifdef YYDEBUG
		if( yydebug ) printf("reduce %d\n",yyn);
#endif
		yyps -= yyr2[yyn];
		yypvt = yypv;
		yypv -= yyr2[yyn];
		yyval = yypv[1];
		yym=yyn;
			/* consult goto table to find next state */
		yyn = yyr1[yyn];
		yyj = yypgo[yyn] + *yyps + 1;
		if( yyj>=YYLAST || yychk[ yystate = yyact[yyj] ] != -yyn ) yystate = yyact[yypgo[yyn]];
		switch(yym){
			
case 3:
# line 79 "grammar.y"
{ yyclearin; } break;
case 36:
# line 115 "grammar.y"
{ num1 = yylval.dval; } break;
case 37:
# line 119 "grammar.y"
{ num2 = yylval.dval; } break;
case 38:
# line 122 "grammar.y"
{ num3 = yylval.dval; } break;
case 39:
# line 125 "grammar.y"
{ num4 = yylval.dval; } break;
case 40:
# line 129 "grammar.y"
{ strcpy(string, yylval.sval); } break;
case 41:
# line 133 "grammar.y"
{ sprintf(parsed, "1 %.0f %.0f", num1, num2);} break;
case 42:
# line 135 "grammar.y"
{ sprintf(parsed, "1 %.0f", num1); } break;
case 43:
# line 137 "grammar.y"
{ sprintf(parsed, "1 all %.0f", num1); } break;
case 44:
# line 139 "grammar.y"
{ strcpy(parsed, "1 all"); } break;
case 45:
# line 141 "grammar.y"
{ strcpy(parsed, "1"); } break;
case 46:
# line 145 "grammar.y"
{ sprintf(parsed, "2 %.0f", num1); } break;
case 47:
# line 147 "grammar.y"
{ sprintf(parsed, "2 all"); } break;
case 48:
# line 149 "grammar.y"
{ strcpy(parsed, "2"); } break;
case 49:
# line 153 "grammar.y"
{ sprintf(parsed, "3 %.0f %s", num1, string);} break;
case 50:
# line 155 "grammar.y"
{ sprintf(parsed, "3 %.0f", num1); } break;
case 51:
# line 157 "grammar.y"
{ (void)sprintf(parsed, "3 all %s", string); } break;
case 52:
# line 159 "grammar.y"
{ strcpy(parsed, "3 all"); } break;
case 53:
# line 161 "grammar.y"
{ strcpy(parsed, "3"); } break;
case 54:
# line 165 "grammar.y"
{ sprintf(parsed, "4 %.0f %s", num1, string);} break;
case 55:
# line 167 "grammar.y"
{ sprintf(parsed, "4 %.0f", num1); } break;
case 56:
# line 169 "grammar.y"
{ (void)sprintf(parsed, "4 all %s", string); } break;
case 57:
# line 171 "grammar.y"
{ strcpy(parsed, "4 all"); } break;
case 58:
# line 173 "grammar.y"
{ strcpy(parsed, "4"); } break;
case 59:
# line 177 "grammar.y"
{ sprintf(parsed, "5 all %.0f", num1); } break;
case 60:
# line 179 "grammar.y"
{ strcpy(parsed, "5 all"); } break;
case 61:
# line 181 "grammar.y"
{ sprintf(parsed,"5 %.0f %.0f", num1, num2); } break;
case 62:
# line 183 "grammar.y"
{ sprintf(parsed,"5 %.0f", num1); } break;
case 63:
# line 187 "grammar.y"
{ sprintf(parsed, "6 all %.0f", num1); } break;
case 64:
# line 189 "grammar.y"
{ strcpy(parsed, "6 all"); } break;
case 65:
# line 191 "grammar.y"
{ sprintf(parsed,"6 %.0f %.0f", num1, num2); } break;
case 66:
# line 193 "grammar.y"
{ sprintf(parsed,"6 %.0f", num1); } break;
case 67:
# line 197 "grammar.y"
{ strcpy(parsed, "7"); } break;
case 68:
# line 201 "grammar.y"
{ strcpy(parsed, "8"); } break;
case 69:
# line 205 "grammar.y"
{ strcpy(parsed, "9 l all"); } break;
case 70:
# line 207 "grammar.y"
{ strcpy(parsed, "9 u all"); } break;
case 71:
# line 209 "grammar.y"
{ sprintf(parsed, "9 l %.0f", num1); } break;
case 72:
# line 211 "grammar.y"
{ sprintf(parsed, "9 u %.0f", num1); } break;
case 73:
# line 213 "grammar.y"
{ strcpy(parsed, "9 l"); } break;
case 74:
# line 215 "grammar.y"
{ strcpy(parsed, "9 u"); } break;
case 75:
# line 219 "grammar.y"
{ strcpy(parsed, "10"); } break;
case 76:
# line 221 "grammar.y"
{ sprintf(parsed, "10 %.0f", num1); } break;
case 77:
# line 223 "grammar.y"
{sprintf(parsed, "10 %.0f %.0f", num1, num2); } break;
case 78:
# line 225 "grammar.y"
{ sprintf(parsed, "10 %.0f %.0f %.0f", num1, num2, num3); } break;
case 79:
# line 227 "grammar.y"
{ sprintf(parsed, "10 %.0f %.0f %.0f %s", num1, num2, num3, string); } break;
case 80:
# line 229 "grammar.y"
{ sprintf(parsed, "10 %.0f %.0f %.0f\n\r %.0f", num1, num2, num3, num4); } break;
case 81:
# line 233 "grammar.y"
{ sprintf(parsed, "11 %.0f", num1); } break;
case 82:
# line 235 "grammar.y"
{ strcpy(parsed, "11"); } break;
case 83:
# line 237 "grammar.y"
{ sprintf(parsed, "11 %.0f", num1); } break;
case 84:
# line 239 "grammar.y"
{ strcpy(parsed, "11"); } break;
case 85:
# line 243 "grammar.y"
{ strcpy(parsed, "12"); } break;
case 86:
# line 247 "grammar.y"
{ sprintf(parsed, "13 %.0f", num1); } break;
case 87:
# line 249 "grammar.y"
{ strcpy(parsed, "13"); } break;
case 88:
# line 253 "grammar.y"
{ sprintf(parsed, "14 %s %f", string, num1);} break;
case 89:
# line 255 "grammar.y"
{ sprintf(parsed, "14 %s %f", string, num1);} break;
case 90:
# line 257 "grammar.y"
{ sprintf(parsed, "14 %s", string); } break;
case 91:
# line 259 "grammar.y"
{ strcpy(parsed, "14"); } break;
case 92:
# line 263 "grammar.y"
{ sprintf(parsed, "15 %s %f", string, num1);} break;
case 93:
# line 265 "grammar.y"
{ sprintf(parsed, "15 %s %f", string, num1);} break;
case 94:
# line 267 "grammar.y"
{ sprintf(parsed, "15 %s", string); } break;
case 95:
# line 269 "grammar.y"
{ strcpy(parsed, "15"); } break;
case 96:
# line 273 "grammar.y"
{ sprintf(parsed, "16 %.0f %0f", num1, num2);} break;
case 97:
# line 275 "grammar.y"
{ sprintf(parsed, "16 %.0f %0f", num1, num2);} break;
case 98:
# line 277 "grammar.y"
{ sprintf(parsed, "16 %.0f", num1);} break;
case 99:
# line 279 "grammar.y"
{ sprintf(parsed, "16 %.0f %0f", num1, num2);} break;
case 100:
# line 281 "grammar.y"
{ sprintf(parsed, "16 %.0f %0f", num1, num2);} break;
case 101:
# line 283 "grammar.y"
{ sprintf(parsed, "16 %.0f", num1);} break;
case 102:
# line 287 "grammar.y"
{ strcpy(parsed, "17"); } break;
case 103:
# line 291 "grammar.y"
{ sprintf(parsed, "18 %s", string); } break;
case 104:
# line 293 "grammar.y"
{ sprintf(parsed, "18 %.0f", num1); } break;
case 105:
# line 295 "grammar.y"
{ strcpy(parsed, "18"); } break;
case 106:
# line 299 "grammar.y"
{ strcpy(parsed, "19"); } break;
case 107:
# line 303 "grammar.y"
{ strcpy(parsed, "20"); } break;
case 108:
# line 307 "grammar.y"
{ sprintf(parsed, "21 %s", string); } break;
case 109:
# line 309 "grammar.y"
{ strcpy(parsed, "21"); } break;
case 110:
# line 313 "grammar.y"
{ strcpy(parsed, "22"); } break;
case 111:
# line 317 "grammar.y"
{ sprintf(parsed, "23 %s", string); } break;
case 112:
# line 319 "grammar.y"
{ strcpy(parsed, "23"); } break;
case 113:
# line 323 "grammar.y"
{ strcpy(parsed, "24"); } break;
case 114:
# line 327 "grammar.y"
{ strcpy(parsed, "25"); } break;
case 115:
# line 331 "grammar.y"
{ strcpy(parsed, "26"); } break;
case 116:
# line 335 "grammar.y"
{ strcpy(parsed, "27"); } break;
case 117:
# line 339 "grammar.y"
{ strcpy(parsed, "28"); } break;
case 118:
# line 343 "grammar.y"
{ strcpy(parsed, "29"); } break;
case 119:
# line 347 "grammar.y"
{ strcpy(parsed, "30"); } break;
case 120:
# line 351 "grammar.y"
{ strcpy(parsed, "31"); } break;
case 121:
# line 355 "grammar.y"
{ strcpy(parsed, "32"); } break;
		}
		goto yystack;  /* stack new state and value */

	}