Imported Upstream version 2.3.1
[debian/as31] / as31 / parser.c
1 /* A Bison parser, made by GNU Bison 1.875d.  */
2
3 /* Skeleton parser for Yacc-like parsing with Bison,
4    Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
5
6    This program is free software; you can redistribute it and/or modify
7    it under the terms of the GNU General Public License as published by
8    the Free Software Foundation; either version 2, or (at your option)
9    any later version.
10
11    This program is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14    GNU General Public License for more details.
15
16    You should have received a copy of the GNU General Public License
17    along with this program; if not, write to the Free Software
18    Foundation, Inc., 59 Temple Place - Suite 330,
19    Boston, MA 02111-1307, USA.  */
20
21 /* As a special exception, when this file is copied by Bison into a
22    Bison output file, you may use that output file without restriction.
23    This special exception was added by the Free Software Foundation
24    in version 1.24 of Bison.  */
25
26 /* Written by Richard Stallman by simplifying the original so called
27    ``semantic'' parser.  */
28
29 /* All symbols defined below should begin with yy or YY, to avoid
30    infringing on user name space.  This should be done even for local
31    variables, as they might otherwise be expanded by user macros.
32    There are some unavoidable exceptions within include files to
33    define necessary library symbols; they are noted "INFRINGES ON
34    USER NAME SPACE" below.  */
35
36 /* Identify Bison output.  */
37 #define YYBISON 1
38
39 /* Skeleton name.  */
40 #define YYSKELETON_NAME "yacc.c"
41
42 /* Pure parsers.  */
43 #define YYPURE 0
44
45 /* Using locations.  */
46 #define YYLSP_NEEDED 0
47
48
49
50 /* Tokens.  */
51 #ifndef YYTOKENTYPE
52 # define YYTOKENTYPE
53    /* Put the tokens into the symbol table, so that GDB and other debuggers
54       know about them.  */
55    enum yytokentype {
56      STRING = 258,
57      D_ORG = 259,
58      D_BYTE = 260,
59      D_WORD = 261,
60      D_SKIP = 262,
61      D_EQU = 263,
62      D_FLAG = 264,
63      D_END = 265,
64      ACALL = 266,
65      ADD = 267,
66      ADDC = 268,
67      AJMP = 269,
68      ANL = 270,
69      CJNE = 271,
70      CLR = 272,
71      CPL = 273,
72      DA = 274,
73      DEC = 275,
74      DIV = 276,
75      DJNZ = 277,
76      INC = 278,
77      JB = 279,
78      JBC = 280,
79      JC = 281,
80      JMP = 282,
81      JNB = 283,
82      JNC = 284,
83      JNZ = 285,
84      JZ = 286,
85      LCALL = 287,
86      LJMP = 288,
87      MOV = 289,
88      MOVC = 290,
89      MOVX = 291,
90      NOP = 292,
91      MUL = 293,
92      ORL = 294,
93      POP = 295,
94      PUSH = 296,
95      RET = 297,
96      RETI = 298,
97      RL = 299,
98      RLC = 300,
99      RR = 301,
100      RRC = 302,
101      SETB = 303,
102      SJMP = 304,
103      SUBB = 305,
104      SWAP = 306,
105      XCH = 307,
106      XCHD = 308,
107      XRL = 309,
108      AB = 310,
109      A = 311,
110      C = 312,
111      PC = 313,
112      DPTR = 314,
113      BITPOS = 315,
114      R0 = 316,
115      R1 = 317,
116      R2 = 318,
117      R3 = 319,
118      R4 = 320,
119      R5 = 321,
120      R6 = 322,
121      R7 = 323,
122      VALUE = 324,
123      SYMBOL = 325
124    };
125 #endif
126 #define STRING 258
127 #define D_ORG 259
128 #define D_BYTE 260
129 #define D_WORD 261
130 #define D_SKIP 262
131 #define D_EQU 263
132 #define D_FLAG 264
133 #define D_END 265
134 #define ACALL 266
135 #define ADD 267
136 #define ADDC 268
137 #define AJMP 269
138 #define ANL 270
139 #define CJNE 271
140 #define CLR 272
141 #define CPL 273
142 #define DA 274
143 #define DEC 275
144 #define DIV 276
145 #define DJNZ 277
146 #define INC 278
147 #define JB 279
148 #define JBC 280
149 #define JC 281
150 #define JMP 282
151 #define JNB 283
152 #define JNC 284
153 #define JNZ 285
154 #define JZ 286
155 #define LCALL 287
156 #define LJMP 288
157 #define MOV 289
158 #define MOVC 290
159 #define MOVX 291
160 #define NOP 292
161 #define MUL 293
162 #define ORL 294
163 #define POP 295
164 #define PUSH 296
165 #define RET 297
166 #define RETI 298
167 #define RL 299
168 #define RLC 300
169 #define RR 301
170 #define RRC 302
171 #define SETB 303
172 #define SJMP 304
173 #define SUBB 305
174 #define SWAP 306
175 #define XCH 307
176 #define XCHD 308
177 #define XRL 309
178 #define AB 310
179 #define A 311
180 #define C 312
181 #define PC 313
182 #define DPTR 314
183 #define BITPOS 315
184 #define R0 316
185 #define R1 317
186 #define R2 318
187 #define R3 319
188 #define R4 320
189 #define R5 321
190 #define R6 322
191 #define R7 323
192 #define VALUE 324
193 #define SYMBOL 325
194
195
196
197
198 /* Copy the first part of user declarations.  */
199 #line 21 "parser.y"
200
201
202 #include <stdio.h>
203 #include <stdlib.h>
204
205 #define NOPE
206 #include "as31.h"
207 #undef NOPE
208
209 #define YYSTYPE union ystack
210
211 static unsigned char bytebuf[1024];             /* used by dumplist() */
212 static int bytecount;
213
214
215 void yyerror(const char *s);
216 int makeop(struct opcode * op, struct mode *m, int add);
217 void inclc(int i);
218 char *padline(char *line);
219 void dumplist(char *txt, int show);
220 void genbyte(int b);
221 void genstr(const char *s);
222 void genword(unsigned long w);
223
224 /* ------------------------ G R A M M E R ----------------------------- */
225
226
227
228 /* Enabling traces.  */
229 #ifndef YYDEBUG
230 # define YYDEBUG 0
231 #endif
232
233 /* Enabling verbose error messages.  */
234 #ifdef YYERROR_VERBOSE
235 # undef YYERROR_VERBOSE
236 # define YYERROR_VERBOSE 1
237 #else
238 # define YYERROR_VERBOSE 0
239 #endif
240
241 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
242 typedef int YYSTYPE;
243 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
244 # define YYSTYPE_IS_DECLARED 1
245 # define YYSTYPE_IS_TRIVIAL 1
246 #endif
247
248
249
250 /* Copy the second part of user declarations.  */
251
252
253 /* Line 214 of yacc.c.  */
254 #line 255 "y.tab.c"
255
256 #if ! defined (yyoverflow) || YYERROR_VERBOSE
257
258 # ifndef YYFREE
259 #  define YYFREE free
260 # endif
261 # ifndef YYMALLOC
262 #  define YYMALLOC malloc
263 # endif
264
265 /* The parser invokes alloca or malloc; define the necessary symbols.  */
266
267 # ifdef YYSTACK_USE_ALLOCA
268 #  if YYSTACK_USE_ALLOCA
269 #   define YYSTACK_ALLOC alloca
270 #  endif
271 # else
272 #  if defined (alloca) || defined (_ALLOCA_H)
273 #   define YYSTACK_ALLOC alloca
274 #  else
275 #   ifdef __GNUC__
276 #    define YYSTACK_ALLOC __builtin_alloca
277 #   endif
278 #  endif
279 # endif
280
281 # ifdef YYSTACK_ALLOC
282    /* Pacify GCC's `empty if-body' warning. */
283 #  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
284 # else
285 #  if defined (__STDC__) || defined (__cplusplus)
286 #   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
287 #   define YYSIZE_T size_t
288 #  endif
289 #  define YYSTACK_ALLOC YYMALLOC
290 #  define YYSTACK_FREE YYFREE
291 # endif
292 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
293
294
295 #if (! defined (yyoverflow) \
296      && (! defined (__cplusplus) \
297          || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
298
299 /* A type that is properly aligned for any stack member.  */
300 union yyalloc
301 {
302   short int yyss;
303   YYSTYPE yyvs;
304   };
305
306 /* The size of the maximum gap between one aligned stack and the next.  */
307 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
308
309 /* The size of an array large to enough to hold all stacks, each with
310    N elements.  */
311 # define YYSTACK_BYTES(N) \
312      ((N) * (sizeof (short int) + sizeof (YYSTYPE))                     \
313       + YYSTACK_GAP_MAXIMUM)
314
315 /* Copy COUNT objects from FROM to TO.  The source and destination do
316    not overlap.  */
317 # ifndef YYCOPY
318 #  if defined (__GNUC__) && 1 < __GNUC__
319 #   define YYCOPY(To, From, Count) \
320       __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
321 #  else
322 #   define YYCOPY(To, From, Count)              \
323       do                                        \
324         {                                       \
325           register YYSIZE_T yyi;                \
326           for (yyi = 0; yyi < (Count); yyi++)   \
327             (To)[yyi] = (From)[yyi];            \
328         }                                       \
329       while (0)
330 #  endif
331 # endif
332
333 /* Relocate STACK from its old location to the new one.  The
334    local variables YYSIZE and YYSTACKSIZE give the old and new number of
335    elements in the stack, and YYPTR gives the new location of the
336    stack.  Advance YYPTR to a properly aligned location for the next
337    stack.  */
338 # define YYSTACK_RELOCATE(Stack)                                        \
339     do                                                                  \
340       {                                                                 \
341         YYSIZE_T yynewbytes;                                            \
342         YYCOPY (&yyptr->Stack, Stack, yysize);                          \
343         Stack = &yyptr->Stack;                                          \
344         yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
345         yyptr += yynewbytes / sizeof (*yyptr);                          \
346       }                                                                 \
347     while (0)
348
349 #endif
350
351 #if defined (__STDC__) || defined (__cplusplus)
352    typedef signed char yysigned_char;
353 #else
354    typedef short int yysigned_char;
355 #endif
356
357 /* YYFINAL -- State number of the termination state. */
358 #define YYFINAL  155
359 /* YYLAST -- Last index in YYTABLE.  */
360 #define YYLAST   599
361
362 /* YYNTOKENS -- Number of terminals. */
363 #define YYNTOKENS  89
364 /* YYNNTS -- Number of nonterminals. */
365 #define YYNNTS  35
366 /* YYNRULES -- Number of rules. */
367 #define YYNRULES  165
368 /* YYNRULES -- Number of states. */
369 #define YYNSTATES  316
370
371 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
372 #define YYUNDEFTOK  2
373 #define YYMAXUTOK   325
374
375 #define YYTRANSLATE(YYX)                                                \
376   ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
377
378 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX.  */
379 static const unsigned char yytranslate[] =
380 {
381        0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
382       81,     2,     2,     2,     2,     2,     2,     2,     2,     2,
383        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
384        2,     2,     2,    88,     2,    87,     2,    75,    77,     2,
385       84,    85,    73,    71,    83,    72,    82,    74,     2,     2,
386        2,     2,     2,     2,     2,     2,     2,     2,    80,     2,
387       79,     2,    78,     2,    86,     2,     2,     2,     2,     2,
388        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
389        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
390        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
391        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
392        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
393        2,     2,     2,     2,    76,     2,     2,     2,     2,     2,
394        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
395        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
396        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
397        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
398        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
399        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
400        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
401        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
402        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
403        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
404        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
405        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
406        2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
407        5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
408       15,    16,    17,    18,    19,    20,    21,    22,    23,    24,
409       25,    26,    27,    28,    29,    30,    31,    32,    33,    34,
410       35,    36,    37,    38,    39,    40,    41,    42,    43,    44,
411       45,    46,    47,    48,    49,    50,    51,    52,    53,    54,
412       55,    56,    57,    58,    59,    60,    61,    62,    63,    64,
413       65,    66,    67,    68,    69,    70
414 };
415
416 #if YYDEBUG
417 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
418    YYRHS.  */
419 static const unsigned short int yyprhs[] =
420 {
421        0,     0,     3,     5,     8,    10,    14,    16,    19,    22,
422       24,    25,    29,    33,    37,    41,    45,    51,    57,    60,
423       62,    65,    67,    69,    71,    75,    79,    81,    83,    87,
424       89,    91,    95,    98,   102,   106,   110,   114,   118,   122,
425      126,   131,   136,   138,   140,   142,   145,   148,   151,   154,
426      157,   160,   163,   166,   169,   172,   175,   178,   181,   184,
427      187,   190,   193,   196,   199,   205,   211,   214,   216,   218,
428      221,   224,   227,   230,   233,   236,   239,   242,   245,   248,
429      251,   254,   257,   260,   263,   266,   269,   272,   275,   278,
430      281,   284,   287,   290,   293,   296,   304,   312,   320,   328,
431      334,   340,   346,   352,   356,   360,   365,   370,   374,   379,
432      383,   388,   393,   397,   401,   405,   409,   413,   418,   422,
433      426,   431,   436,   441,   447,   452,   456,   460,   465,   467,
434      469,   471,   474,   476,   478,   480,   486,   493,   500,   508,
435      510,   512,   515,   517,   519,   521,   523,   525,   527,   529,
436      531,   533,   535,   537,   539,   541,   543,   545,   547,   549,
437      551,   553,   555,   557,   559,   561
438 };
439
440 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
441 static const yysigned_char yyrhs[] =
442 {
443       90,     0,    -1,    91,    -1,    91,    92,    -1,    92,    -1,
444       99,    80,    93,    -1,    93,    -1,    95,    81,    -1,   103,
445       81,    -1,    81,    -1,    -1,     1,    94,    81,    -1,    82,
446        4,    96,    -1,    82,     5,   100,    -1,    82,     6,   101,
447       -1,    82,     7,    96,    -1,    82,     8,    99,    83,   102,
448       -1,    82,     9,    70,    83,    97,    -1,    82,    10,    -1,
449      102,    -1,    98,    60,    -1,    70,    -1,    69,    -1,    70,
450       -1,   100,    83,   119,    -1,   100,    83,     3,    -1,   119,
451       -1,     3,    -1,   101,    83,   120,    -1,   120,    -1,    73,
452       -1,    84,   102,    85,    -1,    72,   102,    -1,   102,    76,
453      102,    -1,   102,    77,   102,    -1,   102,    73,   102,    -1,
454      102,    74,   102,    -1,   102,    75,   102,    -1,   102,    72,
455      102,    -1,   102,    71,   102,    -1,   102,    78,    78,   102,
456       -1,   102,    79,    79,   102,    -1,    70,    -1,    69,    -1,
457       37,    -1,    11,   121,    -1,    14,   121,    -1,    12,   104,
458       -1,    13,   104,    -1,    50,   104,    -1,    54,   104,    -1,
459       54,   105,    -1,    15,   104,    -1,    15,   105,    -1,    15,
460      106,    -1,    39,   104,    -1,    39,   105,    -1,    39,   106,
461       -1,    52,   104,    -1,    23,   110,    -1,    23,    59,    -1,
462       20,   110,    -1,    19,    56,    -1,    21,    55,    -1,    27,
463       86,    56,    71,    59,    -1,    27,    86,    59,    71,    56,
464       -1,    38,    55,    -1,    42,    -1,    43,    -1,    44,    56,
465       -1,    45,    56,    -1,    46,    56,    -1,    47,    56,    -1,
466       51,    56,    -1,    53,   104,    -1,    17,   111,    -1,    18,
467      111,    -1,    48,   111,    -1,    41,   119,    -1,    40,   119,
468       -1,    33,   122,    -1,    32,   122,    -1,    26,   123,    -1,
469       29,   123,    -1,    30,   123,    -1,    31,   123,    -1,    49,
470      123,    -1,    16,   112,    -1,    24,   107,    -1,    28,   107,
471       -1,    25,   107,    -1,    22,   108,    -1,    34,   104,    -1,
472       34,   105,    -1,    34,   109,    -1,    35,    56,    83,    86,
473       56,    71,    59,    -1,    35,    56,    83,    86,    59,    71,
474       56,    -1,    35,    56,    83,    86,    56,    71,    58,    -1,
475       35,    56,    83,    86,    58,    71,    56,    -1,    36,    56,
476       83,    86,   118,    -1,    36,    56,    83,    86,    59,    -1,
477       36,    86,   118,    83,    56,    -1,    36,    86,    59,    83,
478       56,    -1,    56,    83,   117,    -1,    56,    83,   119,    -1,
479       56,    83,    86,   118,    -1,    56,    83,    87,   119,    -1,
480      119,    83,    56,    -1,   119,    83,    87,   119,    -1,    57,
481       83,   115,    -1,    57,    83,    74,   115,    -1,    57,    83,
482       88,   115,    -1,   115,    83,   113,    -1,   117,    83,   114,
483       -1,   119,    83,   113,    -1,   117,    83,    56,    -1,   117,
484       83,   119,    -1,   117,    83,    87,   119,    -1,   119,    83,
485      117,    -1,   119,    83,   119,    -1,   119,    83,    86,   118,
486       -1,    86,   118,    83,    56,    -1,    86,   118,    83,   119,
487       -1,    86,   118,    83,    87,   119,    -1,    59,    83,    87,
488      120,    -1,    57,    83,   115,    -1,   119,    83,    57,    -1,
489      119,    60,    83,    57,    -1,    56,    -1,   117,    -1,   119,
490       -1,    86,   118,    -1,    56,    -1,    57,    -1,   115,    -1,
491       56,    83,   119,    83,   113,    -1,    56,    83,    87,   119,
492       83,   113,    -1,   117,    83,    87,   119,    83,   113,    -1,
493       86,   118,    83,    87,   119,    83,   113,    -1,   102,    -1,
494      102,    -1,   116,    60,    -1,   116,    -1,    70,    -1,    69,
495       -1,    61,    -1,    62,    -1,    63,    -1,    64,    -1,    65,
496       -1,    66,    -1,    67,    -1,    68,    -1,    61,    -1,    62,
497       -1,    63,    -1,    64,    -1,    65,    -1,    66,    -1,    67,
498       -1,    68,    -1,   102,    -1,   102,    -1,   102,    -1,   102,
499       -1,   102,    -1
500 };
501
502 /* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
503 static const unsigned short int yyrline[] =
504 {
505        0,   126,   126,   131,   132,   135,   145,   148,   153,   159,
506      164,   164,   183,   190,   191,   192,   195,   204,   210,   213,
507      223,   236,   242,   246,   254,   259,   270,   275,   287,   292,
508      306,   309,   312,   315,   318,   321,   324,   327,   330,   333,
509      336,   339,   341,   354,   366,   368,   370,   372,   374,   376,
510      378,   380,   382,   384,   386,   388,   390,   392,   394,   399,
511      401,   403,   405,   407,   409,   411,   413,   415,   417,   419,
512      421,   423,   425,   427,   429,   433,   435,   437,   441,   450,
513      459,   461,   463,   465,   467,   469,   471,   473,   475,   477,
514      479,   481,   483,   485,   487,   491,   493,   495,   497,   500,
515      502,   504,   506,   518,   524,   531,   537,   546,   553,   563,
516      570,   577,   586,   596,   603,   613,   619,   626,   633,   640,
517      648,   655,   661,   668,   675,   683,   699,   706,   725,   732,
518      738,   745,   753,   759,   765,   774,   782,   790,   798,   808,
519      825,   838,   851,   861,   867,   870,   871,   872,   873,   874,
520      875,   876,   877,   880,   881,   882,   885,   888,   891,   894,
521      897,   902,   912,   922,   937,   951
522 };
523 #endif
524
525 #if YYDEBUG || YYERROR_VERBOSE
526 /* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
527    First, the terminals, then, starting at YYNTOKENS, nonterminals. */
528 static const char *const yytname[] =
529 {
530   "$end", "error", "$undefined", "STRING", "D_ORG", "D_BYTE", "D_WORD",
531   "D_SKIP", "D_EQU", "D_FLAG", "D_END", "ACALL", "ADD", "ADDC", "AJMP",
532   "ANL", "CJNE", "CLR", "CPL", "DA", "DEC", "DIV", "DJNZ", "INC", "JB",
533   "JBC", "JC", "JMP", "JNB", "JNC", "JNZ", "JZ", "LCALL", "LJMP", "MOV",
534   "MOVC", "MOVX", "NOP", "MUL", "ORL", "POP", "PUSH", "RET", "RETI", "RL",
535   "RLC", "RR", "RRC", "SETB", "SJMP", "SUBB", "SWAP", "XCH", "XCHD", "XRL",
536   "AB", "A", "C", "PC", "DPTR", "BITPOS", "R0", "R1", "R2", "R3", "R4",
537   "R5", "R6", "R7", "VALUE", "SYMBOL", "'+'", "'-'", "'*'", "'/'", "'%'",
538   "'|'", "'&'", "'>'", "'<'", "':'", "'\\n'", "'.'", "','", "'('", "')'",
539   "'@'", "'#'", "'!'", "$accept", "program", "linelist", "line",
540   "linerest", "@1", "directive", "defexpr", "flag", "flagv", "undefsym",
541   "blist", "wlist", "expr", "instr", "two_op1", "two_op2", "two_op3",
542   "two_op4", "two_op5", "two_op6", "single_op1", "single_op2", "three_op1",
543   "rel", "rel2", "bit", "bitv", "reg", "regi", "data8", "data16", "addr11",
544   "addr16", "relative", 0
545 };
546 #endif
547
548 # ifdef YYPRINT
549 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
550    token YYLEX-NUM.  */
551 static const unsigned short int yytoknum[] =
552 {
553        0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
554      265,   266,   267,   268,   269,   270,   271,   272,   273,   274,
555      275,   276,   277,   278,   279,   280,   281,   282,   283,   284,
556      285,   286,   287,   288,   289,   290,   291,   292,   293,   294,
557      295,   296,   297,   298,   299,   300,   301,   302,   303,   304,
558      305,   306,   307,   308,   309,   310,   311,   312,   313,   314,
559      315,   316,   317,   318,   319,   320,   321,   322,   323,   324,
560      325,    43,    45,    42,    47,    37,   124,    38,    62,    60,
561       58,    10,    46,    44,    40,    41,    64,    35,    33
562 };
563 # endif
564
565 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
566 static const unsigned char yyr1[] =
567 {
568        0,    89,    90,    91,    91,    92,    92,    93,    93,    93,
569       94,    93,    95,    95,    95,    95,    95,    95,    95,    96,
570       97,    98,    98,    99,   100,   100,   100,   100,   101,   101,
571      102,   102,   102,   102,   102,   102,   102,   102,   102,   102,
572      102,   102,   102,   102,   103,   103,   103,   103,   103,   103,
573      103,   103,   103,   103,   103,   103,   103,   103,   103,   103,
574      103,   103,   103,   103,   103,   103,   103,   103,   103,   103,
575      103,   103,   103,   103,   103,   103,   103,   103,   103,   103,
576      103,   103,   103,   103,   103,   103,   103,   103,   103,   103,
577      103,   103,   103,   103,   103,   103,   103,   103,   103,   103,
578      103,   103,   103,   104,   104,   104,   104,   105,   105,   106,
579      106,   106,   107,   108,   108,   109,   109,   109,   109,   109,
580      109,   109,   109,   109,   109,   109,   109,   109,   110,   110,
581      110,   110,   111,   111,   111,   112,   112,   112,   112,   113,
582      114,   115,   115,   116,   116,   117,   117,   117,   117,   117,
583      117,   117,   117,   118,   118,   118,   118,   118,   118,   118,
584      118,   119,   120,   121,   122,   123
585 };
586
587 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
588 static const unsigned char yyr2[] =
589 {
590        0,     2,     1,     2,     1,     3,     1,     2,     2,     1,
591        0,     3,     3,     3,     3,     3,     5,     5,     2,     1,
592        2,     1,     1,     1,     3,     3,     1,     1,     3,     1,
593        1,     3,     2,     3,     3,     3,     3,     3,     3,     3,
594        4,     4,     1,     1,     1,     2,     2,     2,     2,     2,
595        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
596        2,     2,     2,     2,     5,     5,     2,     1,     1,     2,
597        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
598        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
599        2,     2,     2,     2,     2,     7,     7,     7,     7,     5,
600        5,     5,     5,     3,     3,     4,     4,     3,     4,     3,
601        4,     4,     3,     3,     3,     3,     3,     4,     3,     3,
602        4,     4,     4,     5,     4,     3,     3,     4,     1,     1,
603        1,     2,     1,     1,     1,     5,     6,     6,     7,     1,
604        1,     2,     1,     1,     1,     1,     1,     1,     1,     1,
605        1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
606        1,     1,     1,     1,     1,     1
607 };
608
609 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
610    STATE-NUM when YYTABLE doesn't specify something else to do.  Zero
611    means the default is an error.  */
612 static const unsigned char yydefact[] =
613 {
614        0,    10,     0,     0,     0,     0,     0,     0,     0,     0,
615        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
616        0,     0,     0,     0,     0,     0,     0,     0,    44,     0,
617        0,     0,     0,    67,    68,     0,     0,     0,     0,     0,
618        0,     0,     0,     0,     0,     0,    23,     9,     0,     0,
619        0,     4,     6,     0,     0,     0,     0,    43,    42,     0,
620       30,     0,   163,    45,     0,    47,    48,    46,     0,   161,
621       52,    53,    54,     0,     0,   145,   146,   147,   148,   149,
622      150,   151,   152,     0,    87,     0,   132,   133,   144,   143,
623       75,   134,   142,    76,    62,   128,     0,    61,   129,   130,
624       63,    91,     0,     0,    60,    59,    88,     0,    90,   165,
625       82,     0,    89,    83,    84,    85,   164,    81,    80,     0,
626        0,     0,    92,    93,    94,     0,     0,     0,     0,     0,
627       66,    55,    56,    57,    79,    78,    69,    70,    71,    72,
628       77,    86,    49,    73,    58,    74,    50,    51,     0,     0,
629        0,     0,     0,     0,    18,     1,     3,     7,     0,     8,
630       11,    32,     0,     0,     0,     0,     0,     0,     0,     0,
631        0,     0,     0,     0,     0,     0,   153,   154,   155,   156,
632      157,   158,   159,   160,     0,     0,   141,   131,     0,     0,
633        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
634        0,     0,     0,    12,    19,    27,    13,    26,    14,   162,
635       29,    15,     0,     0,     5,    31,    39,    38,    35,    36,
636       37,    33,    34,     0,     0,     0,     0,   103,   104,     0,
637        0,   109,   107,     0,     0,     0,     0,     0,   140,   113,
638      139,   114,   112,     0,     0,   125,     0,     0,   115,     0,
639      116,     0,   126,     0,   118,   119,     0,     0,     0,     0,
640        0,     0,     0,     0,    40,    41,   105,   106,   110,   111,
641      108,     0,     0,     0,     0,    64,    65,   124,   121,     0,
642      122,   117,   127,   120,     0,     0,     0,   100,    99,   102,
643      101,    25,    24,    28,    16,    22,    21,    17,     0,     0,
644      135,     0,     0,   123,     0,     0,     0,    20,   136,     0,
645      137,    97,    95,    98,    96,   138
646 };
647
648 /* YYDEFGOTO[NTERM-NUM]. */
649 static const short int yydefgoto[] =
650 {
651       -1,    49,    50,    51,    52,    56,    53,   203,   297,   298,
652       54,   206,   208,    69,    55,    65,    71,    72,   106,   101,
653      124,    97,    90,    84,   241,   239,    91,    92,    98,   184,
654       73,   210,    63,   117,   110
655 };
656
657 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
658    STATE-NUM.  */
659 #define YYPACT_NINF -239
660 static const short int yypact[] =
661 {
662      370,  -239,   139,   -24,   -24,   139,   120,    70,    15,    15,
663      -19,   470,   -12,   292,   441,    23,    23,   139,   -45,    23,
664      139,   139,   139,   139,   139,   222,    -9,   -26,  -239,    14,
665      120,   139,   139,  -239,  -239,    19,    25,    31,    49,    15,
666      139,   -24,    54,   -24,   -24,    85,  -239,  -239,   440,    89,
667      298,  -239,  -239,   -27,    37,    38,    41,  -239,  -239,   139,
668     -239,   139,   513,  -239,    64,  -239,  -239,  -239,    67,   513,
669     -239,  -239,  -239,    68,    77,  -239,  -239,  -239,  -239,  -239,
670     -239,  -239,  -239,   454,  -239,    87,  -239,  -239,  -239,  -239,
671     -239,  -239,    83,  -239,  -239,  -239,   454,  -239,  -239,  -239,
672     -239,  -239,    90,    91,  -239,  -239,  -239,   101,  -239,   513,
673     -239,   -30,  -239,  -239,  -239,  -239,   513,  -239,  -239,   102,
674      108,   454,  -239,  -239,  -239,   111,   -50,   115,   124,   485,
675     -239,  -239,  -239,  -239,  -239,  -239,  -239,  -239,  -239,  -239,
676     -239,  -239,  -239,  -239,  -239,  -239,  -239,  -239,   139,     4,
677      139,   139,   140,   143,  -239,  -239,  -239,  -239,   442,  -239,
678     -239,   104,   354,   139,   139,   139,   139,   139,   139,   139,
679       75,   145,   496,   126,   -47,   133,  -239,  -239,  -239,  -239,
680     -239,  -239,  -239,  -239,   135,   132,  -239,  -239,   139,   139,
681      139,   154,   155,    23,   141,   144,   -17,   147,    34,   146,
682      148,   150,   152,  -239,   513,  -239,   156,  -239,   158,   513,
683     -239,  -239,   159,   160,  -239,  -239,   520,   520,   104,   104,
684      104,    30,    30,   139,   139,   454,   139,  -239,  -239,    23,
685       23,  -239,  -239,   139,   139,   162,   151,   139,   513,  -239,
686      513,  -239,  -239,   172,   190,  -239,   139,    55,  -239,   139,
687     -239,   191,  -239,   454,  -239,  -239,    56,   511,   193,   195,
688       10,   139,   139,    60,  -239,  -239,  -239,  -239,  -239,  -239,
689     -239,   164,   139,   139,   170,  -239,  -239,  -239,  -239,   139,
690     -239,  -239,  -239,  -239,   183,   184,   185,  -239,  -239,  -239,
691     -239,  -239,  -239,  -239,   513,  -239,  -239,  -239,   197,   139,
692     -239,   175,   139,  -239,    86,   205,   206,  -239,  -239,   139,
693     -239,  -239,  -239,  -239,  -239,  -239
694 };
695
696 /* YYPGOTO[NTERM-NUM].  */
697 static const short int yypgoto[] =
698 {
699     -239,  -239,  -239,   214,   107,  -239,  -239,   116,  -239,  -239,
700      114,  -239,  -239,    -2,  -239,    21,    33,   238,    26,  -239,
701     -239,   255,    22,  -239,  -186,  -239,   -14,  -239,    -1,   -85,
702        3,  -238,   266,   248,    28
703 };
704
705 /* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
706    positive, shift that token.  If negative, reduce the rule which
707    number is the opposite.  If zero, do what YYDEFACT says.
708    If YYTABLE_NINF, syntax error.  */
709 #define YYTABLE_NINF -3
710 static const short int yytable[] =
711 {
712       62,   107,   107,    62,   242,   107,    85,   205,   277,   232,
713      197,   187,   102,   291,    99,   109,   103,    99,   109,   109,
714      109,   116,   116,   293,   125,    66,   191,    70,   126,   192,
715      128,    93,    64,   198,   134,   135,   195,    94,   109,   248,
716      233,   111,   108,   100,   202,   112,   122,   127,   113,   114,
717      115,   131,    57,    58,   157,    59,    60,   161,   123,   162,
718      129,   140,   142,   132,   144,   145,   146,    61,   141,   130,
719      249,    86,    87,    57,    58,   136,    59,    60,   147,    57,
720       58,   137,    59,    60,    88,    89,   300,   138,    61,   155,
721      232,   252,    88,    89,    61,    75,    76,    77,    78,    79,
722       80,    81,    82,    57,    58,   139,    59,    60,   170,   171,
723      143,   278,   284,   308,   285,   286,   310,   158,    61,   159,
724      253,   233,   160,   315,    57,    58,    74,    59,    60,   295,
725      296,    75,    76,    77,    78,    79,    80,    81,    82,    61,
726      266,    64,   279,   186,   311,   312,   204,   172,   209,   204,
727      173,   174,   207,   223,    57,    58,    83,    59,    60,   231,
728      175,   216,   217,   218,   219,   220,   221,   222,   283,    61,
729      185,   227,   288,   188,   189,   228,    64,    68,   235,   245,
730      168,   169,   170,   171,   190,   193,   238,   240,   240,    57,
731       58,   194,    59,    60,   196,    88,    89,   254,   199,   250,
732      229,   255,    57,    58,    61,    59,    60,   200,    57,    58,
733       46,    59,    60,   213,   230,   268,   269,    61,   236,   237,
734      234,   264,   265,    61,   224,   243,   244,   247,   246,   267,
735      251,   275,   256,   258,   257,   259,   270,   271,   273,   260,
736      274,   261,   262,   263,   209,   272,   276,   299,   282,   289,
737      280,   290,   281,   302,   304,   305,   306,   307,   309,   209,
738      294,   313,   314,   292,   156,   214,   212,   211,   133,   105,
739      240,    67,   118,     0,     0,     0,   301,     0,    64,   119,
740        0,   120,   303,    75,    76,    77,    78,    79,    80,    81,
741       82,    57,    58,     0,    59,    60,     0,   240,    -2,     1,
742      240,     0,     0,     0,     0,     0,    61,   240,   121,     2,
743        3,     4,     5,     6,     7,     8,     9,    10,    11,    12,
744       13,    14,    15,    16,    17,    18,    19,    20,    21,    22,
745       23,    24,    25,    26,    27,    28,    29,    30,    31,    32,
746       33,    34,    35,    36,    37,    38,    39,    40,    41,    42,
747       43,    44,    45,    75,    76,    77,    78,    79,    80,    81,
748       82,    57,    58,     0,    59,    60,     0,     0,    46,     0,
749        0,     1,     0,     0,     0,     0,    61,     0,     0,    47,
750       48,     2,     3,     4,     5,     6,     7,     8,     9,    10,
751       11,    12,    13,    14,    15,    16,    17,    18,    19,    20,
752       21,    22,    23,    24,    25,    26,    27,    28,    29,    30,
753       31,    32,    33,    34,    35,    36,    37,    38,    39,    40,
754       41,    42,    43,    44,    45,   163,   164,   165,   166,   167,
755      168,   169,   170,   171,     0,     0,     0,     0,     0,   215,
756       46,     0,     0,     1,   148,   149,   150,   151,   152,   153,
757      154,    47,    48,     2,     3,     4,     5,     6,     7,     8,
758        9,    10,    11,    12,    13,    14,    15,    16,    17,    18,
759       19,    20,    21,    22,    23,    24,    25,    26,    27,    28,
760       29,    30,    31,    32,    33,    34,    35,    36,    37,    38,
761       39,    40,    41,    42,    43,    44,    45,    95,     0,     0,
762      104,     0,    75,    76,    77,    78,    79,    80,    81,    82,
763       57,    58,     0,    59,    60,   176,   177,   178,   179,   180,
764      181,   182,   183,    47,    48,    61,    95,    96,     0,     0,
765        0,    75,    76,    77,    78,    79,    80,    81,    82,    57,
766       58,     0,    59,    60,   201,     0,   176,   177,   178,   179,
767      180,   181,   182,   183,    61,     0,    96,    75,    76,    77,
768       78,    79,    80,    81,    82,    57,    58,     0,    59,    60,
769      287,     0,   176,   177,   178,   179,   180,   181,   182,   183,
770       61,     0,   225,   226,   163,   164,   165,   166,   167,   168,
771      169,   170,   171,   165,   166,   167,   168,   169,   170,   171
772 };
773
774 static const short int yycheck[] =
775 {
776        2,    15,    16,     5,   190,    19,     7,     3,   246,    56,
777       60,    96,    13,     3,    11,    17,    13,    14,    20,    21,
778       22,    23,    24,   261,    25,     4,    56,     6,    25,    59,
779       56,     9,    56,    83,    31,    32,   121,    56,    40,    56,
780       87,    86,    16,    55,   129,    19,    25,    56,    20,    21,
781       22,    30,    69,    70,    81,    72,    73,    59,    25,    61,
782       86,    39,    41,    30,    43,    44,    45,    84,    40,    55,
783       87,    56,    57,    69,    70,    56,    72,    73,    45,    69,
784       70,    56,    72,    73,    69,    70,   272,    56,    84,     0,
785       56,    57,    69,    70,    84,    61,    62,    63,    64,    65,
786       66,    67,    68,    69,    70,    56,    72,    73,    78,    79,
787       56,    56,    56,   299,    58,    59,   302,    80,    84,    81,
788       86,    87,    81,   309,    69,    70,    56,    72,    73,    69,
789       70,    61,    62,    63,    64,    65,    66,    67,    68,    84,
790      225,    56,    87,    60,    58,    59,   148,    83,   150,   151,
791       83,    83,   149,    78,    69,    70,    86,    72,    73,   173,
792       83,   163,   164,   165,   166,   167,   168,   169,   253,    84,
793       83,   172,   257,    83,    83,   172,    56,    57,   175,   193,
794       76,    77,    78,    79,    83,    83,   188,   189,   190,    69,
795       70,    83,    72,    73,    83,    69,    70,   198,    83,   196,
796       74,   198,    69,    70,    84,    72,    73,    83,    69,    70,
797       70,    72,    73,    70,    88,   229,   230,    84,    83,    87,
798       87,   223,   224,    84,    79,    71,    71,    83,    87,   226,
799       83,    59,    86,    83,    86,    83,   233,   234,    87,    83,
800      237,    83,    83,    83,   246,    83,    56,    83,    57,    56,
801      247,    56,   249,    83,    71,    71,    71,    60,    83,   261,
802      262,    56,    56,   260,    50,   158,   152,   151,    30,    14,
803      272,     5,    24,    -1,    -1,    -1,   273,    -1,    56,    57,
804       -1,    59,   279,    61,    62,    63,    64,    65,    66,    67,
805       68,    69,    70,    -1,    72,    73,    -1,   299,     0,     1,
806      302,    -1,    -1,    -1,    -1,    -1,    84,   309,    86,    11,
807       12,    13,    14,    15,    16,    17,    18,    19,    20,    21,
808       22,    23,    24,    25,    26,    27,    28,    29,    30,    31,
809       32,    33,    34,    35,    36,    37,    38,    39,    40,    41,
810       42,    43,    44,    45,    46,    47,    48,    49,    50,    51,
811       52,    53,    54,    61,    62,    63,    64,    65,    66,    67,
812       68,    69,    70,    -1,    72,    73,    -1,    -1,    70,    -1,
813       -1,     1,    -1,    -1,    -1,    -1,    84,    -1,    -1,    81,
814       82,    11,    12,    13,    14,    15,    16,    17,    18,    19,
815       20,    21,    22,    23,    24,    25,    26,    27,    28,    29,
816       30,    31,    32,    33,    34,    35,    36,    37,    38,    39,
817       40,    41,    42,    43,    44,    45,    46,    47,    48,    49,
818       50,    51,    52,    53,    54,    71,    72,    73,    74,    75,
819       76,    77,    78,    79,    -1,    -1,    -1,    -1,    -1,    85,
820       70,    -1,    -1,     1,     4,     5,     6,     7,     8,     9,
821       10,    81,    82,    11,    12,    13,    14,    15,    16,    17,
822       18,    19,    20,    21,    22,    23,    24,    25,    26,    27,
823       28,    29,    30,    31,    32,    33,    34,    35,    36,    37,
824       38,    39,    40,    41,    42,    43,    44,    45,    46,    47,
825       48,    49,    50,    51,    52,    53,    54,    56,    -1,    -1,
826       59,    -1,    61,    62,    63,    64,    65,    66,    67,    68,
827       69,    70,    -1,    72,    73,    61,    62,    63,    64,    65,
828       66,    67,    68,    81,    82,    84,    56,    86,    -1,    -1,
829       -1,    61,    62,    63,    64,    65,    66,    67,    68,    69,
830       70,    -1,    72,    73,    59,    -1,    61,    62,    63,    64,
831       65,    66,    67,    68,    84,    -1,    86,    61,    62,    63,
832       64,    65,    66,    67,    68,    69,    70,    -1,    72,    73,
833       59,    -1,    61,    62,    63,    64,    65,    66,    67,    68,
834       84,    -1,    86,    87,    71,    72,    73,    74,    75,    76,
835       77,    78,    79,    73,    74,    75,    76,    77,    78,    79
836 };
837
838 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
839    symbol of state STATE-NUM.  */
840 static const unsigned char yystos[] =
841 {
842        0,     1,    11,    12,    13,    14,    15,    16,    17,    18,
843       19,    20,    21,    22,    23,    24,    25,    26,    27,    28,
844       29,    30,    31,    32,    33,    34,    35,    36,    37,    38,
845       39,    40,    41,    42,    43,    44,    45,    46,    47,    48,
846       49,    50,    51,    52,    53,    54,    70,    81,    82,    90,
847       91,    92,    93,    95,    99,   103,    94,    69,    70,    72,
848       73,    84,   102,   121,    56,   104,   104,   121,    57,   102,
849      104,   105,   106,   119,    56,    61,    62,    63,    64,    65,
850       66,    67,    68,    86,   112,   117,    56,    57,    69,    70,
851      111,   115,   116,   111,    56,    56,    86,   110,   117,   119,
852       55,   108,   117,   119,    59,   110,   107,   115,   107,   102,
853      123,    86,   107,   123,   123,   123,   102,   122,   122,    57,
854       59,    86,   104,   105,   109,   117,   119,    56,    56,    86,
855       55,   104,   105,   106,   119,   119,    56,    56,    56,    56,
856      111,   123,   104,    56,   104,   104,   104,   105,     4,     5,
857        6,     7,     8,     9,    10,     0,    92,    81,    80,    81,
858       81,   102,   102,    71,    72,    73,    74,    75,    76,    77,
859       78,    79,    83,    83,    83,    83,    61,    62,    63,    64,
860       65,    66,    67,    68,   118,    83,    60,   118,    83,    83,
861       83,    56,    59,    83,    83,   118,    83,    60,    83,    83,
862       83,    59,   118,    96,   102,     3,   100,   119,   101,   102,
863      120,    96,    99,    70,    93,    85,   102,   102,   102,   102,
864      102,   102,   102,    78,    79,    86,    87,   117,   119,    74,
865       88,   115,    56,    87,    87,   119,    83,    87,   102,   114,
866      102,   113,   113,    71,    71,   115,    87,    83,    56,    87,
867      119,    83,    57,    86,   117,   119,    86,    86,    83,    83,
868       83,    83,    83,    83,   102,   102,   118,   119,   115,   115,
869      119,   119,    83,    87,   119,    59,    56,   120,    56,    87,
870      119,   119,    57,   118,    56,    58,    59,    59,   118,    56,
871       56,     3,   119,   120,   102,    69,    70,    97,    98,    83,
872      113,   119,    83,   119,    71,    71,    71,    60,   113,    83,
873      113,    58,    59,    56,    56,   113
874 };
875
876 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
877 # define YYSIZE_T __SIZE_TYPE__
878 #endif
879 #if ! defined (YYSIZE_T) && defined (size_t)
880 # define YYSIZE_T size_t
881 #endif
882 #if ! defined (YYSIZE_T)
883 # if defined (__STDC__) || defined (__cplusplus)
884 #  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
885 #  define YYSIZE_T size_t
886 # endif
887 #endif
888 #if ! defined (YYSIZE_T)
889 # define YYSIZE_T unsigned int
890 #endif
891
892 #define yyerrok         (yyerrstatus = 0)
893 #define yyclearin       (yychar = YYEMPTY)
894 #define YYEMPTY         (-2)
895 #define YYEOF           0
896
897 #define YYACCEPT        goto yyacceptlab
898 #define YYABORT         goto yyabortlab
899 #define YYERROR         goto yyerrorlab
900
901
902 /* Like YYERROR except do call yyerror.  This remains here temporarily
903    to ease the transition to the new meaning of YYERROR, for GCC.
904    Once GCC version 2 has supplanted version 1, this can go.  */
905
906 #define YYFAIL          goto yyerrlab
907
908 #define YYRECOVERING()  (!!yyerrstatus)
909
910 #define YYBACKUP(Token, Value)                                  \
911 do                                                              \
912   if (yychar == YYEMPTY && yylen == 1)                          \
913     {                                                           \
914       yychar = (Token);                                         \
915       yylval = (Value);                                         \
916       yytoken = YYTRANSLATE (yychar);                           \
917       YYPOPSTACK;                                               \
918       goto yybackup;                                            \
919     }                                                           \
920   else                                                          \
921     {                                                           \
922       yyerror ("syntax error: cannot back up");\
923       YYERROR;                                                  \
924     }                                                           \
925 while (0)
926
927 #define YYTERROR        1
928 #define YYERRCODE       256
929
930 /* YYLLOC_DEFAULT -- Compute the default location (before the actions
931    are run).  */
932
933 #ifndef YYLLOC_DEFAULT
934 # define YYLLOC_DEFAULT(Current, Rhs, N)                \
935    ((Current).first_line   = (Rhs)[1].first_line,       \
936     (Current).first_column = (Rhs)[1].first_column,     \
937     (Current).last_line    = (Rhs)[N].last_line,        \
938     (Current).last_column  = (Rhs)[N].last_column)
939 #endif
940
941 /* YYLEX -- calling `yylex' with the right arguments.  */
942
943 #ifdef YYLEX_PARAM
944 # define YYLEX yylex (YYLEX_PARAM)
945 #else
946 # define YYLEX yylex ()
947 #endif
948
949 /* Enable debugging if requested.  */
950 #if YYDEBUG
951
952 # ifndef YYFPRINTF
953 #  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
954 #  define YYFPRINTF fprintf
955 # endif
956
957 # define YYDPRINTF(Args)                        \
958 do {                                            \
959   if (yydebug)                                  \
960     YYFPRINTF Args;                             \
961 } while (0)
962
963 # define YYDSYMPRINT(Args)                      \
964 do {                                            \
965   if (yydebug)                                  \
966     yysymprint Args;                            \
967 } while (0)
968
969 # define YYDSYMPRINTF(Title, Token, Value, Location)            \
970 do {                                                            \
971   if (yydebug)                                                  \
972     {                                                           \
973       YYFPRINTF (stderr, "%s ", Title);                         \
974       yysymprint (stderr,                                       \
975                   Token, Value);        \
976       YYFPRINTF (stderr, "\n");                                 \
977     }                                                           \
978 } while (0)
979
980 /*------------------------------------------------------------------.
981 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
982 | TOP (included).                                                   |
983 `------------------------------------------------------------------*/
984
985 #if defined (__STDC__) || defined (__cplusplus)
986 static void
987 yy_stack_print (short int *bottom, short int *top)
988 #else
989 static void
990 yy_stack_print (bottom, top)
991     short int *bottom;
992     short int *top;
993 #endif
994 {
995   YYFPRINTF (stderr, "Stack now");
996   for (/* Nothing. */; bottom <= top; ++bottom)
997     YYFPRINTF (stderr, " %d", *bottom);
998   YYFPRINTF (stderr, "\n");
999 }
1000
1001 # define YY_STACK_PRINT(Bottom, Top)                            \
1002 do {                                                            \
1003   if (yydebug)                                                  \
1004     yy_stack_print ((Bottom), (Top));                           \
1005 } while (0)
1006
1007
1008 /*------------------------------------------------.
1009 | Report that the YYRULE is going to be reduced.  |
1010 `------------------------------------------------*/
1011
1012 #if defined (__STDC__) || defined (__cplusplus)
1013 static void
1014 yy_reduce_print (int yyrule)
1015 #else
1016 static void
1017 yy_reduce_print (yyrule)
1018     int yyrule;
1019 #endif
1020 {
1021   int yyi;
1022   unsigned int yylno = yyrline[yyrule];
1023   YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ",
1024              yyrule - 1, yylno);
1025   /* Print the symbols being reduced, and their result.  */
1026   for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
1027     YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]);
1028   YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]);
1029 }
1030
1031 # define YY_REDUCE_PRINT(Rule)          \
1032 do {                                    \
1033   if (yydebug)                          \
1034     yy_reduce_print (Rule);             \
1035 } while (0)
1036
1037 /* Nonzero means print parse trace.  It is left uninitialized so that
1038    multiple parsers can coexist.  */
1039 int yydebug;
1040 #else /* !YYDEBUG */
1041 # define YYDPRINTF(Args)
1042 # define YYDSYMPRINT(Args)
1043 # define YYDSYMPRINTF(Title, Token, Value, Location)
1044 # define YY_STACK_PRINT(Bottom, Top)
1045 # define YY_REDUCE_PRINT(Rule)
1046 #endif /* !YYDEBUG */
1047
1048
1049 /* YYINITDEPTH -- initial size of the parser's stacks.  */
1050 #ifndef YYINITDEPTH
1051 # define YYINITDEPTH 200
1052 #endif
1053
1054 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1055    if the built-in stack extension method is used).
1056
1057    Do not make this value too large; the results are undefined if
1058    SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
1059    evaluated with infinite-precision integer arithmetic.  */
1060
1061 #if defined (YYMAXDEPTH) && YYMAXDEPTH == 0
1062 # undef YYMAXDEPTH
1063 #endif
1064
1065 #ifndef YYMAXDEPTH
1066 # define YYMAXDEPTH 10000
1067 #endif
1068
1069 \f
1070
1071 #if YYERROR_VERBOSE
1072
1073 # ifndef yystrlen
1074 #  if defined (__GLIBC__) && defined (_STRING_H)
1075 #   define yystrlen strlen
1076 #  else
1077 /* Return the length of YYSTR.  */
1078 static YYSIZE_T
1079 #   if defined (__STDC__) || defined (__cplusplus)
1080 yystrlen (const char *yystr)
1081 #   else
1082 yystrlen (yystr)
1083      const char *yystr;
1084 #   endif
1085 {
1086   register const char *yys = yystr;
1087
1088   while (*yys++ != '\0')
1089     continue;
1090
1091   return yys - yystr - 1;
1092 }
1093 #  endif
1094 # endif
1095
1096 # ifndef yystpcpy
1097 #  if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
1098 #   define yystpcpy stpcpy
1099 #  else
1100 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1101    YYDEST.  */
1102 static char *
1103 #   if defined (__STDC__) || defined (__cplusplus)
1104 yystpcpy (char *yydest, const char *yysrc)
1105 #   else
1106 yystpcpy (yydest, yysrc)
1107      char *yydest;
1108      const char *yysrc;
1109 #   endif
1110 {
1111   register char *yyd = yydest;
1112   register const char *yys = yysrc;
1113
1114   while ((*yyd++ = *yys++) != '\0')
1115     continue;
1116
1117   return yyd - 1;
1118 }
1119 #  endif
1120 # endif
1121
1122 #endif /* !YYERROR_VERBOSE */
1123
1124 \f
1125
1126 #if YYDEBUG
1127 /*--------------------------------.
1128 | Print this symbol on YYOUTPUT.  |
1129 `--------------------------------*/
1130
1131 #if defined (__STDC__) || defined (__cplusplus)
1132 static void
1133 yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
1134 #else
1135 static void
1136 yysymprint (yyoutput, yytype, yyvaluep)
1137     FILE *yyoutput;
1138     int yytype;
1139     YYSTYPE *yyvaluep;
1140 #endif
1141 {
1142   /* Pacify ``unused variable'' warnings.  */
1143   (void) yyvaluep;
1144
1145   if (yytype < YYNTOKENS)
1146     {
1147       YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
1148 # ifdef YYPRINT
1149       YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
1150 # endif
1151     }
1152   else
1153     YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
1154
1155   switch (yytype)
1156     {
1157       default:
1158         break;
1159     }
1160   YYFPRINTF (yyoutput, ")");
1161 }
1162
1163 #endif /* ! YYDEBUG */
1164 /*-----------------------------------------------.
1165 | Release the memory associated to this symbol.  |
1166 `-----------------------------------------------*/
1167
1168 #if defined (__STDC__) || defined (__cplusplus)
1169 static void
1170 yydestruct (int yytype, YYSTYPE *yyvaluep)
1171 #else
1172 static void
1173 yydestruct (yytype, yyvaluep)
1174     int yytype;
1175     YYSTYPE *yyvaluep;
1176 #endif
1177 {
1178   /* Pacify ``unused variable'' warnings.  */
1179   (void) yyvaluep;
1180
1181   switch (yytype)
1182     {
1183
1184       default:
1185         break;
1186     }
1187 }
1188 \f
1189
1190 /* Prevent warnings from -Wmissing-prototypes.  */
1191
1192 #ifdef YYPARSE_PARAM
1193 # if defined (__STDC__) || defined (__cplusplus)
1194 int yyparse (void *YYPARSE_PARAM);
1195 # else
1196 int yyparse ();
1197 # endif
1198 #else /* ! YYPARSE_PARAM */
1199 #if defined (__STDC__) || defined (__cplusplus)
1200 int yyparse (void);
1201 #else
1202 int yyparse ();
1203 #endif
1204 #endif /* ! YYPARSE_PARAM */
1205
1206
1207
1208 /* The lookahead symbol.  */
1209 int yychar;
1210
1211 /* The semantic value of the lookahead symbol.  */
1212 YYSTYPE yylval;
1213
1214 /* Number of syntax errors so far.  */
1215 int yynerrs;
1216
1217
1218
1219 /*----------.
1220 | yyparse.  |
1221 `----------*/
1222
1223 #ifdef YYPARSE_PARAM
1224 # if defined (__STDC__) || defined (__cplusplus)
1225 int yyparse (void *YYPARSE_PARAM)
1226 # else
1227 int yyparse (YYPARSE_PARAM)
1228   void *YYPARSE_PARAM;
1229 # endif
1230 #else /* ! YYPARSE_PARAM */
1231 #if defined (__STDC__) || defined (__cplusplus)
1232 int
1233 yyparse (void)
1234 #else
1235 int
1236 yyparse ()
1237
1238 #endif
1239 #endif
1240 {
1241   
1242   register int yystate;
1243   register int yyn;
1244   int yyresult;
1245   /* Number of tokens to shift before error messages enabled.  */
1246   int yyerrstatus;
1247   /* Lookahead token as an internal (translated) token number.  */
1248   int yytoken = 0;
1249
1250   /* Three stacks and their tools:
1251      `yyss': related to states,
1252      `yyvs': related to semantic values,
1253      `yyls': related to locations.
1254
1255      Refer to the stacks thru separate pointers, to allow yyoverflow
1256      to reallocate them elsewhere.  */
1257
1258   /* The state stack.  */
1259   short int yyssa[YYINITDEPTH];
1260   short int *yyss = yyssa;
1261   register short int *yyssp;
1262
1263   /* The semantic value stack.  */
1264   YYSTYPE yyvsa[YYINITDEPTH];
1265   YYSTYPE *yyvs = yyvsa;
1266   register YYSTYPE *yyvsp;
1267
1268
1269
1270 #define YYPOPSTACK   (yyvsp--, yyssp--)
1271
1272   YYSIZE_T yystacksize = YYINITDEPTH;
1273
1274   /* The variables used to return semantic value and location from the
1275      action routines.  */
1276   YYSTYPE yyval;
1277
1278
1279   /* When reducing, the number of symbols on the RHS of the reduced
1280      rule.  */
1281   int yylen;
1282
1283   YYDPRINTF ((stderr, "Starting parse\n"));
1284
1285   yystate = 0;
1286   yyerrstatus = 0;
1287   yynerrs = 0;
1288   yychar = YYEMPTY;             /* Cause a token to be read.  */
1289
1290   /* Initialize stack pointers.
1291      Waste one element of value and location stack
1292      so that they stay on the same level as the state stack.
1293      The wasted elements are never initialized.  */
1294
1295   yyssp = yyss;
1296   yyvsp = yyvs;
1297
1298
1299   goto yysetstate;
1300
1301 /*------------------------------------------------------------.
1302 | yynewstate -- Push a new state, which is found in yystate.  |
1303 `------------------------------------------------------------*/
1304  yynewstate:
1305   /* In all cases, when you get here, the value and location stacks
1306      have just been pushed. so pushing a state here evens the stacks.
1307      */
1308   yyssp++;
1309
1310  yysetstate:
1311   *yyssp = yystate;
1312
1313   if (yyss + yystacksize - 1 <= yyssp)
1314     {
1315       /* Get the current used size of the three stacks, in elements.  */
1316       YYSIZE_T yysize = yyssp - yyss + 1;
1317
1318 #ifdef yyoverflow
1319       {
1320         /* Give user a chance to reallocate the stack. Use copies of
1321            these so that the &'s don't force the real ones into
1322            memory.  */
1323         YYSTYPE *yyvs1 = yyvs;
1324         short int *yyss1 = yyss;
1325
1326
1327         /* Each stack pointer address is followed by the size of the
1328            data in use in that stack, in bytes.  This used to be a
1329            conditional around just the two extra args, but that might
1330            be undefined if yyoverflow is a macro.  */
1331         yyoverflow ("parser stack overflow",
1332                     &yyss1, yysize * sizeof (*yyssp),
1333                     &yyvs1, yysize * sizeof (*yyvsp),
1334
1335                     &yystacksize);
1336
1337         yyss = yyss1;
1338         yyvs = yyvs1;
1339       }
1340 #else /* no yyoverflow */
1341 # ifndef YYSTACK_RELOCATE
1342       goto yyoverflowlab;
1343 # else
1344       /* Extend the stack our own way.  */
1345       if (YYMAXDEPTH <= yystacksize)
1346         goto yyoverflowlab;
1347       yystacksize *= 2;
1348       if (YYMAXDEPTH < yystacksize)
1349         yystacksize = YYMAXDEPTH;
1350
1351       {
1352         short int *yyss1 = yyss;
1353         union yyalloc *yyptr =
1354           (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1355         if (! yyptr)
1356           goto yyoverflowlab;
1357         YYSTACK_RELOCATE (yyss);
1358         YYSTACK_RELOCATE (yyvs);
1359
1360 #  undef YYSTACK_RELOCATE
1361         if (yyss1 != yyssa)
1362           YYSTACK_FREE (yyss1);
1363       }
1364 # endif
1365 #endif /* no yyoverflow */
1366
1367       yyssp = yyss + yysize - 1;
1368       yyvsp = yyvs + yysize - 1;
1369
1370
1371       YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1372                   (unsigned long int) yystacksize));
1373
1374       if (yyss + yystacksize - 1 <= yyssp)
1375         YYABORT;
1376     }
1377
1378   YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1379
1380   goto yybackup;
1381
1382 /*-----------.
1383 | yybackup.  |
1384 `-----------*/
1385 yybackup:
1386
1387 /* Do appropriate processing given the current state.  */
1388 /* Read a lookahead token if we need one and don't already have one.  */
1389 /* yyresume: */
1390
1391   /* First try to decide what to do without reference to lookahead token.  */
1392
1393   yyn = yypact[yystate];
1394   if (yyn == YYPACT_NINF)
1395     goto yydefault;
1396
1397   /* Not known => get a lookahead token if don't already have one.  */
1398
1399   /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol.  */
1400   if (yychar == YYEMPTY)
1401     {
1402       YYDPRINTF ((stderr, "Reading a token: "));
1403       yychar = YYLEX;
1404     }
1405
1406   if (yychar <= YYEOF)
1407     {
1408       yychar = yytoken = YYEOF;
1409       YYDPRINTF ((stderr, "Now at end of input.\n"));
1410     }
1411   else
1412     {
1413       yytoken = YYTRANSLATE (yychar);
1414       YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc);
1415     }
1416
1417   /* If the proper action on seeing token YYTOKEN is to reduce or to
1418      detect an error, take that action.  */
1419   yyn += yytoken;
1420   if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1421     goto yydefault;
1422   yyn = yytable[yyn];
1423   if (yyn <= 0)
1424     {
1425       if (yyn == 0 || yyn == YYTABLE_NINF)
1426         goto yyerrlab;
1427       yyn = -yyn;
1428       goto yyreduce;
1429     }
1430
1431   if (yyn == YYFINAL)
1432     YYACCEPT;
1433
1434   /* Shift the lookahead token.  */
1435   YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken]));
1436
1437   /* Discard the token being shifted unless it is eof.  */
1438   if (yychar != YYEOF)
1439     yychar = YYEMPTY;
1440
1441   *++yyvsp = yylval;
1442
1443
1444   /* Count tokens shifted since error; after three, turn off error
1445      status.  */
1446   if (yyerrstatus)
1447     yyerrstatus--;
1448
1449   yystate = yyn;
1450   goto yynewstate;
1451
1452
1453 /*-----------------------------------------------------------.
1454 | yydefault -- do the default action for the current state.  |
1455 `-----------------------------------------------------------*/
1456 yydefault:
1457   yyn = yydefact[yystate];
1458   if (yyn == 0)
1459     goto yyerrlab;
1460   goto yyreduce;
1461
1462
1463 /*-----------------------------.
1464 | yyreduce -- Do a reduction.  |
1465 `-----------------------------*/
1466 yyreduce:
1467   /* yyn is the number of a rule to reduce with.  */
1468   yylen = yyr2[yyn];
1469
1470   /* If YYLEN is nonzero, implement the default value of the action:
1471      `$$ = $1'.
1472
1473      Otherwise, the following line sets YYVAL to garbage.
1474      This behavior is undocumented and Bison
1475      users should not rely upon it.  Assigning to YYVAL
1476      unconditionally makes the parser a bit smaller, and it avoids a
1477      GCC warning that YYVAL may be used uninitialized.  */
1478   yyval = yyvsp[1-yylen];
1479
1480
1481   YY_REDUCE_PRINT (yyn);
1482   switch (yyn)
1483     {
1484         case 2:
1485 #line 127 "parser.y"
1486     {
1487 }
1488     break;
1489
1490   case 5:
1491 #line 136 "parser.y"
1492     {
1493         if (abort_asap) {YYABORT;}
1494         if( pass1 ) {
1495                 yyvsp[-2].sym->type = LABEL;
1496                 yyvsp[-2].sym->value = lc;
1497         }
1498         inclc(yyvsp[0].value);
1499         bytecount = 0;
1500 }
1501     break;
1502
1503   case 6:
1504 #line 145 "parser.y"
1505     { inclc(yyvsp[0].value); bytecount = 0; }
1506     break;
1507
1508   case 7:
1509 #line 148 "parser.y"
1510     {
1511                                                 yyval.value = yyvsp[-1].value;
1512                                                 if( dashl && pass2 )
1513                                                         dumplist(yyvsp[0].str,1);
1514                                         }
1515     break;
1516
1517   case 8:
1518 #line 153 "parser.y"
1519     {
1520                                                 yyval.value = yyvsp[-1].value;
1521                                                 if( dashl && pass2 )
1522                                                         dumplist(yyvsp[0].str,1);
1523
1524                                         }
1525     break;
1526
1527   case 9:
1528 #line 159 "parser.y"
1529     {
1530                                                 yyval.value = 0;
1531                                                 if( dashl && pass2 )
1532                                                         dumplist(yyvsp[0].str,0);
1533                                         }
1534     break;
1535
1536   case 10:
1537 #line 164 "parser.y"
1538     {
1539                                                 seek_eol();
1540                                         }
1541     break;
1542
1543   case 11:
1544 #line 167 "parser.y"
1545     {
1546                                                 yyval.value = 0;
1547                                                 if( dashl && pass2 )
1548                                                         dumplist(yyvsp[-2].str,0);
1549                                         }
1550     break;
1551
1552   case 12:
1553 #line 184 "parser.y"
1554     {
1555         lc = yyvsp[0].val.v;
1556         if( pass2 ) emitaddr(lc);
1557         bytecount = 0;
1558         yyval.value = 0;
1559 }
1560     break;
1561
1562   case 13:
1563 #line 190 "parser.y"
1564     { yyval.value = yyvsp[0].value; }
1565     break;
1566
1567   case 14:
1568 #line 191 "parser.y"
1569     { yyval.value = yyvsp[0].value; }
1570     break;
1571
1572   case 15:
1573 #line 192 "parser.y"
1574     { yyval.value = yyvsp[0].val.v;
1575                                           if( pass2 )
1576                                                 emitaddr(lc+yyval.value); }
1577     break;
1578
1579   case 16:
1580 #line 196 "parser.y"
1581     {
1582         if( yyvsp[0].val.d == 0 )
1583                 warn("Expression is undefined in pass 1");
1584         yyvsp[-2].sym->type = LABEL;
1585         yyvsp[-2].sym->value = yyvsp[0].val.v;
1586         yyval.value = 0;
1587 }
1588     break;
1589
1590   case 17:
1591 #line 205 "parser.y"
1592     {
1593         yyvsp[-2].sym->type = LABEL;
1594         yyvsp[-2].sym->value = yyvsp[0].value;
1595         yyval.value = 0;
1596 }
1597     break;
1598
1599   case 18:
1600 #line 210 "parser.y"
1601     { yyval.value = 0; }
1602     break;
1603
1604   case 19:
1605 #line 214 "parser.y"
1606     {
1607                 if( yyvsp[0].val.d == 0 )
1608                         warn("Expression is undefined in pass 1");
1609                 if( !(isbit16(yyvsp[0].val.v)) )
1610                         warn("Value greater than 16-bits");
1611                 yyval.value = yyvsp[0].val.v;
1612 }
1613     break;
1614
1615   case 20:
1616 #line 224 "parser.y"
1617     {
1618         if( !isbit8(yyvsp[-1].value) )
1619                 warn("Bit address exceeds 8-bits");
1620         if( isbmram(yyvsp[-1].value) )
1621                 yyval.value = (yyvsp[-1].value-0x20)*8+ yyvsp[0].value;
1622         else if( isbmsfr(yyvsp[-1].value) )
1623                 yyval.value = yyvsp[-1].value + yyvsp[0].value;
1624         else
1625                 warn("Invalid bit addressable RAM location");
1626 }
1627     break;
1628
1629   case 21:
1630 #line 237 "parser.y"
1631     {
1632         if( yyvsp[0].sym->type == UNDEF )
1633                 warn("Symbol %s must be defined in pass 1",yyvsp[0].sym->name);
1634         yyval.value = yyvsp[0].sym->value;
1635 }
1636     break;
1637
1638   case 22:
1639 #line 242 "parser.y"
1640     { yyval.value = yyvsp[0].value; }
1641     break;
1642
1643   case 23:
1644 #line 247 "parser.y"
1645     {
1646         if( yyvsp[0].sym->type != UNDEF && pass1)
1647                 warn("Attempt to redefine symbol: %s",yyvsp[0].sym->name);
1648         yyval.sym = yyvsp[0].sym;
1649 }
1650     break;
1651
1652   case 24:
1653 #line 255 "parser.y"
1654     {
1655         if( pass2 ) genbyte(yyvsp[0].value);
1656         yyval.value = yyvsp[-2].value + 1;
1657 }
1658     break;
1659
1660   case 25:
1661 #line 260 "parser.y"
1662     {
1663         if( pass1 )
1664                 yyval.value = yyvsp[-2].value + yyvsp[0].value;
1665         else {
1666                 yyval.value = yyvsp[-2].value + strlen(yyvsp[0].str);
1667                 genstr(yyvsp[0].str);
1668                 
1669                 free(yyvsp[0].str);
1670         }
1671 }
1672     break;
1673
1674   case 26:
1675 #line 271 "parser.y"
1676     {
1677         if( pass2 ) genbyte(yyvsp[0].value);
1678         yyval.value = 1;
1679 }
1680     break;
1681
1682   case 27:
1683 #line 276 "parser.y"
1684     {
1685         if( pass1 )
1686                 yyval.value = yyvsp[0].value;
1687         else {
1688                 yyval.value = strlen(yyvsp[0].str);
1689                 genstr(yyvsp[0].str);
1690                 free(yyvsp[0].str);
1691         }
1692 }
1693     break;
1694
1695   case 28:
1696 #line 288 "parser.y"
1697     {
1698         if( pass2 ) genword(yyvsp[0].value);
1699         yyval.value = yyvsp[-2].value + 2;
1700 }
1701     break;
1702
1703   case 29:
1704 #line 293 "parser.y"
1705     {
1706         if( pass2 ) genword(yyvsp[0].value);
1707         yyval.value = 2;
1708 }
1709     break;
1710
1711   case 30:
1712 #line 306 "parser.y"
1713     { yyval.val.v = lc;
1714                                           yyval.val.d = 1; }
1715     break;
1716
1717   case 31:
1718 #line 309 "parser.y"
1719     { yyval.val.v = yyvsp[-1].val.v;
1720                                           yyval.val.d = yyvsp[-1].val.d; }
1721     break;
1722
1723   case 32:
1724 #line 312 "parser.y"
1725     { yyval.val.v = -yyvsp[0].val.v;
1726                                           yyval.val.d = yyvsp[0].val.d;  }
1727     break;
1728
1729   case 33:
1730 #line 315 "parser.y"
1731     { yyval.val.v = yyvsp[-2].val.v | yyvsp[0].val.v;
1732                                           yyval.val.d = yyvsp[-2].val.d && yyvsp[0].val.d; }
1733     break;
1734
1735   case 34:
1736 #line 318 "parser.y"
1737     { yyval.val.v = yyvsp[-2].val.v & yyvsp[0].val.v;
1738                                           yyval.val.d = yyvsp[-2].val.d && yyvsp[0].val.d; }
1739     break;
1740
1741   case 35:
1742 #line 321 "parser.y"
1743     { yyval.val.v = yyvsp[-2].val.v * yyvsp[0].val.v;
1744                                           yyval.val.d = yyvsp[-2].val.d && yyvsp[0].val.d; }
1745     break;
1746
1747   case 36:
1748 #line 324 "parser.y"
1749     { yyval.val.v = yyvsp[-2].val.v / yyvsp[0].val.v;
1750                                           yyval.val.d = yyvsp[-2].val.d && yyvsp[0].val.d; }
1751     break;
1752
1753   case 37:
1754 #line 327 "parser.y"
1755     { yyval.val.v = yyvsp[-2].val.v % yyvsp[0].val.v;
1756                                           yyval.val.d = yyvsp[-2].val.d && yyvsp[0].val.d; }
1757     break;
1758
1759   case 38:
1760 #line 330 "parser.y"
1761     { yyval.val.v = yyvsp[-2].val.v - yyvsp[0].val.v;
1762                                           yyval.val.d = yyvsp[-2].val.d && yyvsp[0].val.d; }
1763     break;
1764
1765   case 39:
1766 #line 333 "parser.y"
1767     { yyval.val.v = yyvsp[-2].val.v + yyvsp[0].val.v;
1768                                           yyval.val.d = yyvsp[-2].val.d && yyvsp[0].val.d; }
1769     break;
1770
1771   case 40:
1772 #line 336 "parser.y"
1773     { yyval.val.v = yyvsp[-3].val.v >> yyvsp[0].val.v;
1774                                           yyval.val.d = yyvsp[-3].val.d && yyvsp[0].val.d; }
1775     break;
1776
1777   case 41:
1778 #line 339 "parser.y"
1779     { yyval.val.v = yyvsp[-3].val.v << yyvsp[0].val.v;
1780                                           yyval.val.d = yyvsp[-3].val.d && yyvsp[0].val.d; }
1781     break;
1782
1783   case 42:
1784 #line 342 "parser.y"
1785     {
1786         if( pass1 ) {
1787                 yyval.val.v = yyvsp[0].sym->value;
1788                 yyval.val.d = (yyvsp[0].sym->type != UNDEF);
1789         }
1790         else {
1791                 if( yyvsp[0].sym->type == UNDEF )
1792                         warn("Undefined symbol %s",yyvsp[0].sym->name);
1793                 yyval.val.v = yyvsp[0].sym->value;
1794                 yyval.val.d = 1;
1795         }
1796 }
1797     break;
1798
1799   case 43:
1800 #line 354 "parser.y"
1801     { yyval.val.v = yyvsp[0].val.v; yyval.val.d=1; }
1802     break;
1803
1804   case 44:
1805 #line 367 "parser.y"
1806     { yyval.value = makeop(yyvsp[0].op,NULL,0); }
1807     break;
1808
1809   case 45:
1810 #line 369 "parser.y"
1811     { yyval.value = makeop(yyvsp[-1].op,&yyvsp[0].mode,0); }
1812     break;
1813
1814   case 46:
1815 #line 371 "parser.y"
1816     { yyval.value = makeop(yyvsp[-1].op,&yyvsp[0].mode,0); }
1817     break;
1818
1819   case 47:
1820 #line 373 "parser.y"
1821     { yyval.value = makeop(yyvsp[-1].op,&yyvsp[0].mode,0); }
1822     break;
1823
1824   case 48:
1825 #line 375 "parser.y"
1826     { yyval.value = makeop(yyvsp[-1].op,&yyvsp[0].mode,0); }
1827     break;
1828
1829   case 49:
1830 #line 377 "parser.y"
1831     { yyval.value = makeop(yyvsp[-1].op,&yyvsp[0].mode,0); }
1832     break;
1833
1834   case 50:
1835 #line 379 "parser.y"
1836     { yyval.value = makeop(yyvsp[-1].op,&yyvsp[0].mode,0); }
1837     break;
1838
1839   case 51:
1840 #line 381 "parser.y"
1841     { yyval.value = makeop(yyvsp[-1].op,&yyvsp[0].mode,4); }
1842     break;
1843
1844   case 52:
1845 #line 383 "parser.y"
1846     { yyval.value = makeop(yyvsp[-1].op,&yyvsp[0].mode,0); }
1847     break;
1848
1849   case 53:
1850 #line 385 "parser.y"
1851     { yyval.value = makeop(yyvsp[-1].op,&yyvsp[0].mode,4); }
1852     break;
1853
1854   case 54:
1855 #line 387 "parser.y"
1856     { yyval.value = makeop(yyvsp[-1].op,&yyvsp[0].mode,6); }
1857     break;
1858
1859   case 55:
1860 #line 389 "parser.y"
1861     { yyval.value = makeop(yyvsp[-1].op,&yyvsp[0].mode,0); }
1862     break;
1863
1864   case 56:
1865 #line 391 "parser.y"
1866     { yyval.value = makeop(yyvsp[-1].op,&yyvsp[0].mode,4); }
1867     break;
1868
1869   case 57:
1870 #line 393 "parser.y"
1871     { yyval.value = makeop(yyvsp[-1].op,&yyvsp[0].mode,6); }
1872     break;
1873
1874   case 58:
1875 #line 395 "parser.y"
1876     { if( get_md(yyvsp[0].mode) == 3 )
1877                                         warn("Immediate mode is illegal");
1878                                   yyval.value = makeop(yyvsp[-1].op,&yyvsp[0].mode,0);
1879                                 }
1880     break;
1881
1882   case 59:
1883 #line 400 "parser.y"
1884     { yyval.value = makeop(yyvsp[-1].op,&yyvsp[0].mode,0); }
1885     break;
1886
1887   case 60:
1888 #line 402 "parser.y"
1889     { yyval.value = makeop(yyvsp[-1].op,NULL,4); }
1890     break;
1891
1892   case 61:
1893 #line 404 "parser.y"
1894     { yyval.value = makeop(yyvsp[-1].op,&yyvsp[0].mode,0); }
1895     break;
1896
1897   case 62:
1898 #line 406 "parser.y"
1899     { yyval.value = makeop(yyvsp[-1].op,NULL,0); }
1900     break;
1901
1902   case 63:
1903 #line 408 "parser.y"
1904     { yyval.value = makeop(yyvsp[-1].op,NULL,0); }
1905     break;
1906
1907   case 64:
1908 #line 410 "parser.y"
1909     { yyval.value = makeop(yyvsp[-4].op,NULL,0); }
1910     break;
1911
1912   case 65:
1913 #line 412 "parser.y"
1914     { yyval.value = makeop(yyvsp[-4].op,NULL,0); }
1915     break;
1916
1917   case 66:
1918 #line 414 "parser.y"
1919     { yyval.value = makeop(yyvsp[-1].op,NULL,0); }
1920     break;
1921
1922   case 67:
1923 #line 416 "parser.y"
1924     { yyval.value = makeop(yyvsp[0].op,NULL,0); }
1925     break;
1926
1927   case 68:
1928 #line 418 "parser.y"
1929     { yyval.value = makeop(yyvsp[0].op,NULL,0); }
1930     break;
1931
1932   case 69:
1933 #line 420 "parser.y"
1934     { yyval.value = makeop(yyvsp[-1].op,NULL,0); }
1935     break;
1936
1937   case 70:
1938 #line 422 "parser.y"
1939     { yyval.value = makeop(yyvsp[-1].op,NULL,0); }
1940     break;
1941
1942   case 71:
1943 #line 424 "parser.y"
1944     { yyval.value = makeop(yyvsp[-1].op,NULL,0); }
1945     break;
1946
1947   case 72:
1948 #line 426 "parser.y"
1949     { yyval.value = makeop(yyvsp[-1].op,NULL,0); }
1950     break;
1951
1952   case 73:
1953 #line 428 "parser.y"
1954     { yyval.value = makeop(yyvsp[-1].op,NULL,0); }
1955     break;
1956
1957   case 74:
1958 #line 430 "parser.y"
1959     { if( get_md(yyvsp[0].mode) != 2 )
1960                                         warn("Invalid addressing mode");
1961                                   yyval.value = makeop(yyvsp[-1].op,&yyvsp[0].mode,-2); }
1962     break;
1963
1964   case 75:
1965 #line 434 "parser.y"
1966     { yyval.value = makeop(yyvsp[-1].op,&yyvsp[0].mode,0); }
1967     break;
1968
1969   case 76:
1970 #line 436 "parser.y"
1971     { yyval.value = makeop(yyvsp[-1].op,&yyvsp[0].mode,0); }
1972     break;
1973
1974   case 77:
1975 #line 438 "parser.y"
1976     { if( get_md(yyvsp[0].mode) == 0 )
1977                                         warn("Invalid addressing mode");
1978                                   yyval.value = makeop(yyvsp[-1].op,&yyvsp[0].mode,-1); }
1979     break;
1980
1981   case 78:
1982 #line 442 "parser.y"
1983     {
1984                                    struct mode tmp;
1985                                         set_md(tmp,0);
1986                                         set_ov(tmp,0);
1987                                         set_sz(tmp,1);
1988                                         set_b1(tmp,yyvsp[0].value);
1989                                         yyval.value = makeop(yyvsp[-1].op,&tmp,0);
1990                                 }
1991     break;
1992
1993   case 79:
1994 #line 451 "parser.y"
1995     {
1996                                    struct mode tmp;
1997                                         set_md(tmp,0);
1998                                         set_ov(tmp,0);
1999                                         set_sz(tmp,1);
2000                                         set_b1(tmp,yyvsp[0].value);
2001                                         yyval.value = makeop(yyvsp[-1].op,&tmp,0);
2002                                 }
2003     break;
2004
2005   case 80:
2006 #line 460 "parser.y"
2007     { yyval.value = makeop(yyvsp[-1].op,&yyvsp[0].mode,0); }
2008     break;
2009
2010   case 81:
2011 #line 462 "parser.y"
2012     { yyval.value = makeop(yyvsp[-1].op,&yyvsp[0].mode,0); }
2013     break;
2014
2015   case 82:
2016 #line 464 "parser.y"
2017     { yyval.value = makeop(yyvsp[-1].op,&yyvsp[0].mode,0); }
2018     break;
2019
2020   case 83:
2021 #line 466 "parser.y"
2022     { yyval.value = makeop(yyvsp[-1].op,&yyvsp[0].mode,0); }
2023     break;
2024
2025   case 84:
2026 #line 468 "parser.y"
2027     { yyval.value = makeop(yyvsp[-1].op,&yyvsp[0].mode,0); }
2028     break;
2029
2030   case 85:
2031 #line 470 "parser.y"
2032     { yyval.value = makeop(yyvsp[-1].op,&yyvsp[0].mode,0); }
2033     break;
2034
2035   case 86:
2036 #line 472 "parser.y"
2037     { yyval.value = makeop(yyvsp[-1].op,&yyvsp[0].mode,0); }
2038     break;
2039
2040   case 87:
2041 #line 474 "parser.y"
2042     { yyval.value = makeop(yyvsp[-1].op,&yyvsp[0].mode,0); }
2043     break;
2044
2045   case 88:
2046 #line 476 "parser.y"
2047     { yyval.value = makeop(yyvsp[-1].op,&yyvsp[0].mode,0); }
2048     break;
2049
2050   case 89:
2051 #line 478 "parser.y"
2052     { yyval.value = makeop(yyvsp[-1].op,&yyvsp[0].mode,0); }
2053     break;
2054
2055   case 90:
2056 #line 480 "parser.y"
2057     { yyval.value = makeop(yyvsp[-1].op,&yyvsp[0].mode,0); }
2058     break;
2059
2060   case 91:
2061 #line 482 "parser.y"
2062     { yyval.value = makeop(yyvsp[-1].op,&yyvsp[0].mode,0); }
2063     break;
2064
2065   case 92:
2066 #line 484 "parser.y"
2067     { yyval.value = makeop(yyvsp[-1].op,&yyvsp[0].mode,0); }
2068     break;
2069
2070   case 93:
2071 #line 486 "parser.y"
2072     { yyval.value = makeop(yyvsp[-1].op,&yyvsp[0].mode,4); }
2073     break;
2074
2075   case 94:
2076 #line 488 "parser.y"
2077     { yyval.value = makeop(yyvsp[-1].op,&yyvsp[0].mode,6); }
2078     break;
2079
2080   case 95:
2081 #line 492 "parser.y"
2082     { yyval.value = makeop(yyvsp[-6].op,NULL,0); }
2083     break;
2084
2085   case 96:
2086 #line 494 "parser.y"
2087     { yyval.value = makeop(yyvsp[-6].op,NULL,0); }
2088     break;
2089
2090   case 97:
2091 #line 496 "parser.y"
2092     { yyval.value = makeop(yyvsp[-6].op,NULL,1); }
2093     break;
2094
2095   case 98:
2096 #line 498 "parser.y"
2097     { yyval.value = makeop(yyvsp[-6].op,NULL,1); }
2098     break;
2099
2100   case 99:
2101 #line 501 "parser.y"
2102     { yyval.value = makeop(yyvsp[-4].op,NULL,yyvsp[0].value); }
2103     break;
2104
2105   case 100:
2106 #line 503 "parser.y"
2107     { yyval.value = makeop(yyvsp[-4].op,NULL,2); }
2108     break;
2109
2110   case 101:
2111 #line 505 "parser.y"
2112     { yyval.value = makeop(yyvsp[-4].op,NULL,yyvsp[-2].value+3); }
2113     break;
2114
2115   case 102:
2116 #line 507 "parser.y"
2117     { yyval.value = makeop(yyvsp[-4].op,NULL,5); }
2118     break;
2119
2120   case 103:
2121 #line 519 "parser.y"
2122     {
2123                                         set_md(yyval.mode,0);
2124                                         set_ov(yyval.mode, yyvsp[0].value);
2125                                         set_sz(yyval.mode, 0);
2126                                 }
2127     break;
2128
2129   case 104:
2130 #line 525 "parser.y"
2131     {
2132                                         set_md(yyval.mode,1);
2133                                         set_ov(yyval.mode,0);
2134                                         set_sz(yyval.mode,1);
2135                                         set_b1(yyval.mode,yyvsp[0].value);
2136                                 }
2137     break;
2138
2139   case 105:
2140 #line 532 "parser.y"
2141     {
2142                                         set_md(yyval.mode,2);
2143                                         set_ov(yyval.mode,yyvsp[0].value);
2144                                         set_sz(yyval.mode,0);
2145                                 }
2146     break;
2147
2148   case 106:
2149 #line 538 "parser.y"
2150     {
2151                                         set_md(yyval.mode,3);
2152                                         set_ov(yyval.mode,0);
2153                                         set_sz(yyval.mode,1);
2154                                         set_b1(yyval.mode,yyvsp[0].value);
2155                                 }
2156     break;
2157
2158   case 107:
2159 #line 547 "parser.y"
2160     {
2161                                         set_md(yyval.mode,0);
2162                                         set_ov(yyval.mode,0);
2163                                         set_sz(yyval.mode,1);
2164                                         set_b1(yyval.mode,yyvsp[-2].value);
2165                                 }
2166     break;
2167
2168   case 108:
2169 #line 554 "parser.y"
2170     {
2171                                         set_md(yyval.mode,1);
2172                                         set_ov(yyval.mode,0);
2173                                         set_sz(yyval.mode,2);
2174                                         set_b1(yyval.mode,yyvsp[-3].value);
2175                                         set_b2(yyval.mode,yyvsp[0].value);
2176                                 }
2177     break;
2178
2179   case 109:
2180 #line 564 "parser.y"
2181     {
2182                                         set_md(yyval.mode,0);
2183                                         set_ov(yyval.mode,0);
2184                                         set_sz(yyval.mode,1);
2185                                         set_b1(yyval.mode,yyvsp[0].value);
2186                                 }
2187     break;
2188
2189   case 110:
2190 #line 571 "parser.y"
2191     {
2192                                         set_md(yyval.mode,1);
2193                                         set_ov(yyval.mode,0);
2194                                         set_sz(yyval.mode,1);
2195                                         set_b1(yyval.mode,yyvsp[0].value);
2196                                 }
2197     break;
2198
2199   case 111:
2200 #line 578 "parser.y"
2201     {
2202                                         set_md(yyval.mode,1);
2203                                         set_ov(yyval.mode,0);
2204                                         set_sz(yyval.mode,1);
2205                                         set_b1(yyval.mode,yyvsp[0].value);
2206                                 }
2207     break;
2208
2209   case 112:
2210 #line 587 "parser.y"
2211     {
2212                                         set_md(yyval.mode,0);
2213                                         set_ov(yyval.mode,0);
2214                                         set_sz(yyval.mode,2);
2215                                         set_b1(yyval.mode,yyvsp[-2].value);
2216                                         set_b2(yyval.mode,yyvsp[0].value);
2217                                 }
2218     break;
2219
2220   case 113:
2221 #line 597 "parser.y"
2222     {
2223                                         set_md(yyval.mode,0);
2224                                         set_ov(yyval.mode,yyvsp[-2].value);
2225                                         set_sz(yyval.mode,1);
2226                                         set_b1(yyval.mode,yyvsp[0].value);
2227                                 }
2228     break;
2229
2230   case 114:
2231 #line 604 "parser.y"
2232     {
2233                                         set_md(yyval.mode,1);
2234                                         set_ov(yyval.mode,0);
2235                                         set_sz(yyval.mode,2);
2236                                         set_b1(yyval.mode,yyvsp[-2].value);
2237                                         set_b2(yyval.mode,yyvsp[0].value);
2238                                 }
2239     break;
2240
2241   case 115:
2242 #line 614 "parser.y"
2243     {
2244                                         set_md(yyval.mode,0);
2245                                         set_ov(yyval.mode,yyvsp[-2].value);
2246                                         set_sz(yyval.mode,0);
2247                                 }
2248     break;
2249
2250   case 116:
2251 #line 620 "parser.y"
2252     {
2253                                         set_md(yyval.mode,1);
2254                                         set_ov(yyval.mode,yyvsp[-2].value);
2255                                         set_sz(yyval.mode,1);
2256                                         set_b1(yyval.mode,yyvsp[0].value);
2257                                 }
2258     break;
2259
2260   case 117:
2261 #line 627 "parser.y"
2262     {
2263                                         set_md(yyval.mode,2);
2264                                         set_ov(yyval.mode,yyvsp[-3].value);
2265                                         set_sz(yyval.mode,1);
2266                                         set_b1(yyval.mode,yyvsp[0].value);
2267                                 }
2268     break;
2269
2270   case 118:
2271 #line 634 "parser.y"
2272     {
2273                                         set_md(yyval.mode,3);
2274                                         set_ov(yyval.mode,yyvsp[0].value);
2275                                         set_sz(yyval.mode,1);
2276                                         set_b1(yyval.mode,yyvsp[-2].value);
2277                                 }
2278     break;
2279
2280   case 119:
2281 #line 641 "parser.y"
2282     {
2283                                         set_md(yyval.mode,4);
2284                                         set_ov(yyval.mode,0);
2285                                         set_sz(yyval.mode,2);
2286                                         set_b1(yyval.mode,yyvsp[0].value);
2287                                         set_b2(yyval.mode,yyvsp[-2].value);
2288                                 }
2289     break;
2290
2291   case 120:
2292 #line 649 "parser.y"
2293     {
2294                                         set_md(yyval.mode,5);
2295                                         set_ov(yyval.mode,yyvsp[0].value);
2296                                         set_sz(yyval.mode,1);
2297                                         set_b1(yyval.mode,yyvsp[-3].value);
2298                                 }
2299     break;
2300
2301   case 121:
2302 #line 656 "parser.y"
2303     {
2304                                         set_md(yyval.mode,6);
2305                                         set_ov(yyval.mode,yyvsp[-2].value);
2306                                         set_sz(yyval.mode,0);
2307                                 }
2308     break;
2309
2310   case 122:
2311 #line 662 "parser.y"
2312     {
2313                                         set_md(yyval.mode,7);
2314                                         set_ov(yyval.mode,yyvsp[-2].value);
2315                                         set_sz(yyval.mode,1);
2316                                         set_b1(yyval.mode,yyvsp[0].value);
2317                                 }
2318     break;
2319
2320   case 123:
2321 #line 669 "parser.y"
2322     {
2323                                         set_md(yyval.mode,8);
2324                                         set_ov(yyval.mode,yyvsp[-3].value);
2325                                         set_sz(yyval.mode,1);
2326                                         set_b1(yyval.mode,yyvsp[0].value);
2327                                 }
2328     break;
2329
2330   case 124:
2331 #line 676 "parser.y"
2332     {
2333                                 set_md(yyval.mode,9);
2334                                 set_ov(yyval.mode,0);
2335                                 set_sz(yyval.mode,2);
2336                                 set_b1(yyval.mode, (yyvsp[0].value & 0xff00) >> 8 );
2337                                 set_b2(yyval.mode, (yyvsp[0].value & 0x00ff) );
2338                         }
2339     break;
2340
2341   case 125:
2342 #line 684 "parser.y"
2343     {
2344                                         set_md(yyval.mode,10);
2345                                         set_ov(yyval.mode,0);
2346                                         set_sz(yyval.mode,1);
2347                                         set_b1(yyval.mode,yyvsp[0].value);
2348                                 }
2349     break;
2350
2351   case 126:
2352 #line 700 "parser.y"
2353     {
2354                                         set_md(yyval.mode,11);
2355                                         set_ov(yyval.mode,0);
2356                                         set_sz(yyval.mode,1);
2357                                         set_b1(yyval.mode,yyvsp[-2].value);
2358                                 }
2359     break;
2360
2361   case 127:
2362 #line 707 "parser.y"
2363     {
2364         if( pass2 ) {
2365                 if( !isbit8(yyvsp[-3].value) )
2366                         warn("Bit address exceeds 8-bits");
2367                 if( isbmram(yyvsp[-3].value) )
2368                         set_b1(yyval.mode, (yyvsp[-3].value-0x20)*8+ yyvsp[-2].value );
2369                 else if( isbmsfr(yyvsp[-3].value) )
2370                         set_b1(yyval.mode, yyvsp[-3].value + yyvsp[-2].value );
2371                 else
2372                         warn("Invalid bit addressable RAM location");
2373         }
2374         set_md(yyval.mode,11);
2375         set_ov(yyval.mode,0);
2376         set_sz(yyval.mode,1);
2377 }
2378     break;
2379
2380   case 128:
2381 #line 726 "parser.y"
2382     {
2383                                         set_md(yyval.mode,0);
2384                                         set_ov(yyval.mode,0);
2385                                         set_sz(yyval.mode,0);
2386                                 }
2387     break;
2388
2389   case 129:
2390 #line 733 "parser.y"
2391     {
2392                                         set_md(yyval.mode,1);
2393                                         set_ov(yyval.mode,yyvsp[0].value);
2394                                         set_sz(yyval.mode,0);
2395                                 }
2396     break;
2397
2398   case 130:
2399 #line 739 "parser.y"
2400     {
2401                                         set_md(yyval.mode,2);
2402                                         set_ov(yyval.mode,0);
2403                                         set_sz(yyval.mode,1);
2404                                         set_b1(yyval.mode,yyvsp[0].value);
2405                                 }
2406     break;
2407
2408   case 131:
2409 #line 746 "parser.y"
2410     {
2411                                         set_md(yyval.mode,3);
2412                                         set_ov(yyval.mode,yyvsp[0].value);
2413                                         set_sz(yyval.mode,0);
2414                                 }
2415     break;
2416
2417   case 132:
2418 #line 754 "parser.y"
2419     {
2420                                         set_md(yyval.mode,0);
2421                                         set_ov(yyval.mode,0);
2422                                         set_sz(yyval.mode,0);
2423                                 }
2424     break;
2425
2426   case 133:
2427 #line 760 "parser.y"
2428     {
2429                                         set_md(yyval.mode,1);
2430                                         set_ov(yyval.mode,0);
2431                                         set_sz(yyval.mode,0);
2432                                 }
2433     break;
2434
2435   case 134:
2436 #line 766 "parser.y"
2437     {
2438                                         set_md(yyval.mode,2);
2439                                         set_ov(yyval.mode,0);
2440                                         set_sz(yyval.mode,1);
2441                                         set_b1(yyval.mode,yyvsp[0].value);
2442                                 }
2443     break;
2444
2445   case 135:
2446 #line 775 "parser.y"
2447     {
2448                                         set_md(yyval.mode,0);
2449                                         set_ov(yyval.mode,0);
2450                                         set_sz(yyval.mode,2);
2451                                         set_b1(yyval.mode,yyvsp[-2].value);
2452                                         set_b2(yyval.mode,yyvsp[0].value);
2453                                 }
2454     break;
2455
2456   case 136:
2457 #line 783 "parser.y"
2458     {
2459                                         set_md(yyval.mode,1);
2460                                         set_ov(yyval.mode,0);
2461                                         set_sz(yyval.mode,2);
2462                                         set_b1(yyval.mode,yyvsp[-2].value);
2463                                         set_b2(yyval.mode,yyvsp[0].value);
2464                                 }
2465     break;
2466
2467   case 137:
2468 #line 791 "parser.y"
2469     {
2470                                         set_md(yyval.mode,2);
2471                                         set_ov(yyval.mode,yyvsp[-5].value);
2472                                         set_sz(yyval.mode,2);
2473                                         set_b1(yyval.mode,yyvsp[-2].value);
2474                                         set_b2(yyval.mode,yyvsp[0].value);
2475                                 }
2476     break;
2477
2478   case 138:
2479 #line 799 "parser.y"
2480     {
2481                                         set_md(yyval.mode,3);
2482                                         set_ov(yyval.mode,yyvsp[-5].value);
2483                                         set_sz(yyval.mode,2);
2484                                         set_b1(yyval.mode,yyvsp[-2].value);
2485                                         set_b2(yyval.mode,yyvsp[0].value);
2486                                 }
2487     break;
2488
2489   case 139:
2490 #line 809 "parser.y"
2491     {
2492                 long offset;
2493                 if( pass2 ) {
2494                         offset = yyvsp[0].val.v - (lc+3);
2495                         if( offset > 127 || offset < -128 )
2496                            warn("Relative offset exceeds -128 / +127");
2497                         yyval.value = offset;
2498                 }
2499 }
2500     break;
2501
2502   case 140:
2503 #line 826 "parser.y"
2504     {
2505                 long offset;
2506                 if( pass2 ) {
2507                         offset = yyvsp[0].val.v - (lc+2); /* different! */
2508                         if( offset > 127 || offset < -128 )
2509                            warn("Relative offset exceeds -128 / +127");
2510                         yyval.value = offset;
2511                 }
2512 }
2513     break;
2514
2515   case 141:
2516 #line 839 "parser.y"
2517     {
2518         if( pass2 ) {
2519                 if( !isbit8(yyvsp[-1].value) )
2520                         warn("Bit address exceeds 8-bits");
2521                 if( isbmram(yyvsp[-1].value) )
2522                         yyval.value = (yyvsp[-1].value-0x20)*8+yyvsp[0].value;
2523                 else if( isbmsfr(yyvsp[-1].value) )
2524                         yyval.value = yyvsp[-1].value + yyvsp[0].value;
2525                 else
2526                         warn("Invalid bit addressable RAM location");
2527         }
2528 }
2529     break;
2530
2531   case 142:
2532 #line 852 "parser.y"
2533     {
2534         if( pass2 ) {
2535                 if( !isbit8(yyvsp[0].value) )
2536                         warn("Bit address exceeds 8-bits");
2537                 yyval.value = yyvsp[0].value;
2538         }
2539 }
2540     break;
2541
2542   case 143:
2543 #line 862 "parser.y"
2544     {
2545         if( yyvsp[0].sym->type == UNDEF && pass2 )
2546                 warn("Symbol %s undefined",yyvsp[0].sym->name);
2547         yyval.value = yyvsp[0].sym->value;
2548 }
2549     break;
2550
2551   case 144:
2552 #line 867 "parser.y"
2553     { yyval.value = yyvsp[0].value; }
2554     break;
2555
2556   case 145:
2557 #line 870 "parser.y"
2558     { yyval.value = 0; }
2559     break;
2560
2561   case 146:
2562 #line 871 "parser.y"
2563     { yyval.value = 1; }
2564     break;
2565
2566   case 147:
2567 #line 872 "parser.y"
2568     { yyval.value = 2; }
2569     break;
2570
2571   case 148:
2572 #line 873 "parser.y"
2573     { yyval.value = 3; }
2574     break;
2575
2576   case 149:
2577 #line 874 "parser.y"
2578     { yyval.value = 4; }
2579     break;
2580
2581   case 150:
2582 #line 875 "parser.y"
2583     { yyval.value = 5; }
2584     break;
2585
2586   case 151:
2587 #line 876 "parser.y"
2588     { yyval.value = 6; }
2589     break;
2590
2591   case 152:
2592 #line 877 "parser.y"
2593     { yyval.value = 7; }
2594     break;
2595
2596   case 153:
2597 #line 880 "parser.y"
2598     { yyval.value = 0; }
2599     break;
2600
2601   case 154:
2602 #line 881 "parser.y"
2603     { yyval.value = 1; }
2604     break;
2605
2606   case 155:
2607 #line 883 "parser.y"
2608     { yyval.value = 0;
2609                                   warn("Illegal indirect register: @r2"); }
2610     break;
2611
2612   case 156:
2613 #line 886 "parser.y"
2614     { yyval.value = 0;
2615                                   warn("Illegal indirect register: @r3"); }
2616     break;
2617
2618   case 157:
2619 #line 889 "parser.y"
2620     { yyval.value = 0;
2621                                   warn("Illegal indirect register: @r4"); }
2622     break;
2623
2624   case 158:
2625 #line 892 "parser.y"
2626     { yyval.value = 0;
2627                                   warn("Illegal indirect register: @r5"); }
2628     break;
2629
2630   case 159:
2631 #line 895 "parser.y"
2632     { yyval.value = 0;
2633                                   warn("Illegal indirect register: @r6"); }
2634     break;
2635
2636   case 160:
2637 #line 898 "parser.y"
2638     { yyval.value = 0;
2639                                   warn("Illegal indirect register: @r7"); }
2640     break;
2641
2642   case 161:
2643 #line 903 "parser.y"
2644     {
2645         if( pass2 ) {
2646                 if( !isbit8(yyvsp[0].val.v) )
2647                         warn("Expression greater than 8-bits");
2648         }
2649         yyval.value = yyvsp[0].val.v;
2650 }
2651     break;
2652
2653   case 162:
2654 #line 913 "parser.y"
2655     {
2656         if( pass2 ) {
2657                 if( !isbit16(yyvsp[0].val.v) )
2658                         warn("Expression greater than 16-bits");
2659         }
2660         yyval.value = yyvsp[0].val.v;
2661 }
2662     break;
2663
2664   case 163:
2665 #line 923 "parser.y"
2666     {
2667                 if( pass2 ) {
2668                         if( !isbit16(yyvsp[0].val.v)  )
2669                                 warn("Address greater than 16-bits");
2670                         if( (yyvsp[0].val.v & size11) != ((lc+2) & size11) )
2671                                 warn("Address outside current 2K page");
2672                 }
2673                 set_md(yyval.mode,0);
2674                 set_ov(yyval.mode, (yyvsp[0].val.v&0x0700)>>3 );
2675                 set_sz(yyval.mode,1);
2676                 set_b1(yyval.mode,yyvsp[0].val.v&0x00ff);
2677 }
2678     break;
2679
2680   case 164:
2681 #line 938 "parser.y"
2682     {
2683                 if( pass2 ) {
2684                         if( !isbit16(yyvsp[0].val.v)  )
2685                                 warn("Address greater than 16-bits");
2686                 }
2687                 set_md(yyval.mode,0);
2688                 set_ov(yyval.mode, 0 );
2689                 set_sz(yyval.mode,2);
2690                 set_b1(yyval.mode, (yyvsp[0].val.v & 0xff00 ) >> 8 );
2691                 set_b2(yyval.mode, (yyvsp[0].val.v & 0x00ff ) );
2692 }
2693     break;
2694
2695   case 165:
2696 #line 952 "parser.y"
2697     {
2698                 long offset=0;
2699                 if( pass2 ) {
2700                         offset = yyvsp[0].val.v - (lc+2);
2701                         if( offset>127 || offset<-128 )
2702                            warn("Relative offset exceeds -128 / +127");
2703                 }
2704                 set_md(yyval.mode,0);
2705                 set_ov(yyval.mode,0);
2706                 set_sz(yyval.mode,1);
2707                 set_b1(yyval.mode,offset);
2708
2709 }
2710     break;
2711
2712
2713     }
2714
2715 /* Line 1010 of yacc.c.  */
2716 #line 2717 "y.tab.c"
2717 \f
2718   yyvsp -= yylen;
2719   yyssp -= yylen;
2720
2721
2722   YY_STACK_PRINT (yyss, yyssp);
2723
2724   *++yyvsp = yyval;
2725
2726
2727   /* Now `shift' the result of the reduction.  Determine what state
2728      that goes to, based on the state we popped back to and the rule
2729      number reduced by.  */
2730
2731   yyn = yyr1[yyn];
2732
2733   yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
2734   if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
2735     yystate = yytable[yystate];
2736   else
2737     yystate = yydefgoto[yyn - YYNTOKENS];
2738
2739   goto yynewstate;
2740
2741
2742 /*------------------------------------.
2743 | yyerrlab -- here on detecting error |
2744 `------------------------------------*/
2745 yyerrlab:
2746   /* If not already recovering from an error, report this error.  */
2747   if (!yyerrstatus)
2748     {
2749       ++yynerrs;
2750 #if YYERROR_VERBOSE
2751       yyn = yypact[yystate];
2752
2753       if (YYPACT_NINF < yyn && yyn < YYLAST)
2754         {
2755           YYSIZE_T yysize = 0;
2756           int yytype = YYTRANSLATE (yychar);
2757           const char* yyprefix;
2758           char *yymsg;
2759           int yyx;
2760
2761           /* Start YYX at -YYN if negative to avoid negative indexes in
2762              YYCHECK.  */
2763           int yyxbegin = yyn < 0 ? -yyn : 0;
2764
2765           /* Stay within bounds of both yycheck and yytname.  */
2766           int yychecklim = YYLAST - yyn;
2767           int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
2768           int yycount = 0;
2769
2770           yyprefix = ", expecting ";
2771           for (yyx = yyxbegin; yyx < yyxend; ++yyx)
2772             if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
2773               {
2774                 yysize += yystrlen (yyprefix) + yystrlen (yytname [yyx]);
2775                 yycount += 1;
2776                 if (yycount == 5)
2777                   {
2778                     yysize = 0;
2779                     break;
2780                   }
2781               }
2782           yysize += (sizeof ("syntax error, unexpected ")
2783                      + yystrlen (yytname[yytype]));
2784           yymsg = (char *) YYSTACK_ALLOC (yysize);
2785           if (yymsg != 0)
2786             {
2787               char *yyp = yystpcpy (yymsg, "syntax error, unexpected ");
2788               yyp = yystpcpy (yyp, yytname[yytype]);
2789
2790               if (yycount < 5)
2791                 {
2792                   yyprefix = ", expecting ";
2793                   for (yyx = yyxbegin; yyx < yyxend; ++yyx)
2794                     if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
2795                       {
2796                         yyp = yystpcpy (yyp, yyprefix);
2797                         yyp = yystpcpy (yyp, yytname[yyx]);
2798                         yyprefix = " or ";
2799                       }
2800                 }
2801               yyerror (yymsg);
2802               YYSTACK_FREE (yymsg);
2803             }
2804           else
2805             yyerror ("syntax error; also virtual memory exhausted");
2806         }
2807       else
2808 #endif /* YYERROR_VERBOSE */
2809         yyerror ("syntax error");
2810     }
2811
2812
2813
2814   if (yyerrstatus == 3)
2815     {
2816       /* If just tried and failed to reuse lookahead token after an
2817          error, discard it.  */
2818
2819       if (yychar <= YYEOF)
2820         {
2821           /* If at end of input, pop the error token,
2822              then the rest of the stack, then return failure.  */
2823           if (yychar == YYEOF)
2824              for (;;)
2825                {
2826                  YYPOPSTACK;
2827                  if (yyssp == yyss)
2828                    YYABORT;
2829                  YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
2830                  yydestruct (yystos[*yyssp], yyvsp);
2831                }
2832         }
2833       else
2834         {
2835           YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc);
2836           yydestruct (yytoken, &yylval);
2837           yychar = YYEMPTY;
2838
2839         }
2840     }
2841
2842   /* Else will try to reuse lookahead token after shifting the error
2843      token.  */
2844   goto yyerrlab1;
2845
2846
2847 /*---------------------------------------------------.
2848 | yyerrorlab -- error raised explicitly by YYERROR.  |
2849 `---------------------------------------------------*/
2850 yyerrorlab:
2851
2852 #ifdef __GNUC__
2853   /* Pacify GCC when the user code never invokes YYERROR and the label
2854      yyerrorlab therefore never appears in user code.  */
2855   if (0)
2856      goto yyerrorlab;
2857 #endif
2858
2859   yyvsp -= yylen;
2860   yyssp -= yylen;
2861   yystate = *yyssp;
2862   goto yyerrlab1;
2863
2864
2865 /*-------------------------------------------------------------.
2866 | yyerrlab1 -- common code for both syntax error and YYERROR.  |
2867 `-------------------------------------------------------------*/
2868 yyerrlab1:
2869   yyerrstatus = 3;      /* Each real token shifted decrements this.  */
2870
2871   for (;;)
2872     {
2873       yyn = yypact[yystate];
2874       if (yyn != YYPACT_NINF)
2875         {
2876           yyn += YYTERROR;
2877           if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
2878             {
2879               yyn = yytable[yyn];
2880               if (0 < yyn)
2881                 break;
2882             }
2883         }
2884
2885       /* Pop the current state because it cannot handle the error token.  */
2886       if (yyssp == yyss)
2887         YYABORT;
2888
2889       YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
2890       yydestruct (yystos[yystate], yyvsp);
2891       YYPOPSTACK;
2892       yystate = *yyssp;
2893       YY_STACK_PRINT (yyss, yyssp);
2894     }
2895
2896   if (yyn == YYFINAL)
2897     YYACCEPT;
2898
2899   YYDPRINTF ((stderr, "Shifting error token, "));
2900
2901   *++yyvsp = yylval;
2902
2903
2904   yystate = yyn;
2905   goto yynewstate;
2906
2907
2908 /*-------------------------------------.
2909 | yyacceptlab -- YYACCEPT comes here.  |
2910 `-------------------------------------*/
2911 yyacceptlab:
2912   yyresult = 0;
2913   goto yyreturn;
2914
2915 /*-----------------------------------.
2916 | yyabortlab -- YYABORT comes here.  |
2917 `-----------------------------------*/
2918 yyabortlab:
2919   yyresult = 1;
2920   goto yyreturn;
2921
2922 #ifndef yyoverflow
2923 /*----------------------------------------------.
2924 | yyoverflowlab -- parser overflow comes here.  |
2925 `----------------------------------------------*/
2926 yyoverflowlab:
2927   yyerror ("parser stack overflow");
2928   yyresult = 2;
2929   /* Fall through.  */
2930 #endif
2931
2932 yyreturn:
2933 #ifndef yyoverflow
2934   if (yyss != yyssa)
2935     YYSTACK_FREE (yyss);
2936 #endif
2937   return yyresult;
2938 }
2939
2940
2941 #line 967 "parser.y"
2942
2943
2944 /* ---------------------------------------------------------------------- */
2945
2946 void yyerror(const char *s)
2947 {
2948         warn("%s near \"%s\"", s, get_last_token());
2949 }
2950
2951
2952 /* ----------------------------------------------------------------------
2953  * makeop:
2954  *      This function makes an opcode based on the instruction symbol table
2955  *      entry, and an addressing mode structure.
2956  *      This function is called from both passes, but
2957  *      only generates code in pass 2.
2958  *
2959  *      Resultant opcode bytes are passed to genbyte().
2960  *
2961  *      Returns the nuumber of bytes that the instruction
2962  *      occupies.
2963  *
2964  */
2965
2966 int makeop(struct opcode * op, struct mode *m, int add)
2967 {
2968         register unsigned int newop;
2969
2970         if( m == NULL ) {
2971                 if(pass2) genbyte(op->bytes[0+add]);
2972                 return(1);
2973         }
2974
2975         if( pass2 ) {
2976                 newop = op->bytes[ get_md(*m)+add ] | get_ov(*m);
2977                 genbyte(newop);
2978                 if( get_sz(*m) > 0 ) genbyte( get_b1(*m) );
2979                 if( get_sz(*m) > 1 ) genbyte( get_b2(*m) );
2980         }
2981         return( get_sz(*m)+1 );
2982 }
2983
2984
2985 /* ----------------------------------------------------------------------
2986  * inclc:
2987  *      Increments the Location Counter by 'i' amount.
2988  *      Check to see if 'i' overflows 64K.
2989  *      Checks to see if assembler is overlapping previous sections
2990  *      of code. (using a large bit field).
2991  *
2992  */
2993
2994 #define indx(a) ( (a)/(sizeof(long)*8) )
2995 #define bit(a)  ( 1 << ((a)%(sizeof(long)*8)) )
2996
2997 #define getloc(a) (regions[indx(a)] & bit(a))
2998 #define setloc(a) (regions[indx(a)] |= bit(a))
2999
3000 static unsigned long regions[ 0x10000/(sizeof(long)*8) ];
3001
3002 void inclc(int i)
3003 {
3004
3005         while (i-- > 0) {
3006                 if( pass2 && getloc(lc) )
3007                         error("Location counter overlaps");
3008                 if( pass2 ) setloc(lc);
3009                 lc += 1;
3010         }
3011                 
3012         if( lc > 0xffff )
3013                 error("Location counter has exceeded 16-bits");
3014 }
3015
3016 void clear_location_counter(void)
3017 {
3018         memset(regions, 0, sizeof(regions));
3019 }
3020
3021
3022 /* ----------------------------------------------------------------------
3023  * padline:
3024  *      This routine returns a new string, which is equivilant to
3025  *      'line' except that all tabs have been expanded to spaces, and
3026  *      the total length has been truncated to 60 chars.
3027  */
3028
3029 char *padline(char *line)
3030 {
3031         static char newline[61];
3032         char *p1;
3033         int pos=0,nxtpos;
3034
3035         for(p1=line; pos<sizeof(newline)-1 && *p1; p1++ ) {
3036                 if( *p1 == '\t' ) {
3037                         nxtpos = pos+8-pos%8;
3038                         while(pos<sizeof(newline)-1 && pos <= nxtpos)
3039                                 newline[pos++] = ' ';
3040                 } else if( *p1 != '\n' )
3041                         newline[pos++]= *p1;
3042         }
3043         newline[pos] = '\0';
3044         return(newline);
3045 }
3046
3047
3048 /* ----------------------------------------------------------------------
3049  * dumplist:
3050  *      Outputs the current location counter, bytebuf[] array, and
3051  *      the string 'txt' to the listing file.
3052  *      This routine is called for every source line encountered in the
3053  *      source file. (Only in pass 2, and if listing is turned on).
3054  *
3055  */
3056
3057 void dumplist(char *txt, int show)
3058 {
3059         int i,j;
3060
3061         fprintf(listing,show?"%04lX: ":"      ",lc);
3062
3063         j=0;
3064         for(i=0; i<bytecount; i++ ) {
3065                 fprintf(listing,"%02X ",bytebuf[i]);
3066                 if( ++j >= 4 ) {
3067                         j = 0;
3068                         fprintf(listing,"\n      ");
3069                 }
3070         }
3071         while(++j <= 4)
3072                 fprintf(listing,"   ");
3073
3074         fprintf(listing," %s\n",padline(txt));
3075 }
3076
3077 /* ----------------------------------------------------------------------
3078  * gen* routines:
3079  *      Place information into the bytebuf[] array, and also
3080  *      call emitbyte with the byte.
3081  *
3082  */
3083
3084 void genbyte(int b)
3085 {
3086         if( bytecount < sizeof(bytebuf) )
3087                 bytebuf[bytecount++] = b;
3088         emitbyte(b);
3089 }
3090
3091 void genstr(const char *s)
3092 {
3093         while( *s )
3094                 genbyte(*s++);
3095 }
3096
3097 void genword(unsigned long w)
3098 {
3099         genbyte( (w & 0xff00) >> 8 );
3100         genbyte( (w & 0x00ff) );
3101 }
3102
3103
3104