
/*  A Bison parser, made from parse.y with Bison version GNU Bison version 1.22
  */

#define YYBISON 1  /* Identify Bison output.  */

#define	LOR	258
#define	LAND	259
#define	EQU	260
#define	NEQ	261
#define	LE	262
#define	GE	263
#define	LSH	264
#define	RSH	265
#define	LSB	266
#define	MSB	267
#define	ALIGN	268
#define	ASCII	269
#define	ASCIZ	270
#define	ASSERT	271
#define	BEGNN	272
#define	BSS	273
#define	BYTE	274
#define	CODE	275
#define	DATA	276
#define	DBYT	277
#define	DCI	278
#define	ELSE	279
#define	END	280
#define	ENDIF	281
#define	ENDM	282
#define	IF	283
#define	EXPAND	284
#define	FLOAT	285
#define	GLOBAL	286
#define	HIBIT	287
#define	MACRO	288
#define	LONG	289
#define	SPACE	290
#define	WORD	291
#define	ZERO	292
#define	IMPORT	293
#define	ZIMPORT	294
#define	INTLIT	295
#define	FLOATLIT	296
#define	CHARLIT	297
#define	TEXTLIT	298
#define	LABEL	299
#define	IDENT	300

#line 12 "parse.y"


#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include "util.h"
#include "error.h"
#include "names.h"
#include "obj.h"
#include "asm.h"

/* For bison's error reporting */

	#define	yyerror		uerror

/* These are for constant expressions, a special case of IValue */

	#define	ConstExpr(ivalue)		\
		((ivalue).type == iSegRel && (ivalue).u.segrel.segment == AbsSegment)
	#define	ConstExprVal(ivalue)	((ivalue).u.segrel.offset)

/* Generic constant expression evaluation */

	#define	UnaryOp(a,b,OPR)												\
	{																		\
		if (a.type == iUnknown)												\
			b.type = iUnknown;												\
		else if (!ConstExpr(a))												\
			uerror("illegal expression");									\
		else																\
		{																	\
			b.type = iSegRel;												\
			b.u.segrel.segment = AbsSegment;								\
			b.u.segrel.offset = OPR ConstExprVal(a);						\
		}																	\
	}

	#define	BinaryOp(a,b,c,OPR)												\
	{																		\
		if (a.type == iUnknown || b.type == iUnknown)						\
			c.type = iUnknown;												\
		else if (!ConstExpr(a) || !ConstExpr(b))							\
			uerror("illegal expression");									\
		else																\
		{																	\
			c.type = iSegRel;												\
			c.u.segrel.segment = AbsSegment;								\
			c.u.segrel.offset = ConstExprVal(a) OPR ConstExprVal(b);		\
		}																	\
	}

/* This tells the lister to show the offset in the current segment */

	#define	ListLocation()													\
	{																		\
		gSegrel.segment = gSegment;											\
		gSegrel.offset = gAddress[gSegment];								\
	}

/* This tells the lister to show any bytes emitted by this line */

	#define	ListEmittedBytes()		(gListBytes = TRUE)

/* This is how we implement the if-else-endif stack */

	struct IfStack
	{
		unsigned	assembling:1;
		unsigned	doing_else:1;
	};

	static int				gIfStackPtr;
	static struct IfStack	gIfStack[MAX_IF_NESTING];
	static int				gIfLine;


#line 116 "parse.y"
typedef union
	{
		unsigned		id;				/* Identifier */
		int				intval;			/* Integer literal */
		double			floatval;		/* Floating point literal */
		char			charval;		/* Character literal */
		struct TValue	textval;		/* String literal */
		struct IValue	ivalue;			/* Ivalue */
		struct List		ivlist;			/* List of ivalues */
		struct List		idlist;			/* List of identifiers */
		struct List		flist;			/* List of floats */
	} YYSTYPE;

#ifndef YYLTYPE
typedef
  struct yyltype
    {
      int timestamp;
      int first_line;
      int first_column;
      int last_line;
      int last_column;
      char *text;
   }
  yyltype;

#define YYLTYPE yyltype
#endif

#include <stdio.h>

#ifndef __cplusplus
#ifndef __STDC__
#define const
#endif
#endif



#define	YYFINAL		150
#define	YYFLAG		-32768
#define	YYNTBASE	67

#define YYTRANSLATE(x) ((unsigned)(x) <= 300 ? yytranslate[x] : 81)

static const char yytranslate[] = {     0,
     2,     2,     2,     2,     2,     2,     2,     2,     2,    61,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,    24,     2,     2,     2,    23,    10,     2,    63,
    64,    21,    19,     3,    20,     2,    22,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     5,     2,    13,
    62,    14,     4,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
    65,     2,    66,     9,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     8,     2,    25,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     1,     2,     6,     7,    11,
    12,    15,    16,    17,    18,    26,    27,    28,    29,    30,
    31,    32,    33,    34,    35,    36,    37,    38,    39,    40,
    41,    42,    43,    44,    45,    46,    47,    48,    49,    50,
    51,    52,    53,    54,    55,    56,    57,    58,    59,    60
};

#if YYDEBUG != 0
static const short yyprhs[] = {     0,
     0,     1,     4,     6,     9,    12,    14,    17,    21,    23,
    24,    26,    30,    34,    37,    42,    47,    54,    61,    64,
    67,    70,    72,    74,    76,    79,    82,    85,    88,    91,
    94,    97,   100,   103,   106,   109,   112,   115,   118,   121,
   123,   125,   127,   129,   132,   134,   136,   140,   146,   148,
   150,   154,   158,   161,   164,   168,   172,   176,   180,   184,
   188,   192,   196,   200,   204,   208,   212,   216,   220,   224,
   228,   230,   233,   236,   238,   240,   242,   245,   248,   250,
   253,   255,   259,   261,   265,   267
};

static const short yyrhs[] = {    -1,
    68,    69,     0,    70,     0,    69,    70,     0,    71,    61,
     0,    73,     0,    72,    73,     0,    59,    62,    74,     0,
    59,     0,     0,    60,     0,    60,    26,    74,     0,    60,
    27,    74,     0,    60,    74,     0,    60,    63,    74,    64,
     0,    60,    74,     3,    60,     0,    60,    63,    74,    64,
     3,    60,     0,    60,    63,    74,     3,    60,    64,     0,
    29,    77,     0,    30,    77,     0,    38,    77,     0,    35,
     0,    36,     0,    33,     0,    47,    74,     0,    44,    74,
     0,    34,    79,     0,    51,    79,     0,    37,    79,     0,
    49,    79,     0,    31,    74,     0,    28,    74,     0,    50,
    74,     0,    52,    74,     0,    45,    80,     0,    53,    78,
     0,    54,    78,     0,    46,    78,     0,    43,    74,     0,
    39,     0,    41,     0,    32,     0,    40,     0,    48,    60,
     0,    42,     0,    75,     0,    65,    74,    66,     0,    74,
     4,    74,     5,    74,     0,    21,     0,    60,     0,    74,
    19,    74,     0,    74,    20,    74,     0,    24,    74,     0,
    25,    74,     0,    74,    21,    74,     0,    74,    22,    74,
     0,    74,    23,    74,     0,    74,    17,    74,     0,    74,
    18,    74,     0,    74,     7,    74,     0,    74,     6,    74,
     0,    74,    10,    74,     0,    74,     9,    74,     0,    74,
     8,    74,     0,    74,    11,    74,     0,    74,    12,    74,
     0,    74,    13,    74,     0,    74,    15,    74,     0,    74,
    14,    74,     0,    74,    16,    74,     0,    55,     0,    19,
    55,     0,    20,    55,     0,    57,     0,    74,     0,    56,
     0,    19,    56,     0,    20,    56,     0,    58,     0,    58,
    58,     0,    60,     0,    60,     3,    78,     0,    74,     0,
    74,     3,    79,     0,    76,     0,    76,     3,    80,     0
};

#endif

#if YYDEBUG != 0
static const short yyrline[] = { 0,
   149,   163,   165,   167,   170,   204,   206,   207,   276,   322,
   327,   333,   339,   345,   351,   357,   378,   393,   411,   417,
   423,   432,   433,   434,   438,   445,   455,   461,   467,   473,
   482,   492,   505,   519,   536,   567,   597,   630,   656,   667,
   679,   692,   693,   694,   695,   698,   705,   709,   715,   721,
   796,   846,   894,   895,   896,   897,   898,   899,   900,   901,
   902,   903,   904,   905,   906,   907,   908,   909,   910,   911,
   914,   916,   917,   918,   921,   929,   930,   931,   934,   936,
   948,   954,   963,   969,   978,   984
};

static const char * const yytname[] = {   "$","error","$illegal.","','","'?'",
"':'","LOR","LAND","'|'","'^'","'&'","EQU","NEQ","'<'","'>'","LE","GE","LSH",
"RSH","'+'","'-'","'*'","'/'","'%'","'!'","'~'","LSB","MSB","ALIGN","ASCII",
"ASCIZ","ASSERT","BEGNN","BSS","BYTE","CODE","DATA","DBYT","DCI","ELSE","END",
"ENDIF","ENDM","IF","EXPAND","FLOAT","GLOBAL","HIBIT","MACRO","LONG","SPACE",
"WORD","ZERO","IMPORT","ZIMPORT","INTLIT","FLOATLIT","CHARLIT","TEXTLIT","LABEL",
"IDENT","'\\n'","'='","'('","')'","'['","']'","start","@1","program","complete_line",
"line","local_label","unlabeled_line","i_value","const_int","f_value","t_value",
"id_list","iv_list","f_list",""
};
#endif

static const short yyr1[] = {     0,
    68,    67,    69,    69,    70,    71,    71,    71,    72,    73,
    73,    73,    73,    73,    73,    73,    73,    73,    73,    73,
    73,    73,    73,    73,    73,    73,    73,    73,    73,    73,
    73,    73,    73,    73,    73,    73,    73,    73,    73,    73,
    73,    73,    73,    73,    73,    74,    74,    74,    74,    74,
    74,    74,    74,    74,    74,    74,    74,    74,    74,    74,
    74,    74,    74,    74,    74,    74,    74,    74,    74,    74,
    75,    75,    75,    75,    76,    76,    76,    76,    77,    77,
    78,    78,    79,    79,    80,    80
};

static const short yyr2[] = {     0,
     0,     2,     1,     2,     2,     1,     2,     3,     1,     0,
     1,     3,     3,     2,     4,     4,     6,     6,     2,     2,
     2,     1,     1,     1,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     1,
     1,     1,     1,     2,     1,     1,     3,     5,     1,     1,
     3,     3,     2,     2,     3,     3,     3,     3,     3,     3,
     3,     3,     3,     3,     3,     3,     3,     3,     3,     3,
     1,     2,     2,     1,     1,     1,     2,     2,     1,     2,
     1,     3,     1,     3,     1,     3
};

static const short yydefact[] = {     1,
    10,     0,     0,     0,     0,    42,    24,     0,    22,    23,
     0,     0,    40,    43,    41,    45,     0,     0,     0,     0,
     0,     0,     0,     0,     0,     0,     0,     0,     9,    11,
     2,     3,     0,    10,     6,     0,     0,    49,     0,     0,
    71,    74,    50,     0,    32,    46,    79,    19,    20,    31,
    83,    27,    29,    21,    39,    26,     0,     0,    76,    75,
    85,    35,    81,    38,    25,    44,    30,    33,    28,    34,
    36,    37,     0,     0,     0,     0,    14,     4,     5,     7,
    72,    73,    53,    54,     0,     0,     0,     0,     0,     0,
     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
     0,     0,     0,     0,    80,     0,    77,    78,     0,     0,
     8,    12,    13,     0,     0,    47,     0,    61,    60,    64,
    63,    62,    65,    66,    67,    69,    68,    70,    58,    59,
    51,    52,    55,    56,    57,    84,    86,    82,     0,    15,
    16,     0,     0,     0,    48,    18,    17,     0,     0,     0
};

static const short yydefgoto[] = {   148,
     1,    31,    32,    33,    34,    35,    51,    46,    61,    48,
    64,    52,    62
};

static const short yypact[] = {-32768,
   194,   122,   -56,   -56,   122,-32768,-32768,   122,-32768,-32768,
   122,   -56,-32768,-32768,-32768,-32768,   122,   122,    10,   -50,
   122,   -42,   122,   122,   122,   122,   -50,   -50,   -26,   110,
   160,-32768,   -22,   227,-32768,   -14,   -11,-32768,   122,   122,
-32768,-32768,-32768,   122,   343,-32768,   -18,-32768,-32768,   343,
   282,-32768,-32768,-32768,   343,   343,   -29,   -23,-32768,   343,
    60,-32768,    61,-32768,   343,-32768,-32768,   343,-32768,   343,
-32768,-32768,   122,   122,   122,   122,   303,-32768,-32768,-32768,
-32768,-32768,-32768,-32768,    39,   122,   122,   122,   122,   122,
   122,   122,   122,   122,   122,   122,   122,   122,   122,   122,
   122,   122,   122,   122,-32768,   122,-32768,-32768,    10,   -50,
   343,   343,   343,   105,     8,-32768,   323,   141,   359,   374,
   388,   401,   412,   412,    59,    59,    59,    59,   -15,   -15,
    -9,    -9,-32768,-32768,-32768,-32768,-32768,-32768,     9,    80,
-32768,   122,    40,    50,   343,-32768,-32768,   132,   133,-32768
};

static const short yypgoto[] = {-32768,
-32768,-32768,   107,-32768,-32768,   111,    -2,-32768,-32768,    -3,
    -7,     0,    30
};


#define	YYLAST		435


static const short yytable[] = {    45,
    49,    47,    50,   100,   101,   102,   103,   104,    54,    63,
    53,   102,   103,   104,    55,    56,    60,    66,    65,    71,
    72,    68,    67,    70,    69,    81,   107,    77,    57,    58,
    38,    82,   108,    39,    40,    73,    83,    84,    79,   105,
    81,    85,    86,    82,    87,    88,    89,    90,    91,    92,
    93,    94,    95,    96,    97,    98,    99,   100,   101,   102,
   103,   104,   109,   110,    41,    59,    42,   141,   143,    43,
   111,   112,   113,   114,    44,    98,    99,   100,   101,   102,
   103,   104,   144,   117,   118,   119,   120,   121,   122,   123,
   124,   125,   126,   127,   128,   129,   130,   131,   132,   133,
   134,   135,   138,   146,   116,   136,    60,   139,    86,   147,
    87,    88,    89,    90,    91,    92,    93,    94,    95,    96,
    97,    98,    99,   100,   101,   102,   103,   104,    36,    37,
    38,   149,   150,    39,    40,    74,    75,    78,   137,   145,
    36,    37,    38,     0,    80,    39,    40,    88,    89,    90,
    91,    92,    93,    94,    95,    96,    97,    98,    99,   100,
   101,   102,   103,   104,    41,     0,    42,     0,   140,    43,
     0,     0,    76,     0,    44,     0,    41,     0,    42,     0,
     0,    43,     0,     0,     0,     0,    44,     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,     0,     0,     0,     0,    29,    30,
   -10,     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,     0,     0,
     0,     0,    29,    30,     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,     0,     0,     0,   106,    86,    30,    87,    88,    89,
    90,    91,    92,    93,    94,    95,    96,    97,    98,    99,
   100,   101,   102,   103,   104,   115,    86,     0,    87,    88,
    89,    90,    91,    92,    93,    94,    95,    96,    97,    98,
    99,   100,   101,   102,   103,   104,    86,   142,    87,    88,
    89,    90,    91,    92,    93,    94,    95,    96,    97,    98,
    99,   100,   101,   102,   103,   104,    86,     0,    87,    88,
    89,    90,    91,    92,    93,    94,    95,    96,    97,    98,
    99,   100,   101,   102,   103,   104,    89,    90,    91,    92,
    93,    94,    95,    96,    97,    98,    99,   100,   101,   102,
   103,   104,    90,    91,    92,    93,    94,    95,    96,    97,
    98,    99,   100,   101,   102,   103,   104,    91,    92,    93,
    94,    95,    96,    97,    98,    99,   100,   101,   102,   103,
   104,    92,    93,    94,    95,    96,    97,    98,    99,   100,
   101,   102,   103,   104,    94,    95,    96,    97,    98,    99,
   100,   101,   102,   103,   104
};

static const short yycheck[] = {     2,
     4,    58,     5,    19,    20,    21,    22,    23,    12,    60,
    11,    21,    22,    23,    17,    18,    19,    60,    21,    27,
    28,    24,    23,    26,    25,    55,    56,    30,    19,    20,
    21,    55,    56,    24,    25,    62,    39,    40,    61,    58,
    55,    44,     4,    55,     6,     7,     8,     9,    10,    11,
    12,    13,    14,    15,    16,    17,    18,    19,    20,    21,
    22,    23,     3,     3,    55,    56,    57,    60,    60,    60,
    73,    74,    75,    76,    65,    17,    18,    19,    20,    21,
    22,    23,     3,    86,    87,    88,    89,    90,    91,    92,
    93,    94,    95,    96,    97,    98,    99,   100,   101,   102,
   103,   104,   110,    64,    66,   106,   109,     3,     4,    60,
     6,     7,     8,     9,    10,    11,    12,    13,    14,    15,
    16,    17,    18,    19,    20,    21,    22,    23,    19,    20,
    21,     0,     0,    24,    25,    26,    27,    31,   109,   142,
    19,    20,    21,    -1,    34,    24,    25,     7,     8,     9,
    10,    11,    12,    13,    14,    15,    16,    17,    18,    19,
    20,    21,    22,    23,    55,    -1,    57,    -1,    64,    60,
    -1,    -1,    63,    -1,    65,    -1,    55,    -1,    57,    -1,
    -1,    60,    -1,    -1,    -1,    -1,    65,    28,    29,    30,
    31,    32,    33,    34,    35,    36,    37,    38,    39,    40,
    41,    42,    43,    44,    45,    46,    47,    48,    49,    50,
    51,    52,    53,    54,    -1,    -1,    -1,    -1,    59,    60,
    61,    28,    29,    30,    31,    32,    33,    34,    35,    36,
    37,    38,    39,    40,    41,    42,    43,    44,    45,    46,
    47,    48,    49,    50,    51,    52,    53,    54,    -1,    -1,
    -1,    -1,    59,    60,    28,    29,    30,    31,    32,    33,
    34,    35,    36,    37,    38,    39,    40,    41,    42,    43,
    44,    45,    46,    47,    48,    49,    50,    51,    52,    53,
    54,    -1,    -1,    -1,     3,     4,    60,     6,     7,     8,
     9,    10,    11,    12,    13,    14,    15,    16,    17,    18,
    19,    20,    21,    22,    23,     3,     4,    -1,     6,     7,
     8,     9,    10,    11,    12,    13,    14,    15,    16,    17,
    18,    19,    20,    21,    22,    23,     4,     5,     6,     7,
     8,     9,    10,    11,    12,    13,    14,    15,    16,    17,
    18,    19,    20,    21,    22,    23,     4,    -1,     6,     7,
     8,     9,    10,    11,    12,    13,    14,    15,    16,    17,
    18,    19,    20,    21,    22,    23,     8,     9,    10,    11,
    12,    13,    14,    15,    16,    17,    18,    19,    20,    21,
    22,    23,     9,    10,    11,    12,    13,    14,    15,    16,
    17,    18,    19,    20,    21,    22,    23,    10,    11,    12,
    13,    14,    15,    16,    17,    18,    19,    20,    21,    22,
    23,    11,    12,    13,    14,    15,    16,    17,    18,    19,
    20,    21,    22,    23,    13,    14,    15,    16,    17,    18,
    19,    20,    21,    22,    23
};
/* -*-C-*-  Note some compilers choke on comments on `#line' lines.  */
#line 3 "/usr/sww/lib/bison/bison.simple"

/* Skeleton output parser for bison,
   Copyright (C) 1984, 1989, 1990 Bob Corbett and Richard Stallman

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 1, or (at your option)
   any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */


#ifndef alloca
#ifdef __GNUC__
#define alloca __builtin_alloca
#else /* not GNU C.  */
#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi)
#include <alloca.h>
#else /* not sparc */
#if defined (MSDOS) && !defined (__TURBOC__)
#include <malloc.h>
#else /* not MSDOS, or __TURBOC__ */
#if defined(_AIX)
#include <malloc.h>
 #pragma alloca
#else /* not MSDOS, __TURBOC__, or _AIX */
#ifdef __hpux
#ifdef __cplusplus
extern "C" {
void *alloca (unsigned int);
};
#else /* not __cplusplus */
void *alloca ();
#endif /* not __cplusplus */
#endif /* __hpux */
#endif /* not _AIX */
#endif /* not MSDOS, or __TURBOC__ */
#endif /* not sparc.  */
#endif /* not GNU C.  */
#endif /* alloca not defined.  */

/* This is the parser code that is written into each bison parser
  when the %semantic_parser declaration is not specified in the grammar.
  It was written by Richard Stallman by simplifying the hairy parser
  used when %semantic_parser is specified.  */

/* Note: there must be only one dollar sign in this file.
   It is replaced by the list of actions, each action
   as one case of the switch.  */

#define yyerrok		(yyerrstatus = 0)
#define yyclearin	(yychar = YYEMPTY)
#define YYEMPTY		-2
#define YYEOF		0
#define YYACCEPT	return(0)
#define YYABORT 	return(1)
#define YYERROR		goto yyerrlab1
/* Like YYERROR except do call yyerror.
   This remains here temporarily to ease the
   transition to the new meaning of YYERROR, for GCC.
   Once GCC version 2 has supplanted version 1, this can go.  */
#define YYFAIL		goto yyerrlab
#define YYRECOVERING()  (!!yyerrstatus)
#define YYBACKUP(token, value) \
do								\
  if (yychar == YYEMPTY && yylen == 1)				\
    { yychar = (token), yylval = (value);			\
      yychar1 = YYTRANSLATE (yychar);				\
      YYPOPSTACK;						\
      goto yybackup;						\
    }								\
  else								\
    { yyerror ("syntax error: cannot back up"); YYERROR; }	\
while (0)

#define YYTERROR	1
#define YYERRCODE	256

#ifndef YYPURE
#define YYLEX		yylex()
#endif

#ifdef YYPURE
#ifdef YYLSP_NEEDED
#define YYLEX		yylex(&yylval, &yylloc)
#else
#define YYLEX		yylex(&yylval)
#endif
#endif

/* If nonreentrant, generate the variables here */

#ifndef YYPURE

int	yychar;			/*  the lookahead symbol		*/
YYSTYPE	yylval;			/*  the semantic value of the		*/
				/*  lookahead symbol			*/

#ifdef YYLSP_NEEDED
YYLTYPE yylloc;			/*  location data for the lookahead	*/
				/*  symbol				*/
#endif

int yynerrs;			/*  number of parse errors so far       */
#endif  /* not YYPURE */

#if YYDEBUG != 0
int yydebug;			/*  nonzero means print parse trace	*/
/* Since this is uninitialized, it does not stop multiple parsers
   from coexisting.  */
#endif

/*  YYINITDEPTH indicates the initial size of the parser's stacks	*/

#ifndef	YYINITDEPTH
#define YYINITDEPTH 200
#endif

/*  YYMAXDEPTH is the maximum size the stacks can grow to
    (effective only if the built-in stack extension method is used).  */

#if YYMAXDEPTH == 0
#undef YYMAXDEPTH
#endif

#ifndef YYMAXDEPTH
#define YYMAXDEPTH 10000
#endif

/* Prevent warning if -Wstrict-prototypes.  */
#ifdef __GNUC__
int yyparse (void);
#endif

#if __GNUC__ > 1		/* GNU C and GNU C++ define this.  */
#define __yy_bcopy(FROM,TO,COUNT)	__builtin_memcpy(TO,FROM,COUNT)
#else				/* not GNU C or C++ */
#ifndef __cplusplus

/* This is the most reliable way to avoid incompatibilities
   in available built-in functions on various systems.  */
static void
__yy_bcopy (from, to, count)
     char *from;
     char *to;
     int count;
{
  register char *f = from;
  register char *t = to;
  register int i = count;

  while (i-- > 0)
    *t++ = *f++;
}

#else /* __cplusplus */

/* This is the most reliable way to avoid incompatibilities
   in available built-in functions on various systems.  */
static void
__yy_bcopy (char *from, char *to, int count)
{
  register char *f = from;
  register char *t = to;
  register int i = count;

  while (i-- > 0)
    *t++ = *f++;
}

#endif
#endif

#line 184 "/usr/sww/lib/bison/bison.simple"
int
yyparse()
{
  register int yystate;
  register int yyn;
  register short *yyssp;
  register YYSTYPE *yyvsp;
  int yyerrstatus;	/*  number of tokens to shift before error messages enabled */
  int yychar1 = 0;		/*  lookahead token as an internal (translated) token number */

  short	yyssa[YYINITDEPTH];	/*  the state stack			*/
  YYSTYPE yyvsa[YYINITDEPTH];	/*  the semantic value stack		*/

  short *yyss = yyssa;		/*  refer to the stacks thru separate pointers */
  YYSTYPE *yyvs = yyvsa;	/*  to allow yyoverflow to reallocate them elsewhere */

#ifdef YYLSP_NEEDED
  YYLTYPE yylsa[YYINITDEPTH];	/*  the location stack			*/
  YYLTYPE *yyls = yylsa;
  YYLTYPE *yylsp;

#define YYPOPSTACK   (yyvsp--, yyssp--, yylsp--)
#else
#define YYPOPSTACK   (yyvsp--, yyssp--)
#endif

  int yystacksize = YYINITDEPTH;

#ifdef YYPURE
  int yychar;
  YYSTYPE yylval;
  int yynerrs;
#ifdef YYLSP_NEEDED
  YYLTYPE yylloc;
#endif
#endif

  YYSTYPE yyval;		/*  the variable used to return		*/
				/*  semantic values from the action	*/
				/*  routines				*/

  int yylen;

#if YYDEBUG != 0
  if (yydebug)
    fprintf(stderr, "Starting parse\n");
#endif

  yystate = 0;
  yyerrstatus = 0;
  yynerrs = 0;
  yychar = YYEMPTY;		/* Cause a token to be read.  */

  /* Initialize stack pointers.
     Waste one element of value and location stack
     so that they stay on the same level as the state stack.
     The wasted elements are never initialized.  */

  yyssp = yyss - 1;
  yyvsp = yyvs;
#ifdef YYLSP_NEEDED
  yylsp = yyls;
#endif

/* Push a new state, which is found in  yystate  .  */
/* In all cases, when you get here, the value and location stacks
   have just been pushed. so pushing a state here evens the stacks.  */
yynewstate:

  *++yyssp = yystate;

  if (yyssp >= yyss + yystacksize - 1)
    {
      /* Give user a chance to reallocate the stack */
      /* Use copies of these so that the &'s don't force the real ones into memory. */
      YYSTYPE *yyvs1 = yyvs;
      short *yyss1 = yyss;
#ifdef YYLSP_NEEDED
      YYLTYPE *yyls1 = yyls;
#endif

      /* Get the current used size of the three stacks, in elements.  */
      int size = yyssp - yyss + 1;

#ifdef yyoverflow
      /* Each stack pointer address is followed by the size of
	 the data in use in that stack, in bytes.  */
#ifdef YYLSP_NEEDED
      /* This used to be a conditional around just the two extra args,
	 but that might be undefined if yyoverflow is a macro.  */
      yyoverflow("parser stack overflow",
		 &yyss1, size * sizeof (*yyssp),
		 &yyvs1, size * sizeof (*yyvsp),
		 &yyls1, size * sizeof (*yylsp),
		 &yystacksize);
#else
      yyoverflow("parser stack overflow",
		 &yyss1, size * sizeof (*yyssp),
		 &yyvs1, size * sizeof (*yyvsp),
		 &yystacksize);
#endif

      yyss = yyss1; yyvs = yyvs1;
#ifdef YYLSP_NEEDED
      yyls = yyls1;
#endif
#else /* no yyoverflow */
      /* Extend the stack our own way.  */
      if (yystacksize >= YYMAXDEPTH)
	{
	  yyerror("parser stack overflow");
	  return 2;
	}
      yystacksize *= 2;
      if (yystacksize > YYMAXDEPTH)
	yystacksize = YYMAXDEPTH;
      yyss = (short *) alloca (yystacksize * sizeof (*yyssp));
      __yy_bcopy ((char *)yyss1, (char *)yyss, size * sizeof (*yyssp));
      yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp));
      __yy_bcopy ((char *)yyvs1, (char *)yyvs, size * sizeof (*yyvsp));
#ifdef YYLSP_NEEDED
      yyls = (YYLTYPE *) alloca (yystacksize * sizeof (*yylsp));
      __yy_bcopy ((char *)yyls1, (char *)yyls, size * sizeof (*yylsp));
#endif
#endif /* no yyoverflow */

      yyssp = yyss + size - 1;
      yyvsp = yyvs + size - 1;
#ifdef YYLSP_NEEDED
      yylsp = yyls + size - 1;
#endif

#if YYDEBUG != 0
      if (yydebug)
	fprintf(stderr, "Stack size increased to %d\n", yystacksize);
#endif

      if (yyssp >= yyss + yystacksize - 1)
	YYABORT;
    }

#if YYDEBUG != 0
  if (yydebug)
    fprintf(stderr, "Entering state %d\n", yystate);
#endif

  goto yybackup;
 yybackup:

/* Do appropriate processing given the current state.  */
/* Read a lookahead token if we need one and don't already have one.  */
/* yyresume: */

  /* First try to decide what to do without reference to lookahead token.  */

  yyn = yypact[yystate];
  if (yyn == YYFLAG)
    goto yydefault;

  /* Not known => get a lookahead token if don't already have one.  */

  /* yychar is either YYEMPTY or YYEOF
     or a valid token in external form.  */

  if (yychar == YYEMPTY)
    {
#if YYDEBUG != 0
      if (yydebug)
	fprintf(stderr, "Reading a token: ");
#endif
      yychar = YYLEX;
    }

  /* Convert token to internal form (in yychar1) for indexing tables with */

  if (yychar <= 0)		/* This means end of input. */
    {
      yychar1 = 0;
      yychar = YYEOF;		/* Don't call YYLEX any more */

#if YYDEBUG != 0
      if (yydebug)
	fprintf(stderr, "Now at end of input.\n");
#endif
    }
  else
    {
      yychar1 = YYTRANSLATE(yychar);

#if YYDEBUG != 0
      if (yydebug)
	{
	  fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
	  /* Give the individual parser a way to print the precise meaning
	     of a token, for further debugging info.  */
#ifdef YYPRINT
	  YYPRINT (stderr, yychar, yylval);
#endif
	  fprintf (stderr, ")\n");
	}
#endif
    }

  yyn += yychar1;
  if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
    goto yydefault;

  yyn = yytable[yyn];

  /* yyn is what to do for this token type in this state.
     Negative => reduce, -yyn is rule number.
     Positive => shift, yyn is new state.
       New state is final state => don't bother to shift,
       just return success.
     0, or most negative number => error.  */

  if (yyn < 0)
    {
      if (yyn == YYFLAG)
	goto yyerrlab;
      yyn = -yyn;
      goto yyreduce;
    }
  else if (yyn == 0)
    goto yyerrlab;

  if (yyn == YYFINAL)
    YYACCEPT;

  /* Shift the lookahead token.  */

#if YYDEBUG != 0
  if (yydebug)
    fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
#endif

  /* Discard the token being shifted unless it is eof.  */
  if (yychar != YYEOF)
    yychar = YYEMPTY;

  *++yyvsp = yylval;
#ifdef YYLSP_NEEDED
  *++yylsp = yylloc;
#endif

  /* count tokens shifted since error; after three, turn off error status.  */
  if (yyerrstatus) yyerrstatus--;

  yystate = yyn;
  goto yynewstate;

/* Do the default action for the current state.  */
yydefault:

  yyn = yydefact[yystate];
  if (yyn == 0)
    goto yyerrlab;

/* Do a reduction.  yyn is the number of a rule to reduce with.  */
yyreduce:
  yylen = yyr2[yyn];
  if (yylen > 0)
    yyval = yyvsp[1-yylen]; /* implement default value of the action */

#if YYDEBUG != 0
  if (yydebug)
    {
      int i;

      fprintf (stderr, "Reducing via rule %d (line %d), ",
	       yyn, yyrline[yyn]);

      /* Print the symbols being reduced, and their result.  */
      for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
	fprintf (stderr, "%s ", yytname[yyrhs[i]]);
      fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
    }
#endif


  switch (yyn) {

case 1:
#line 150 "parse.y"
{

	/* Initialize state */

		gIfStackPtr = 0;
		gAssembleOn = 
		gIfStack[0].assembling = TRUE;
		gIfStack[0].doing_else = TRUE;

		gHiBit = DEFAULT_HIBIT;
		gExpand = DEFAULT_EXPAND;
	;
    break;}
case 5:
#line 172 "parse.y"
{

	/* Print the line if desired */

		if (gListFile && gPass == 2)
		{
			if (!gAssembleOn && !gExpand)
			{
				if (gIfLine)
				{
					ListLine(gListFile);
					fprintf(gListFile, "\n");
					gIfLine = FALSE;
				}
			}
			else
				ListLine(gListFile);
		}

	/* Record maximum extent of each segment */

		if (gAddress[gSegment] > gMaxAddress[gSegment])
			gMaxAddress[gSegment] = gAddress[gSegment];

	/* Set these up for the next line */

		gLineNumber++;
		gSegrel.segment = -1;
		gListBytes = FALSE;
	;
    break;}
case 8:
#line 208 "parse.y"
{
		Symbol	sym = GetSym(yyvsp[-2].id);

	/* Check stuff */

		switch (gPass)
		{
			case 1:
				if (sym)
					uerror("symbol \"%s\" defined previously: "
						"file \"%s\", line %d", Name(gNames, yyvsp[-2].id),
						Name(gNames, sym->file), sym->line);
				else
				{
					sym = DefineSym(yyvsp[-2].id);
					sym->file = NameID(gNames, gFileName);
					sym->line = gLineNumber;
				}
				break;
			case 2:
				if (!sym)
					cerror("lost symbol \"%s\"", Name(gNames, sym->id));
				break;
			default:
				assert(0);
		}

	/* Set value */

		switch (yyvsp[0].ivalue.type)
		{
			case iSegRel:
				sym->type = sSegRel;
				sym->u.segrel = yyvsp[0].ivalue.u.segrel;
				sym->valid = TRUE;
				gSegrel = sym->u.segrel;	/* Show value in listing */
				break;
			case iSymOff:
				sym->type = sSymOff;
				sym->u.symoff = yyvsp[0].ivalue.u.symoff;
				sym->valid = TRUE;
				break;
			case iUnknown:
				if (gPass == 1)
				{
					sym->type = sSegRel;
					sym->u.segrel.segment = AbsSegment;
					sym->u.segrel.offset = 0;
				}
				else
					uerror("can't resolve this expression");
				break;
			default:
				assert(0);
		}

	/* Debugging */

		if (gDebug)
		{
			fprintf(stderr, "--> DEFINED: ");
			ShowSym(stderr, sym);
		}
	;
    break;}
case 9:
#line 278 "parse.y"
{
		Symbol	sym = GetSym(yyvsp[0].id);

		switch (gPass)
		{
			case 1:
				if (sym)
					uerror("symbol \"%s\" defined previously: "
						"file \"%s\", line %d", Name(gNames, yyvsp[0].id),
						Name(gNames, sym->file), sym->line);
				else
				{
					sym = DefineSym(yyvsp[0].id);
					sym->file = NameID(gNames, gFileName);
					sym->line = gLineNumber;
					sym->type = sSegRel;
					sym->u.segrel.segment = gSegment;
					sym->u.segrel.offset = gAddress[gSegment];
					sym->valid = TRUE;
					if (gDebug)
					{
						fprintf(stderr, "--> DEFINED: ");
						ShowSym(stderr, sym);
					}
				}
				break;

			case 2:
				if (!sym)
					cerror("symbol not found");
				if (!sym->valid || sym->type != sSegRel)
					cerror("symbol inconsistency");
				if (sym->u.segrel.segment != gSegment
					|| sym->u.segrel.offset != gAddress[gSegment])
					cerror("sync error");
				ListLocation();
				break;

			default:
				assert(0);
		}
	;
    break;}
case 11:
#line 328 "parse.y"
{
		ListLocation();
		ListEmittedBytes();
		EmitIns(yyvsp[0].id, NULL, mImplied, -1);
	;
    break;}
case 12:
#line 334 "parse.y"
{
		ListLocation();
		ListEmittedBytes();
		EmitImm(yyvsp[-2].id, &yyvsp[0].ivalue, FALSE);
	;
    break;}
case 13:
#line 340 "parse.y"
{
		ListLocation();
		ListEmittedBytes();
		EmitImm(yyvsp[-2].id, &yyvsp[0].ivalue, TRUE);
	;
    break;}
case 14:
#line 346 "parse.y"
{
		ListLocation();
		ListEmittedBytes();
		EmitIns(yyvsp[-1].id, &yyvsp[0].ivalue, mAbsolute, mZeroPage);
	;
    break;}
case 15:
#line 352 "parse.y"
{
		ListLocation();
		ListEmittedBytes();
		EmitIns(yyvsp[-3].id, &yyvsp[-1].ivalue, mIndirect, mZPIndirect);
	;
    break;}
case 16:
#line 358 "parse.y"
{
		int	mode = -1, zmode = -1;

	/* Show bytes, etc. */

		ListLocation();
		ListEmittedBytes();

	/* Index should be X or Y */

		if (yyvsp[0].id == NameID(gNames, "x") || yyvsp[0].id == NameID(gNames, "X"))
			mode = mAbsoluteX, zmode = mZeroPageX;
		if (yyvsp[0].id == NameID(gNames, "y") || yyvsp[0].id == NameID(gNames, "Y"))
			mode = mAbsoluteY, zmode = mZeroPageY;

		if (mode >= 0)
			EmitIns(yyvsp[-3].id, &yyvsp[-2].ivalue, mode, zmode);
		else
			uerror("bad addressing mode");
	;
    break;}
case 17:
#line 379 "parse.y"
{

	/* Show bytes, etc. */

		ListLocation();
		ListEmittedBytes();

	/* Index should be Y */

		if (yyvsp[0].id == NameID(gNames, "y") || yyvsp[0].id == NameID(gNames, "Y"))
			EmitIns(yyvsp[-5].id, &yyvsp[-3].ivalue, -1, mZPIndirectY);
		else
			uerror("bad addressing mode");
	;
    break;}
case 18:
#line 394 "parse.y"
{

	/* Show bytes, etc. */

		ListLocation();
		ListEmittedBytes();

	/* Index should be X */

		if (yyvsp[-1].id == NameID(gNames, "x") || yyvsp[-1].id == NameID(gNames, "X"))
			EmitIns(yyvsp[-5].id, &yyvsp[-3].ivalue, mIndirectX, mZPIndirectX);
		else
			uerror("bad addressing mode");
	;
    break;}
case 19:
#line 412 "parse.y"
{	
		ListLocation();
		ListEmittedBytes();
		PsAscii(&yyvsp[0].textval, FALSE, FALSE); free(yyvsp[0].textval.chars);
	;
    break;}
case 20:
#line 418 "parse.y"
{
		ListLocation();
		ListEmittedBytes();
		PsAscii(&yyvsp[0].textval, TRUE, FALSE); free(yyvsp[0].textval.chars);
	;
    break;}
case 21:
#line 424 "parse.y"
{
		ListLocation();
		ListEmittedBytes();
		PsAscii(&yyvsp[0].textval, FALSE, TRUE); free(yyvsp[0].textval.chars);
	;
    break;}
case 22:
#line 432 "parse.y"
{ gSegment = CodeSegment; ;
    break;}
case 23:
#line 433 "parse.y"
{ gSegment = DataSegment; ;
    break;}
case 24:
#line 434 "parse.y"
{ gSegment = BssSegment; ;
    break;}
case 25:
#line 439 "parse.y"
{
		if (!ConstExpr(yyvsp[0].ivalue))
			uerror("constant expression required");
		else
			gHiBit = ConstExprVal(yyvsp[0].ivalue) ? 0x80 : 0x00;
	;
    break;}
case 26:
#line 446 "parse.y"
{
		if (!ConstExpr(yyvsp[0].ivalue))
			uerror("constant expression required");
		else
			gExpand = ConstExprVal(yyvsp[0].ivalue) ? TRUE : FALSE;
	;
    break;}
case 27:
#line 456 "parse.y"
{
		ListLocation();
		ListEmittedBytes();
		PsData(&yyvsp[0].ivlist, 1, FALSE);
	;
    break;}
case 28:
#line 462 "parse.y"
{
		ListLocation();
		ListEmittedBytes();
		PsData(&yyvsp[0].ivlist, 2, FALSE);
	;
    break;}
case 29:
#line 468 "parse.y"
{
		ListLocation();
		ListEmittedBytes();
		PsData(&yyvsp[0].ivlist, 2, TRUE);
	;
    break;}
case 30:
#line 474 "parse.y"
{
		ListLocation();
		ListEmittedBytes();
		PsData(&yyvsp[0].ivlist, 4, FALSE);
	;
    break;}
case 31:
#line 483 "parse.y"
{
		if (!ConstExpr(yyvsp[0].ivalue))
			uerror("constant expression required");
		if (gPass == 2 && !ConstExprVal(yyvsp[0].ivalue))
			uerror("assertion failed");
	;
    break;}
case 32:
#line 493 "parse.y"
{
		ListLocation();
		if (!ConstExpr(yyvsp[0].ivalue))
			uerror("constant expression required");
		else if (ConstExprVal(yyvsp[0].ivalue) < 0)
			uerror("non-negative value required");
		else
			gAddress[gSegment] = RoundUp(gAddress[gSegment], ConstExprVal(yyvsp[0].ivalue));
	;
    break;}
case 33:
#line 506 "parse.y"
{
		ListLocation();
		if (!ConstExpr(yyvsp[0].ivalue))
			uerror("constant expression required");
		else
			if ((int) gAddress[gSegment] + ConstExprVal(yyvsp[0].ivalue) < 0)
				uerror("negative space goes beyond beginning of segment");
			else
				gAddress[gSegment] += ConstExprVal(yyvsp[0].ivalue);
	;
    break;}
case 34:
#line 520 "parse.y"
{
		int		k;

		ListLocation();
		ListEmittedBytes();
		if (!ConstExpr(yyvsp[0].ivalue))
			uerror("constant expression required");
		else if (ConstExprVal(yyvsp[0].ivalue) < 0)
			uerror("non-negative value required");
		else
			for (k = 0; k < ConstExprVal(yyvsp[0].ivalue); k++)
				Emit(0);
	;
    break;}
case 35:
#line 537 "parse.y"
{ 
		int			k;
		List		list, next;
		Byte		value[FLOAT_SIZE_6502];

	/* Show the data */

		ListLocation();
		ListEmittedBytes();

	/* Emit floats */

		for (list = &yyvsp[0].flist; list; list = list->next)
		{
			EncodeFloat(list->u.fvalue, value);
			for (k = 0; k < sizeof(value); k++)
				Emit(value[k]);
		}

	/* Free tail of list */

		for (list = yyvsp[0].flist.next; list; list = next)
		{
			next = list->next;
			free(list);
		}
	;
    break;}
case 36:
#line 568 "parse.y"
{
		Symbol	sym;
		List	list, next;

	/* Import symbols during pass one, verify during pass two */

		for (list = &yyvsp[0].idlist; list; list = list->next)
			switch (gPass)
			{
				case 1:
					Import(list->u.id);
					break;
				case 2:
					if ((sym = GetSym(list->u.id)))
						uerror("imported symbol \"%s\" is defined locally",
							Name(gNames, list->u.id));
					break;
				default:
					assert(0);
			}

	/* Free tail of list */

		for (list = yyvsp[0].idlist.next; list; list = next)
		{
			next = list->next;
			free(list);
		}
	;
    break;}
case 37:
#line 598 "parse.y"
{
		Symbol	sym;
		List	list, next;

	/* Import symbols during pass one, verify during pass two */

		for (list = &yyvsp[0].idlist; list; list = list->next)
			switch (gPass)
			{
				case 1:
					ZpImport(list->u.id);
					break;
				case 2:
					if ((sym = GetSym(list->u.id)))
						uerror("imported symbol \"%s\" is defined locally",
							Name(gNames, list->u.id));
					break;
				default:
					assert(0);
			}

	/* Free tail of list */

		for (list = yyvsp[0].idlist.next; list; list = next)
		{
			next = list->next;
			free(list);
		}
	;
    break;}
case 38:
#line 631 "parse.y"
{
		Symbol	sym;
		List	list, next;

	/* Export symbols during pass two */

		if (gPass == 2)
			for (list = &yyvsp[0].idlist; list; list = list->next)
				if ((sym = GetSym(list->u.id)))
					Export(sym);
				else
					uerror("undefined symbol \"%s\"",
						Name(gNames, list->u.id));

	/* Free tail of list */

		for (list = yyvsp[0].idlist.next; list; list = next)
		{
			next = list->next;
			free(list);
		}
	;
    break;}
case 39:
#line 657 "parse.y"
{
		if (!ConstExpr(yyvsp[0].ivalue))
			uerror("constant expression required");
		if (++gIfStackPtr >= MAX_IF_NESTING)
			cerror("\".if\" nesting too deep");
		gAssembleOn = 
		gIfStack[gIfStackPtr].assembling = ConstExprVal(yyvsp[0].ivalue);
		gIfStack[gIfStackPtr].doing_else = FALSE;
		gIfLine = TRUE;
	;
    break;}
case 40:
#line 668 "parse.y"
{
		if (gIfStack[gIfStackPtr].doing_else)
			uerror("\".else\" without \".if\"");
		else
		{
			gAssembleOn = 
			gIfStack[gIfStackPtr].assembling =
				!gIfStack[gIfStackPtr].assembling;
			gIfStack[gIfStackPtr].doing_else = TRUE;
		}
	;
    break;}
case 41:
#line 680 "parse.y"
{
		if (!gIfStackPtr)
			uerror("\".endif\" without \".if\"");
		else
		{
			gIfStackPtr--;
			gAssembleOn = gIfStack[gIfStackPtr].assembling;
		}
	;
    break;}
case 42:
#line 692 "parse.y"
{ uerror("pseudo-op unimplemented"); ;
    break;}
case 43:
#line 693 "parse.y"
{ uerror("pseudo-op unimplemented"); ;
    break;}
case 44:
#line 694 "parse.y"
{ uerror("pseudo-op unimplemented"); ;
    break;}
case 45:
#line 695 "parse.y"
{ uerror("pseudo-op unimplemented"); ;
    break;}
case 46:
#line 700 "parse.y"
{
		yyval.ivalue.type = iSegRel;
		yyval.ivalue.u.segrel.segment = AbsSegment;
		yyval.ivalue.u.segrel.offset = yyvsp[0].intval;
	;
    break;}
case 47:
#line 706 "parse.y"
{
		yyval.ivalue = yyvsp[-1].ivalue;
	;
    break;}
case 48:
#line 710 "parse.y"
{
		if (!ConstExpr(yyvsp[-4].ivalue))
			uerror("constant expression required left of conditional");
		yyval.ivalue = ConstExprVal(yyvsp[-4].ivalue) ? yyvsp[-2].ivalue : yyvsp[0].ivalue;
	;
    break;}
case 49:
#line 716 "parse.y"
{
		yyval.ivalue.type = iSegRel;
		yyval.ivalue.u.segrel.segment = gSegment;
		yyval.ivalue.u.segrel.offset = gAddress[gSegment];
	;
    break;}
case 50:
#line 722 "parse.y"
{
		Symbol	sym = GetSym(yyvsp[0].id);

		switch (gPass)
		{
			case 1:
				if (sym)
					switch (sym->type)
					{
						case sSegRel:
							yyval.ivalue.type = iSegRel;
							yyval.ivalue.u.segrel = sym->u.segrel;
							break;
						case sSymOff:
							yyval.ivalue.type = iSymOff;
							yyval.ivalue.u.symoff = sym->u.symoff;
							break;
						default:
							assert(0);
					}
				else
					if (IsZpImport(yyvsp[0].id))
					{
						yyval.ivalue.type = iSymOff;
						yyval.ivalue.u.symoff.id = yyvsp[0].id;
						yyval.ivalue.u.symoff.offset = 0;
					}
					else
						yyval.ivalue.type = iUnknown;
				break;

			case 2:
				if (sym)
					if (!sym->valid)
					{
						uerror("illegal forward reference to \"%s\"",
							Name(gNames, sym->id));
						yyval.ivalue.type = iSegRel;
						yyval.ivalue.u.segrel.segment = AbsSegment;
						yyval.ivalue.u.segrel.offset = 0;
					}
					else
						switch (sym->type)
						{
							case sSegRel:
								yyval.ivalue.type = iSegRel;
								yyval.ivalue.u.segrel = sym->u.segrel;
								break;
							case sSymOff:
								yyval.ivalue.type = iSymOff;
								yyval.ivalue.u.symoff = sym->u.symoff;
								break;
							default:
								assert(0);
						}
				else
				{
					yyval.ivalue.type = iSymOff;
					yyval.ivalue.u.symoff.id = yyvsp[0].id;
					yyval.ivalue.u.symoff.offset = 0;
				}
				break;

			default:
				assert(0);
		}
	;
    break;}
case 51:
#line 797 "parse.y"
{
		if (yyvsp[-2].ivalue.type == iUnknown || yyvsp[0].ivalue.type == iUnknown)
			yyval.ivalue.type = iUnknown;
		else
			switch (yyvsp[-2].ivalue.type)
			{
				case iSegRel:
					switch (yyvsp[0].ivalue.type)
					{
						case iSegRel:
							yyval.ivalue.type = iSegRel;
							if (yyvsp[-2].ivalue.u.segrel.segment == AbsSegment)
								yyval.ivalue = yyvsp[0].ivalue;
							else if (yyvsp[0].ivalue.u.segrel.segment == AbsSegment)
								yyval.ivalue = yyvsp[-2].ivalue;
							else
								uerror("illegal expression");
							yyval.ivalue.u.segrel.offset =
								yyvsp[-2].ivalue.u.segrel.offset + yyvsp[0].ivalue.u.segrel.offset;
							break;
						case iSymOff:
							if (yyvsp[-2].ivalue.u.segrel.segment != AbsSegment)
								uerror("illegal unresolved expression");
							yyval.ivalue = yyvsp[0].ivalue;
							yyval.ivalue.u.symoff.offset += yyvsp[-2].ivalue.u.segrel.offset;
							break;
						default:
							assert(0);
					}
					break;
				case iSymOff:
					switch (yyvsp[0].ivalue.type)
					{
						case iSegRel:
							if (yyvsp[0].ivalue.u.segrel.segment != AbsSegment)
								uerror("illegal unresolved expression");
							yyval.ivalue = yyvsp[-2].ivalue;
							yyval.ivalue.u.symoff.offset += yyvsp[0].ivalue.u.segrel.offset;
							break;
						case iSymOff:
							uerror("illegal unresolved expression");
							break;
					}
					break;
				default:
					assert(0);
			}
	;
    break;}
case 52:
#line 847 "parse.y"
{
		if (yyvsp[-2].ivalue.type == iUnknown || yyvsp[0].ivalue.type == iUnknown)
			yyval.ivalue.type = iUnknown;
		else
			switch (yyvsp[0].ivalue.type)
			{
				case iSegRel:
					switch (yyvsp[-2].ivalue.type)
					{
						case iSegRel:
							if (yyvsp[-2].ivalue.u.segrel.segment == yyvsp[0].ivalue.u.segrel.segment)
							{
								yyval.ivalue.type = iSegRel;
								yyval.ivalue.u.segrel.segment = AbsSegment;
								yyval.ivalue.u.segrel.offset =
									yyvsp[-2].ivalue.u.segrel.offset - yyvsp[0].ivalue.u.segrel.offset;
							}
							else
							{
								if (yyvsp[0].ivalue.u.segrel.segment != AbsSegment)
									uerror("illegal expression");
								yyval.ivalue = yyvsp[-2].ivalue;
								yyval.ivalue.u.segrel.offset -= yyvsp[0].ivalue.u.segrel.offset;
							}
							break;
						case iSymOff:
							if (yyvsp[0].ivalue.u.segrel.segment != AbsSegment)
								uerror("illegal expression");
							yyval.ivalue = yyvsp[-2].ivalue;
							yyval.ivalue.u.symoff.offset -= yyvsp[0].ivalue.u.segrel.offset;
							break;
						default:
							assert(0);
					}
					break;
				case iSymOff:
					if (yyvsp[-2].ivalue.type != iSymOff || yyvsp[-2].ivalue.u.symoff.id != yyvsp[0].ivalue.u.symoff.id)
						uerror("illegal expression");
					yyval.ivalue.type = iSegRel;
					yyval.ivalue.u.segrel.segment = AbsSegment;
					yyval.ivalue.u.segrel.offset =
						yyvsp[-2].ivalue.u.symoff.offset - yyvsp[0].ivalue.u.symoff.offset;
					break;
				default:
					assert(0);
			}
	;
    break;}
case 53:
#line 894 "parse.y"
{ UnaryOp(yyvsp[0].ivalue,yyval.ivalue,!); ;
    break;}
case 54:
#line 895 "parse.y"
{ UnaryOp(yyvsp[0].ivalue,yyval.ivalue,~); ;
    break;}
case 55:
#line 896 "parse.y"
{ BinaryOp(yyvsp[-2].ivalue,yyvsp[0].ivalue,yyval.ivalue,*); ;
    break;}
case 56:
#line 897 "parse.y"
{ BinaryOp(yyvsp[-2].ivalue,yyvsp[0].ivalue,yyval.ivalue,/); ;
    break;}
case 57:
#line 898 "parse.y"
{ BinaryOp(yyvsp[-2].ivalue,yyvsp[0].ivalue,yyval.ivalue,%); ;
    break;}
case 58:
#line 899 "parse.y"
{ BinaryOp(yyvsp[-2].ivalue,yyvsp[0].ivalue,yyval.ivalue,<<); ;
    break;}
case 59:
#line 900 "parse.y"
{ BinaryOp(yyvsp[-2].ivalue,yyvsp[0].ivalue,yyval.ivalue,>>); ;
    break;}
case 60:
#line 901 "parse.y"
{ BinaryOp(yyvsp[-2].ivalue,yyvsp[0].ivalue,yyval.ivalue,&&); ;
    break;}
case 61:
#line 902 "parse.y"
{ BinaryOp(yyvsp[-2].ivalue,yyvsp[0].ivalue,yyval.ivalue,||); ;
    break;}
case 62:
#line 903 "parse.y"
{ BinaryOp(yyvsp[-2].ivalue,yyvsp[0].ivalue,yyval.ivalue,&); ;
    break;}
case 63:
#line 904 "parse.y"
{ BinaryOp(yyvsp[-2].ivalue,yyvsp[0].ivalue,yyval.ivalue,^); ;
    break;}
case 64:
#line 905 "parse.y"
{ BinaryOp(yyvsp[-2].ivalue,yyvsp[0].ivalue,yyval.ivalue,|); ;
    break;}
case 65:
#line 906 "parse.y"
{ BinaryOp(yyvsp[-2].ivalue,yyvsp[0].ivalue,yyval.ivalue,==); ;
    break;}
case 66:
#line 907 "parse.y"
{ BinaryOp(yyvsp[-2].ivalue,yyvsp[0].ivalue,yyval.ivalue,!=); ;
    break;}
case 67:
#line 908 "parse.y"
{ BinaryOp(yyvsp[-2].ivalue,yyvsp[0].ivalue,yyval.ivalue,<); ;
    break;}
case 68:
#line 909 "parse.y"
{ BinaryOp(yyvsp[-2].ivalue,yyvsp[0].ivalue,yyval.ivalue,<=); ;
    break;}
case 69:
#line 910 "parse.y"
{ BinaryOp(yyvsp[-2].ivalue,yyvsp[0].ivalue,yyval.ivalue,>); ;
    break;}
case 70:
#line 911 "parse.y"
{ BinaryOp(yyvsp[-2].ivalue,yyvsp[0].ivalue,yyval.ivalue,>=); ;
    break;}
case 71:
#line 915 "parse.y"
{ yyval.intval = yyvsp[0].intval; ;
    break;}
case 72:
#line 916 "parse.y"
{ yyval.intval = yyvsp[0].intval; ;
    break;}
case 73:
#line 917 "parse.y"
{ yyval.intval = -yyvsp[0].intval; ;
    break;}
case 74:
#line 918 "parse.y"
{ yyval.intval = yyvsp[0].charval; ;
    break;}
case 75:
#line 923 "parse.y"
{
		if (!ConstExpr(yyvsp[0].ivalue))
			uerror("constant expression required");
		else
			yyval.floatval = (double) ConstExprVal(yyvsp[0].ivalue);
	;
    break;}
case 76:
#line 929 "parse.y"
{ yyval.floatval = yyvsp[0].floatval; ;
    break;}
case 77:
#line 930 "parse.y"
{ yyval.floatval = yyvsp[0].floatval; ;
    break;}
case 78:
#line 931 "parse.y"
{ yyval.floatval = -yyvsp[0].floatval; ;
    break;}
case 80:
#line 937 "parse.y"
{
		yyval.textval.chars = GetMem(yyval.textval.len = yyvsp[-1].textval.len + yyvsp[0].textval.len);
		memcpy(yyval.textval.chars, yyvsp[-1].textval.chars, yyvsp[-1].textval.len);
		memcpy(yyval.textval.chars + yyvsp[-1].textval.len, yyvsp[0].textval.chars, yyvsp[0].textval.len);
		free(yyvsp[-1].textval.chars);
		free(yyvsp[0].textval.chars);
	;
    break;}
case 81:
#line 950 "parse.y"
{
		yyval.idlist.u.id = yyvsp[0].id;
		yyval.idlist.next = NULL;
	;
    break;}
case 82:
#line 955 "parse.y"
{
		yyval.idlist.u.id = yyvsp[-2].id;
		yyval.idlist.next = NewOpaque(List);
		yyval.idlist.next->u.id = yyvsp[0].idlist.u.id;
	 	yyval.idlist.next->next = yyvsp[0].idlist.next;
	;
    break;}
case 83:
#line 965 "parse.y"
{
		yyval.ivlist.u.ivalue = yyvsp[0].ivalue;
		yyval.ivlist.next = NULL;
	;
    break;}
case 84:
#line 970 "parse.y"
{
		yyval.ivlist.u.ivalue = yyvsp[-2].ivalue;
		yyval.ivlist.next = NewOpaque(List);
		yyval.ivlist.next->u.ivalue = yyvsp[0].ivlist.u.ivalue;
		yyval.ivlist.next->next = yyvsp[0].ivlist.next;
	;
    break;}
case 85:
#line 980 "parse.y"
{
		yyval.flist.u.fvalue = yyvsp[0].floatval;
		yyval.flist.next = NULL;
	;
    break;}
case 86:
#line 985 "parse.y"
{
		yyval.flist.u.fvalue = yyvsp[-2].floatval;
		yyval.flist.next = NewOpaque(List);
		yyval.flist.next->u.fvalue = yyvsp[0].flist.u.fvalue;
		yyval.flist.next->next = yyvsp[0].flist.next;
	;
    break;}
}
   /* the action file gets copied in in place of this dollarsign */
#line 465 "/usr/sww/lib/bison/bison.simple"

  yyvsp -= yylen;
  yyssp -= yylen;
#ifdef YYLSP_NEEDED
  yylsp -= yylen;
#endif

#if YYDEBUG != 0
  if (yydebug)
    {
      short *ssp1 = yyss - 1;
      fprintf (stderr, "state stack now");
      while (ssp1 != yyssp)
	fprintf (stderr, " %d", *++ssp1);
      fprintf (stderr, "\n");
    }
#endif

  *++yyvsp = yyval;

#ifdef YYLSP_NEEDED
  yylsp++;
  if (yylen == 0)
    {
      yylsp->first_line = yylloc.first_line;
      yylsp->first_column = yylloc.first_column;
      yylsp->last_line = (yylsp-1)->last_line;
      yylsp->last_column = (yylsp-1)->last_column;
      yylsp->text = 0;
    }
  else
    {
      yylsp->last_line = (yylsp+yylen-1)->last_line;
      yylsp->last_column = (yylsp+yylen-1)->last_column;
    }
#endif

  /* Now "shift" the result of the reduction.
     Determine what state that goes to,
     based on the state we popped back to
     and the rule number reduced by.  */

  yyn = yyr1[yyn];

  yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
  if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
    yystate = yytable[yystate];
  else
    yystate = yydefgoto[yyn - YYNTBASE];

  goto yynewstate;

yyerrlab:   /* here on detecting error */

  if (! yyerrstatus)
    /* If not already recovering from an error, report this error.  */
    {
      ++yynerrs;

#ifdef YYERROR_VERBOSE
      yyn = yypact[yystate];

      if (yyn > YYFLAG && yyn < YYLAST)
	{
	  int size = 0;
	  char *msg;
	  int x, count;

	  count = 0;
	  /* Start X at -yyn if nec to avoid negative indexes in yycheck.  */
	  for (x = (yyn < 0 ? -yyn : 0);
	       x < (sizeof(yytname) / sizeof(char *)); x++)
	    if (yycheck[x + yyn] == x)
	      size += strlen(yytname[x]) + 15, count++;
	  msg = (char *) malloc(size + 15);
	  if (msg != 0)
	    {
	      strcpy(msg, "parse error");

	      if (count < 5)
		{
		  count = 0;
		  for (x = (yyn < 0 ? -yyn : 0);
		       x < (sizeof(yytname) / sizeof(char *)); x++)
		    if (yycheck[x + yyn] == x)
		      {
			strcat(msg, count == 0 ? ", expecting `" : " or `");
			strcat(msg, yytname[x]);
			strcat(msg, "'");
			count++;
		      }
		}
	      yyerror(msg);
	      free(msg);
	    }
	  else
	    yyerror ("parse error; also virtual memory exceeded");
	}
      else
#endif /* YYERROR_VERBOSE */
	yyerror("parse error");
    }

  goto yyerrlab1;
yyerrlab1:   /* here on error raised explicitly by an action */

  if (yyerrstatus == 3)
    {
      /* if just tried and failed to reuse lookahead token after an error, discard it.  */

      /* return failure if at end of input */
      if (yychar == YYEOF)
	YYABORT;

#if YYDEBUG != 0
      if (yydebug)
	fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
#endif

      yychar = YYEMPTY;
    }

  /* Else will try to reuse lookahead token
     after shifting the error token.  */

  yyerrstatus = 3;		/* Each real token shifted decrements this */

  goto yyerrhandle;

yyerrdefault:  /* current state does not do anything special for the error token. */

#if 0
  /* This is wrong; only states that explicitly want error tokens
     should shift them.  */
  yyn = yydefact[yystate];  /* If its default is to accept any token, ok.  Otherwise pop it.*/
  if (yyn) goto yydefault;
#endif

yyerrpop:   /* pop the current state because it cannot handle the error token */

  if (yyssp == yyss) YYABORT;
  yyvsp--;
  yystate = *--yyssp;
#ifdef YYLSP_NEEDED
  yylsp--;
#endif

#if YYDEBUG != 0
  if (yydebug)
    {
      short *ssp1 = yyss - 1;
      fprintf (stderr, "Error: state stack now");
      while (ssp1 != yyssp)
	fprintf (stderr, " %d", *++ssp1);
      fprintf (stderr, "\n");
    }
#endif

yyerrhandle:

  yyn = yypact[yystate];
  if (yyn == YYFLAG)
    goto yyerrdefault;

  yyn += YYTERROR;
  if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
    goto yyerrdefault;

  yyn = yytable[yyn];
  if (yyn < 0)
    {
      if (yyn == YYFLAG)
	goto yyerrpop;
      yyn = -yyn;
      goto yyreduce;
    }
  else if (yyn == 0)
    goto yyerrpop;

  if (yyn == YYFINAL)
    YYACCEPT;

#if YYDEBUG != 0
  if (yydebug)
    fprintf(stderr, "Shifting error token, ");
#endif

  *++yyvsp = yylval;
#ifdef YYLSP_NEEDED
  *++yylsp = yylloc;
#endif

  yystate = yyn;
  goto yynewstate;
}
#line 994 "parse.y"
