1/* A Bison parser, made by GNU Bison 2.3.  */
2
3/* Skeleton implementation for Bison's Yacc-like parsers in C
4
5   Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
6   Free Software Foundation, Inc.
7
8   This program is free software; you can redistribute it and/or modify
9   it under the terms of the GNU General Public License as published by
10   the Free Software Foundation; either version 2, or (at your option)
11   any later version.
12
13   This program is distributed in the hope that it will be useful,
14   but WITHOUT ANY WARRANTY; without even the implied warranty of
15   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16   GNU General Public License for more details.
17
18   You should have received a copy of the GNU General Public License
19   along with this program; if not, write to the Free Software
20   Foundation, Inc., 51 Franklin Street, Fifth Floor,
21   Boston, MA 02110-1301, USA.  */
22
23/* As a special exception, you may create a larger work that contains
24   part or all of the Bison parser skeleton and distribute that work
25   under terms of your choice, so long as that work isn't itself a
26   parser generator using the skeleton or a modified version thereof
27   as a parser skeleton.  Alternatively, if you modify or redistribute
28   the parser skeleton itself, you may (at your option) remove this
29   special exception, which will cause the skeleton and the resulting
30   Bison output files to be licensed under the GNU General Public
31   License without this special exception.
32
33   This special exception was added by the Free Software Foundation in
34   version 2.2 of Bison.  */
35
36/* C LALR(1) parser skeleton written by Richard Stallman, by
37   simplifying the original so-called "semantic" parser.  */
38
39/* All symbols defined below should begin with yy or YY, to avoid
40   infringing on user name space.  This should be done even for local
41   variables, as they might otherwise be expanded by user macros.
42   There are some unavoidable exceptions within include files to
43   define necessary library symbols; they are noted "INFRINGES ON
44   USER NAME SPACE" below.  */
45
46/* Identify Bison output.  */
47#define YYBISON 1
48
49/* Bison version.  */
50#define YYBISON_VERSION "2.3"
51
52/* Skeleton name.  */
53#define YYSKELETON_NAME "yacc.c"
54
55/* Pure parsers.  */
56#define YYPURE 0
57
58/* Using locations.  */
59#define YYLSP_NEEDED 0
60
61
62
63/* Tokens.  */
64#ifndef YYTOKENTYPE
65# define YYTOKENTYPE
66   /* Put the tokens into the symbol table, so that GDB and other debuggers
67      know about them.  */
68   enum yytokentype {
69     DREG = 258,
70     CREG = 259,
71     GREG = 260,
72     IMMED = 261,
73     ADDR = 262,
74     INSN = 263,
75     NUM = 264,
76     ID = 265,
77     NL = 266,
78     PNUM = 267
79   };
80#endif
81/* Tokens.  */
82#define DREG 258
83#define CREG 259
84#define GREG 260
85#define IMMED 261
86#define ADDR 262
87#define INSN 263
88#define NUM 264
89#define ID 265
90#define NL 266
91#define PNUM 267
92
93
94
95
96/* Copy the first part of user declarations.  */
97#line 21 "itbl-parse.y"
98
99
100/*
101
102Yacc grammar for instruction table entries.
103
104=======================================================================
105Original Instruction table specification document:
106
107	    MIPS Coprocessor Table Specification
108	    ====================================
109
110This document describes the format of the MIPS coprocessor table.  The
111table specifies a list of valid functions, data registers and control
112registers that can be used in coprocessor instructions.  This list,
113together with the coprocessor instruction classes listed below,
114specifies the complete list of coprocessor instructions that will
115be recognized and assembled by the GNU assembler.  In effect,
116this makes the GNU assembler table-driven, where the table is
117specified by the programmer.
118
119The table is an ordinary text file that the GNU assembler reads when
120it starts.  Using the information in the table, the assembler
121generates an internal list of valid coprocessor registers and
122functions.  The assembler uses this internal list in addition to the
123standard MIPS registers and instructions which are built-in to the
124assembler during code generation.
125
126To specify the coprocessor table when invoking the GNU assembler, use
127the command line option "--itbl file", where file is the
128complete name of the table, including path and extension.
129
130Examples:
131
132	    gas -t cop.tbl test.s -o test.o
133	    gas -t /usr/local/lib/cop.tbl test.s -o test.o
134	    gas --itbl d:\gnu\data\cop.tbl test.s -o test.o
135
136Only one table may be supplied during a single invocation of
137the assembler.
138
139
140Instruction classes
141===================
142
143Below is a list of the valid coprocessor instruction classes for
144any given coprocessor "z".  These instructions are already recognized
145by the assembler, and are listed here only for reference.
146
147Class   format	    	    	      instructions
148-------------------------------------------------
149Class1:
150	op base rt offset
151	    	    	    	    	    	    	    LWCz rt,offset (base)
152	    	    	    	    	    	    	    SWCz rt,offset (base)
153Class2:
154	COPz sub rt rd 0
155	    	    	    	    	    	    	    MTCz rt,rd
156	    	    	    	    	    	    	    MFCz rt,rd
157	    	    	    	    	    	    	    CTCz rt,rd
158	    	    	    	    	    	    	    CFCz rt,rd
159Class3:
160	COPz CO cofun
161	    	    	    	    	    	    	    COPz cofun
162Class4:
163	COPz BC br offset
164	    	    	    	    	    	    	    BCzT offset
165	    	    	    	    	    	    	    BCzF offset
166Class5:
167	COPz sub rt rd 0
168	    	    	    	    	    	    	    DMFCz rt,rd
169	    	    	    	    	    	    	    DMTCz rt,rd
170Class6:
171	op base rt offset
172	    	    	    	    	    	    	    LDCz rt,offset (base)
173	    	    	    	    	    	    	    SDCz rt,offset (base)
174Class7:
175	COPz BC br offset
176	    	    	    	    	    	    	    BCzTL offset
177	    	    	    	    	    	    	    BCzFL offset
178
179The coprocessor table defines coprocessor-specific registers that can
180be used with all of the above classes of instructions, where
181appropriate.  It also defines additional coprocessor-specific
182functions for Class3 (COPz cofun) instructions, Thus, the table allows
183the programmer to use convenient mnemonics and operands for these
184functions, instead of the COPz mmenmonic and cofun operand.
185
186The names of the MIPS general registers and their aliases are defined
187by the assembler and will be recognized as valid register names by the
188assembler when used (where allowed) in coprocessor instructions.
189However, the names and values of all coprocessor data and control
190register mnemonics must be specified in the coprocessor table.
191
192
193Table Grammar
194=============
195
196Here is the grammar for the coprocessor table:
197
198	    table -> entry*
199
200	    entry -> [z entrydef] [comment] '\n'
201
202	    entrydef -> type name val
203	    entrydef -> 'insn' name val funcdef ; type of entry (instruction)
204
205	    z -> 'p'['0'..'3']	    	     ; processor number
206	    type -> ['dreg' | 'creg' | 'greg' ]	     ; type of entry (register)
207	; 'dreg', 'creg' or 'greg' specifies a data, control, or general
208	;	    register mnemonic, respectively
209	    name -> [ltr|dec]*	    	     ; mnemonic of register/function
210	    val -> [dec|hex]	    	     ; register/function number (integer constant)
211
212	    funcdef -> frange flags fields
213	    	    	    	; bitfield range for opcode
214	    	    	    	; list of fields' formats
215	    fields -> field*
216	    field -> [','] ftype frange flags
217	    flags -> ['*' flagexpr]
218	    flagexpr -> '[' flagexpr ']'
219	    flagexpr -> val '|' flagexpr
220	    ftype -> [ type | 'immed' | 'addr' ]
221	; 'immed' specifies an immediate value; see grammar for "val" above
222	    	; 'addr' specifies a C identifier; name of symbol to be resolved at
223	;	    link time
224	    frange -> ':' val '-' val	; starting to ending bit positions, where
225	    	    	    	; where 0 is least significant bit
226	    frange -> (null)	    	; default range of 31-0 will be assumed
227
228	    comment -> [';'|'#'] [char]*
229	    char -> any printable character
230	    ltr -> ['a'..'z'|'A'..'Z']
231	    dec -> ['0'..'9']*	    	    	    	    	     ; value in decimal
232	    hex -> '0x'['0'..'9' | 'a'..'f' | 'A'..'F']*	; value in hexadecimal
233
234
235Examples
236========
237
238Example 1:
239
240The table:
241
242	    p1 dreg d1 1	     ; data register "d1" for COP1 has value 1
243	    p1 creg c3 3	     ; ctrl register "c3" for COP1 has value 3
244	    p3 func fill 0x1f:24-20	      ; function "fill" for COP3 has value 31 and
245	    	    	; no fields
246
247will allow the assembler to accept the following coprocessor instructions:
248
249	    LWC1 d1,0x100 ($2)
250	    fill
251
252Here, the general purpose register "$2", and instruction "LWC1", are standard
253mnemonics built-in to the MIPS assembler.
254
255
256Example 2:
257
258The table:
259
260	    p3 dreg d3 3	     ; data register "d3" for COP3 has value 3
261	    p3 creg c2 22	     ; control register "c2" for COP3 has value 22
262	    p3 func fee 0x1f:24-20 dreg:17-13 creg:12-8 immed:7-0
263	    	; function "fee" for COP3 has value 31, and 3 fields
264	    	; consisting of a data register, a control register,
265	    	; and an immediate value.
266
267will allow the assembler to accept the following coprocessor instruction:
268
269	    fee d3,c2,0x1
270
271and will emit the object code:
272
273	    31-26  25 24-20 19-18  17-13 12-8  7-0
274	    COPz   CO fun	    	      dreg  creg  immed
275	    010011 1  11111 00	     00011 10110 00000001
276
277	    0x4ff07601
278
279
280Example 3:
281
282The table:
283
284	    p3 dreg d3 3	     ; data register "d3" for COP3 has value 3
285	    p3 creg c2 22	     ; control register "c2" for COP3 has value 22
286	    p3 func fuu 0x01f00001 dreg:17-13 creg:12-8
287
288will allow the assembler to accept the following coprocessor
289instruction:
290
291	    fuu d3,c2
292
293and will emit the object code:
294
295	    31-26  25 24-20 19-18  17-13 12-8  7-0
296	    COPz   CO fun	    	      dreg  creg
297	    010011 1  11111 00	     00011 10110 00000001
298
299	    0x4ff07601
300
301In this way, the programmer can force arbitrary bits of an instruction
302to have predefined values.
303
304=======================================================================
305Additional notes:
306
307Encoding of ranges:
308To handle more than one bit position range within an instruction,
309use 0s to mask out the ranges which don't apply.
310May decide to modify the syntax to allow commas separate multiple
311ranges within an instruction (range','range).
312
313Changes in grammar:
314	The number of parms argument to the function entry
315was deleted from the original format such that we now count the fields.
316
317----
318FIXME! should really change lexical analyzer
319to recognize 'dreg' etc. in context sensitive way.
320Currently function names or mnemonics may be incorrectly parsed as keywords
321
322FIXME! hex is ambiguous with any digit
323
324*/
325
326#include "as.h"
327#include "itbl-lex.h"
328#include "itbl-ops.h"
329
330/* #define DEBUG */
331
332#ifdef DEBUG
333#ifndef DBG_LVL
334#define DBG_LVL 1
335#endif
336#else
337#define DBG_LVL 0
338#endif
339
340#if DBG_LVL >= 1
341#define DBG(x) printf x
342#else
343#define DBG(x)
344#endif
345
346#if DBG_LVL >= 2
347#define DBGL2(x) printf x
348#else
349#define DBGL2(x)
350#endif
351
352static int sbit, ebit;
353static struct itbl_entry *insn=0;
354static int yyerror (const char *);
355
356
357
358/* Enabling traces.  */
359#ifndef YYDEBUG
360# define YYDEBUG 0
361#endif
362
363/* Enabling verbose error messages.  */
364#ifdef YYERROR_VERBOSE
365# undef YYERROR_VERBOSE
366# define YYERROR_VERBOSE 1
367#else
368# define YYERROR_VERBOSE 0
369#endif
370
371/* Enabling the token table.  */
372#ifndef YYTOKEN_TABLE
373# define YYTOKEN_TABLE 0
374#endif
375
376#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
377typedef union YYSTYPE
378#line 282 "itbl-parse.y"
379{
380    char *str;
381    int num;
382    int processor;
383    unsigned long val;
384  }
385/* Line 193 of yacc.c.  */
386#line 387 "itbl-parse.c"
387	YYSTYPE;
388# define yystype YYSTYPE /* obsolescent; will be withdrawn */
389# define YYSTYPE_IS_DECLARED 1
390# define YYSTYPE_IS_TRIVIAL 1
391#endif
392
393
394
395/* Copy the second part of user declarations.  */
396
397
398/* Line 216 of yacc.c.  */
399#line 400 "itbl-parse.c"
400
401#ifdef short
402# undef short
403#endif
404
405#ifdef YYTYPE_UINT8
406typedef YYTYPE_UINT8 yytype_uint8;
407#else
408typedef unsigned char yytype_uint8;
409#endif
410
411#ifdef YYTYPE_INT8
412typedef YYTYPE_INT8 yytype_int8;
413#elif (defined __STDC__ || defined __C99__FUNC__ \
414     || defined __cplusplus || defined _MSC_VER)
415typedef signed char yytype_int8;
416#else
417typedef short int yytype_int8;
418#endif
419
420#ifdef YYTYPE_UINT16
421typedef YYTYPE_UINT16 yytype_uint16;
422#else
423typedef unsigned short int yytype_uint16;
424#endif
425
426#ifdef YYTYPE_INT16
427typedef YYTYPE_INT16 yytype_int16;
428#else
429typedef short int yytype_int16;
430#endif
431
432#ifndef YYSIZE_T
433# ifdef __SIZE_TYPE__
434#  define YYSIZE_T __SIZE_TYPE__
435# elif defined size_t
436#  define YYSIZE_T size_t
437# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
438     || defined __cplusplus || defined _MSC_VER)
439#  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
440#  define YYSIZE_T size_t
441# else
442#  define YYSIZE_T unsigned int
443# endif
444#endif
445
446#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
447
448#ifndef YY_
449# if defined YYENABLE_NLS && YYENABLE_NLS
450#  if ENABLE_NLS
451#   include <libintl.h> /* INFRINGES ON USER NAME SPACE */
452#   define YY_(msgid) dgettext ("bison-runtime", msgid)
453#  endif
454# endif
455# ifndef YY_
456#  define YY_(msgid) msgid
457# endif
458#endif
459
460/* Suppress unused-variable warnings by "using" E.  */
461#if ! defined lint || defined __GNUC__
462# define YYUSE(e) ((void) (e))
463#else
464# define YYUSE(e) /* empty */
465#endif
466
467/* Identity function, used to suppress warnings about constant conditions.  */
468#ifndef lint
469# define YYID(n) (n)
470#else
471#if (defined __STDC__ || defined __C99__FUNC__ \
472     || defined __cplusplus || defined _MSC_VER)
473static int
474YYID (int i)
475#else
476static int
477YYID (i)
478    int i;
479#endif
480{
481  return i;
482}
483#endif
484
485#if ! defined yyoverflow || YYERROR_VERBOSE
486
487/* The parser invokes alloca or malloc; define the necessary symbols.  */
488
489# ifdef YYSTACK_USE_ALLOCA
490#  if YYSTACK_USE_ALLOCA
491#   ifdef __GNUC__
492#    define YYSTACK_ALLOC __builtin_alloca
493#   elif defined __BUILTIN_VA_ARG_INCR
494#    include <alloca.h> /* INFRINGES ON USER NAME SPACE */
495#   elif defined _AIX
496#    define YYSTACK_ALLOC __alloca
497#   elif defined _MSC_VER
498#    include <malloc.h> /* INFRINGES ON USER NAME SPACE */
499#    define alloca _alloca
500#   else
501#    define YYSTACK_ALLOC alloca
502#    if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
503     || defined __cplusplus || defined _MSC_VER)
504#     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
505#     ifndef _STDLIB_H
506#      define _STDLIB_H 1
507#     endif
508#    endif
509#   endif
510#  endif
511# endif
512
513# ifdef YYSTACK_ALLOC
514   /* Pacify GCC's `empty if-body' warning.  */
515#  define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
516#  ifndef YYSTACK_ALLOC_MAXIMUM
517    /* The OS might guarantee only one guard page at the bottom of the stack,
518       and a page size can be as small as 4096 bytes.  So we cannot safely
519       invoke alloca (N) if N exceeds 4096.  Use a slightly smaller number
520       to allow for a few compiler-allocated temporary stack slots.  */
521#   define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
522#  endif
523# else
524#  define YYSTACK_ALLOC YYMALLOC
525#  define YYSTACK_FREE YYFREE
526#  ifndef YYSTACK_ALLOC_MAXIMUM
527#   define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
528#  endif
529#  if (defined __cplusplus && ! defined _STDLIB_H \
530       && ! ((defined YYMALLOC || defined malloc) \
531	     && (defined YYFREE || defined free)))
532#   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
533#   ifndef _STDLIB_H
534#    define _STDLIB_H 1
535#   endif
536#  endif
537#  ifndef YYMALLOC
538#   define YYMALLOC malloc
539#   if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
540     || defined __cplusplus || defined _MSC_VER)
541void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
542#   endif
543#  endif
544#  ifndef YYFREE
545#   define YYFREE free
546#   if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
547     || defined __cplusplus || defined _MSC_VER)
548void free (void *); /* INFRINGES ON USER NAME SPACE */
549#   endif
550#  endif
551# endif
552#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
553
554
555#if (! defined yyoverflow \
556     && (! defined __cplusplus \
557	 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
558
559/* A type that is properly aligned for any stack member.  */
560union yyalloc
561{
562  yytype_int16 yyss;
563  YYSTYPE yyvs;
564  };
565
566/* The size of the maximum gap between one aligned stack and the next.  */
567# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
568
569/* The size of an array large to enough to hold all stacks, each with
570   N elements.  */
571# define YYSTACK_BYTES(N) \
572     ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
573      + YYSTACK_GAP_MAXIMUM)
574
575/* Copy COUNT objects from FROM to TO.  The source and destination do
576   not overlap.  */
577# ifndef YYCOPY
578#  if defined __GNUC__ && 1 < __GNUC__
579#   define YYCOPY(To, From, Count) \
580      __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
581#  else
582#   define YYCOPY(To, From, Count)		\
583      do					\
584	{					\
585	  YYSIZE_T yyi;				\
586	  for (yyi = 0; yyi < (Count); yyi++)	\
587	    (To)[yyi] = (From)[yyi];		\
588	}					\
589      while (YYID (0))
590#  endif
591# endif
592
593/* Relocate STACK from its old location to the new one.  The
594   local variables YYSIZE and YYSTACKSIZE give the old and new number of
595   elements in the stack, and YYPTR gives the new location of the
596   stack.  Advance YYPTR to a properly aligned location for the next
597   stack.  */
598# define YYSTACK_RELOCATE(Stack)					\
599    do									\
600      {									\
601	YYSIZE_T yynewbytes;						\
602	YYCOPY (&yyptr->Stack, Stack, yysize);				\
603	Stack = &yyptr->Stack;						\
604	yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
605	yyptr += yynewbytes / sizeof (*yyptr);				\
606      }									\
607    while (YYID (0))
608
609#endif
610
611/* YYFINAL -- State number of the termination state.  */
612#define YYFINAL  9
613/* YYLAST -- Last index in YYTABLE.  */
614#define YYLAST   46
615
616/* YYNTOKENS -- Number of terminals.  */
617#define YYNTOKENS  20
618/* YYNNTS -- Number of nonterminals.  */
619#define YYNNTS  15
620/* YYNRULES -- Number of rules.  */
621#define YYNRULES  29
622/* YYNRULES -- Number of states.  */
623#define YYNSTATES  51
624
625/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
626#define YYUNDEFTOK  2
627#define YYMAXUTOK   267
628
629#define YYTRANSLATE(YYX)						\
630  ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
631
632/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX.  */
633static const yytype_uint8 yytranslate[] =
634{
635       0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
636       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
637       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
638       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
639       2,     2,    17,     2,    13,    19,     2,     2,     2,     2,
640       2,     2,     2,     2,     2,     2,     2,     2,    18,     2,
641       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
642       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
643       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
644       2,    15,     2,    16,     2,     2,     2,     2,     2,     2,
645       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
646       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
647       2,     2,     2,     2,    14,     2,     2,     2,     2,     2,
648       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
649       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
650       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
651       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
652       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
653       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
654       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
655       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
656       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
657       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
658       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
659       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
660       2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
661       5,     6,     7,     8,     9,    10,    11,    12
662};
663
664#if YYDEBUG
665/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
666   YYRHS.  */
667static const yytype_uint8 yyprhs[] =
668{
669       0,     0,     3,     5,     8,     9,    15,    16,    26,    28,
670      31,    35,    38,    39,    41,    43,    45,    49,    53,    57,
671      59,    62,    63,    68,    69,    71,    73,    75,    77,    79
672};
673
674/* YYRHS -- A `-1'-separated list of the rules' RHS.  */
675static const yytype_int8 yyrhs[] =
676{
677      21,     0,    -1,    22,    -1,    23,    22,    -1,    -1,    31,
678      32,    33,    34,    11,    -1,    -1,    31,     8,    33,    34,
679      30,    29,    24,    25,    11,    -1,    11,    -1,     1,    11,
680      -1,    13,    27,    25,    -1,    27,    25,    -1,    -1,    32,
681      -1,     7,    -1,     6,    -1,    26,    30,    29,    -1,     9,
682      14,    28,    -1,    15,    28,    16,    -1,     9,    -1,    17,
683      28,    -1,    -1,    18,     9,    19,     9,    -1,    -1,    12,
684      -1,     3,    -1,     4,    -1,     5,    -1,    10,    -1,     9,
685      -1
686};
687
688/* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
689static const yytype_uint16 yyrline[] =
690{
691       0,   299,   299,   303,   304,   308,   315,   314,   323,   324,
692     328,   329,   330,   334,   339,   344,   352,   361,   365,   369,
693     376,   382,   388,   395,   402,   410,   415,   420,   428,   444
694};
695#endif
696
697#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
698/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
699   First, the terminals, then, starting at YYNTOKENS, nonterminals.  */
700static const char *const yytname[] =
701{
702  "$end", "error", "$undefined", "DREG", "CREG", "GREG", "IMMED", "ADDR",
703  "INSN", "NUM", "ID", "NL", "PNUM", "','", "'|'", "'['", "']'", "'*'",
704  "':'", "'-'", "$accept", "insntbl", "entrys", "entry", "@1",
705  "fieldspecs", "ftype", "fieldspec", "flagexpr", "flags", "range", "pnum",
706  "regtype", "name", "value", 0
707};
708#endif
709
710# ifdef YYPRINT
711/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
712   token YYLEX-NUM.  */
713static const yytype_uint16 yytoknum[] =
714{
715       0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
716     265,   266,   267,    44,   124,    91,    93,    42,    58,    45
717};
718# endif
719
720/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
721static const yytype_uint8 yyr1[] =
722{
723       0,    20,    21,    22,    22,    23,    24,    23,    23,    23,
724      25,    25,    25,    26,    26,    26,    27,    28,    28,    28,
725      29,    29,    30,    30,    31,    32,    32,    32,    33,    34
726};
727
728/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
729static const yytype_uint8 yyr2[] =
730{
731       0,     2,     1,     2,     0,     5,     0,     9,     1,     2,
732       3,     2,     0,     1,     1,     1,     3,     3,     3,     1,
733       2,     0,     4,     0,     1,     1,     1,     1,     1,     1
734};
735
736/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
737   STATE-NUM when YYTABLE doesn't specify something else to do.  Zero
738   means the default is an error.  */
739static const yytype_uint8 yydefact[] =
740{
741       0,     0,     8,    24,     0,     2,     0,     0,     9,     1,
742       3,    25,    26,    27,     0,     0,    28,     0,     0,    29,
743      23,     0,     0,    21,     5,     0,     0,     6,     0,    19,
744       0,    20,    12,    22,     0,     0,    15,    14,     0,     0,
745      23,    12,    13,    17,    18,    12,     7,    21,    11,    10,
746      16
747};
748
749/* YYDEFGOTO[NTERM-NUM].  */
750static const yytype_int8 yydefgoto[] =
751{
752      -1,     4,     5,     6,    32,    39,    40,    41,    31,    27,
753      23,     7,    42,    17,    20
754};
755
756/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
757   STATE-NUM.  */
758#define YYPACT_NINF -16
759static const yytype_int8 yypact[] =
760{
761       0,    -9,   -16,   -16,    10,   -16,     0,    12,   -16,   -16,
762     -16,   -16,   -16,   -16,     3,     3,   -16,     9,     9,   -16,
763      11,     8,    19,    15,   -16,    14,    -6,   -16,    25,    21,
764      -6,   -16,     1,   -16,    -6,    20,   -16,   -16,    18,    26,
765      11,     1,   -16,   -16,   -16,     1,   -16,    15,   -16,   -16,
766     -16
767};
768
769/* YYPGOTO[NTERM-NUM].  */
770static const yytype_int8 yypgoto[] =
771{
772     -16,   -16,    32,   -16,   -16,   -15,   -16,     2,    -3,    -8,
773       4,   -16,    34,    27,    28
774};
775
776/* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
777   positive, shift that token.  If negative, reduce the rule which
778   number is the opposite.  If zero, do what YYDEFACT says.
779   If YYTABLE_NINF, syntax error.  */
780#define YYTABLE_NINF -5
781static const yytype_int8 yytable[] =
782{
783      -4,     1,     8,    29,    11,    12,    13,    36,    37,    30,
784       9,     2,     3,    16,    38,    11,    12,    13,    19,    24,
785      14,    11,    12,    13,    36,    37,    48,    35,    25,    22,
786      49,    43,    26,    28,    33,    34,    44,    46,    10,    50,
787      45,    15,    18,     0,    47,     0,    21
788};
789
790static const yytype_int8 yycheck[] =
791{
792       0,     1,    11,     9,     3,     4,     5,     6,     7,    15,
793       0,    11,    12,    10,    13,     3,     4,     5,     9,    11,
794       8,     3,     4,     5,     6,     7,    41,    30,     9,    18,
795      45,    34,    17,    19,     9,    14,    16,    11,     6,    47,
796      38,     7,    15,    -1,    40,    -1,    18
797};
798
799/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
800   symbol of state STATE-NUM.  */
801static const yytype_uint8 yystos[] =
802{
803       0,     1,    11,    12,    21,    22,    23,    31,    11,     0,
804      22,     3,     4,     5,     8,    32,    10,    33,    33,     9,
805      34,    34,    18,    30,    11,     9,    17,    29,    19,     9,
806      15,    28,    24,     9,    14,    28,     6,     7,    13,    25,
807      26,    27,    32,    28,    16,    27,    11,    30,    25,    25,
808      29
809};
810
811#define yyerrok		(yyerrstatus = 0)
812#define yyclearin	(yychar = YYEMPTY)
813#define YYEMPTY		(-2)
814#define YYEOF		0
815
816#define YYACCEPT	goto yyacceptlab
817#define YYABORT		goto yyabortlab
818#define YYERROR		goto yyerrorlab
819
820
821/* Like YYERROR except do call yyerror.  This remains here temporarily
822   to ease the transition to the new meaning of YYERROR, for GCC.
823   Once GCC version 2 has supplanted version 1, this can go.  */
824
825#define YYFAIL		goto yyerrlab
826
827#define YYRECOVERING()  (!!yyerrstatus)
828
829#define YYBACKUP(Token, Value)					\
830do								\
831  if (yychar == YYEMPTY && yylen == 1)				\
832    {								\
833      yychar = (Token);						\
834      yylval = (Value);						\
835      yytoken = YYTRANSLATE (yychar);				\
836      YYPOPSTACK (1);						\
837      goto yybackup;						\
838    }								\
839  else								\
840    {								\
841      yyerror (YY_("syntax error: cannot back up")); \
842      YYERROR;							\
843    }								\
844while (YYID (0))
845
846
847#define YYTERROR	1
848#define YYERRCODE	256
849
850
851/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
852   If N is 0, then set CURRENT to the empty location which ends
853   the previous symbol: RHS[0] (always defined).  */
854
855#define YYRHSLOC(Rhs, K) ((Rhs)[K])
856#ifndef YYLLOC_DEFAULT
857# define YYLLOC_DEFAULT(Current, Rhs, N)				\
858    do									\
859      if (YYID (N))                                                    \
860	{								\
861	  (Current).first_line   = YYRHSLOC (Rhs, 1).first_line;	\
862	  (Current).first_column = YYRHSLOC (Rhs, 1).first_column;	\
863	  (Current).last_line    = YYRHSLOC (Rhs, N).last_line;		\
864	  (Current).last_column  = YYRHSLOC (Rhs, N).last_column;	\
865	}								\
866      else								\
867	{								\
868	  (Current).first_line   = (Current).last_line   =		\
869	    YYRHSLOC (Rhs, 0).last_line;				\
870	  (Current).first_column = (Current).last_column =		\
871	    YYRHSLOC (Rhs, 0).last_column;				\
872	}								\
873    while (YYID (0))
874#endif
875
876
877/* YY_LOCATION_PRINT -- Print the location on the stream.
878   This macro was not mandated originally: define only if we know
879   we won't break user code: when these are the locations we know.  */
880
881#ifndef YY_LOCATION_PRINT
882# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
883#  define YY_LOCATION_PRINT(File, Loc)			\
884     fprintf (File, "%d.%d-%d.%d",			\
885	      (Loc).first_line, (Loc).first_column,	\
886	      (Loc).last_line,  (Loc).last_column)
887# else
888#  define YY_LOCATION_PRINT(File, Loc) ((void) 0)
889# endif
890#endif
891
892
893/* YYLEX -- calling `yylex' with the right arguments.  */
894
895#ifdef YYLEX_PARAM
896# define YYLEX yylex (YYLEX_PARAM)
897#else
898# define YYLEX yylex ()
899#endif
900
901/* Enable debugging if requested.  */
902#if YYDEBUG
903
904# ifndef YYFPRINTF
905#  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
906#  define YYFPRINTF fprintf
907# endif
908
909# define YYDPRINTF(Args)			\
910do {						\
911  if (yydebug)					\
912    YYFPRINTF Args;				\
913} while (YYID (0))
914
915# define YY_SYMBOL_PRINT(Title, Type, Value, Location)			  \
916do {									  \
917  if (yydebug)								  \
918    {									  \
919      YYFPRINTF (stderr, "%s ", Title);					  \
920      yy_symbol_print (stderr,						  \
921		  Type, Value); \
922      YYFPRINTF (stderr, "\n");						  \
923    }									  \
924} while (YYID (0))
925
926
927/*--------------------------------.
928| Print this symbol on YYOUTPUT.  |
929`--------------------------------*/
930
931/*ARGSUSED*/
932#if (defined __STDC__ || defined __C99__FUNC__ \
933     || defined __cplusplus || defined _MSC_VER)
934static void
935yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
936#else
937static void
938yy_symbol_value_print (yyoutput, yytype, yyvaluep)
939    FILE *yyoutput;
940    int yytype;
941    YYSTYPE const * const yyvaluep;
942#endif
943{
944  if (!yyvaluep)
945    return;
946# ifdef YYPRINT
947  if (yytype < YYNTOKENS)
948    YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
949# else
950  YYUSE (yyoutput);
951# endif
952  switch (yytype)
953    {
954      default:
955	break;
956    }
957}
958
959
960/*--------------------------------.
961| Print this symbol on YYOUTPUT.  |
962`--------------------------------*/
963
964#if (defined __STDC__ || defined __C99__FUNC__ \
965     || defined __cplusplus || defined _MSC_VER)
966static void
967yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
968#else
969static void
970yy_symbol_print (yyoutput, yytype, yyvaluep)
971    FILE *yyoutput;
972    int yytype;
973    YYSTYPE const * const yyvaluep;
974#endif
975{
976  if (yytype < YYNTOKENS)
977    YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
978  else
979    YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
980
981  yy_symbol_value_print (yyoutput, yytype, yyvaluep);
982  YYFPRINTF (yyoutput, ")");
983}
984
985/*------------------------------------------------------------------.
986| yy_stack_print -- Print the state stack from its BOTTOM up to its |
987| TOP (included).                                                   |
988`------------------------------------------------------------------*/
989
990#if (defined __STDC__ || defined __C99__FUNC__ \
991     || defined __cplusplus || defined _MSC_VER)
992static void
993yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
994#else
995static void
996yy_stack_print (bottom, top)
997    yytype_int16 *bottom;
998    yytype_int16 *top;
999#endif
1000{
1001  YYFPRINTF (stderr, "Stack now");
1002  for (; bottom <= top; ++bottom)
1003    YYFPRINTF (stderr, " %d", *bottom);
1004  YYFPRINTF (stderr, "\n");
1005}
1006
1007# define YY_STACK_PRINT(Bottom, Top)				\
1008do {								\
1009  if (yydebug)							\
1010    yy_stack_print ((Bottom), (Top));				\
1011} while (YYID (0))
1012
1013
1014/*------------------------------------------------.
1015| Report that the YYRULE is going to be reduced.  |
1016`------------------------------------------------*/
1017
1018#if (defined __STDC__ || defined __C99__FUNC__ \
1019     || defined __cplusplus || defined _MSC_VER)
1020static void
1021yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
1022#else
1023static void
1024yy_reduce_print (yyvsp, yyrule)
1025    YYSTYPE *yyvsp;
1026    int yyrule;
1027#endif
1028{
1029  int yynrhs = yyr2[yyrule];
1030  int yyi;
1031  unsigned long int yylno = yyrline[yyrule];
1032  YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
1033	     yyrule - 1, yylno);
1034  /* The symbols being reduced.  */
1035  for (yyi = 0; yyi < yynrhs; yyi++)
1036    {
1037      fprintf (stderr, "   $%d = ", yyi + 1);
1038      yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
1039		       &(yyvsp[(yyi + 1) - (yynrhs)])
1040		       		       );
1041      fprintf (stderr, "\n");
1042    }
1043}
1044
1045# define YY_REDUCE_PRINT(Rule)		\
1046do {					\
1047  if (yydebug)				\
1048    yy_reduce_print (yyvsp, Rule); \
1049} while (YYID (0))
1050
1051/* Nonzero means print parse trace.  It is left uninitialized so that
1052   multiple parsers can coexist.  */
1053int yydebug;
1054#else /* !YYDEBUG */
1055# define YYDPRINTF(Args)
1056# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
1057# define YY_STACK_PRINT(Bottom, Top)
1058# define YY_REDUCE_PRINT(Rule)
1059#endif /* !YYDEBUG */
1060
1061
1062/* YYINITDEPTH -- initial size of the parser's stacks.  */
1063#ifndef	YYINITDEPTH
1064# define YYINITDEPTH 200
1065#endif
1066
1067/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1068   if the built-in stack extension method is used).
1069
1070   Do not make this value too large; the results are undefined if
1071   YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1072   evaluated with infinite-precision integer arithmetic.  */
1073
1074#ifndef YYMAXDEPTH
1075# define YYMAXDEPTH 10000
1076#endif
1077
1078
1079
1080#if YYERROR_VERBOSE
1081
1082# ifndef yystrlen
1083#  if defined __GLIBC__ && defined _STRING_H
1084#   define yystrlen strlen
1085#  else
1086/* Return the length of YYSTR.  */
1087#if (defined __STDC__ || defined __C99__FUNC__ \
1088     || defined __cplusplus || defined _MSC_VER)
1089static YYSIZE_T
1090yystrlen (const char *yystr)
1091#else
1092static YYSIZE_T
1093yystrlen (yystr)
1094    const char *yystr;
1095#endif
1096{
1097  YYSIZE_T yylen;
1098  for (yylen = 0; yystr[yylen]; yylen++)
1099    continue;
1100  return yylen;
1101}
1102#  endif
1103# endif
1104
1105# ifndef yystpcpy
1106#  if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1107#   define yystpcpy stpcpy
1108#  else
1109/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1110   YYDEST.  */
1111#if (defined __STDC__ || defined __C99__FUNC__ \
1112     || defined __cplusplus || defined _MSC_VER)
1113static char *
1114yystpcpy (char *yydest, const char *yysrc)
1115#else
1116static char *
1117yystpcpy (yydest, yysrc)
1118    char *yydest;
1119    const char *yysrc;
1120#endif
1121{
1122  char *yyd = yydest;
1123  const char *yys = yysrc;
1124
1125  while ((*yyd++ = *yys++) != '\0')
1126    continue;
1127
1128  return yyd - 1;
1129}
1130#  endif
1131# endif
1132
1133# ifndef yytnamerr
1134/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1135   quotes and backslashes, so that it's suitable for yyerror.  The
1136   heuristic is that double-quoting is unnecessary unless the string
1137   contains an apostrophe, a comma, or backslash (other than
1138   backslash-backslash).  YYSTR is taken from yytname.  If YYRES is
1139   null, do not copy; instead, return the length of what the result
1140   would have been.  */
1141static YYSIZE_T
1142yytnamerr (char *yyres, const char *yystr)
1143{
1144  if (*yystr == '"')
1145    {
1146      YYSIZE_T yyn = 0;
1147      char const *yyp = yystr;
1148
1149      for (;;)
1150	switch (*++yyp)
1151	  {
1152	  case '\'':
1153	  case ',':
1154	    goto do_not_strip_quotes;
1155
1156	  case '\\':
1157	    if (*++yyp != '\\')
1158	      goto do_not_strip_quotes;
1159	    /* Fall through.  */
1160	  default:
1161	    if (yyres)
1162	      yyres[yyn] = *yyp;
1163	    yyn++;
1164	    break;
1165
1166	  case '"':
1167	    if (yyres)
1168	      yyres[yyn] = '\0';
1169	    return yyn;
1170	  }
1171    do_not_strip_quotes: ;
1172    }
1173
1174  if (! yyres)
1175    return yystrlen (yystr);
1176
1177  return yystpcpy (yyres, yystr) - yyres;
1178}
1179# endif
1180
1181/* Copy into YYRESULT an error message about the unexpected token
1182   YYCHAR while in state YYSTATE.  Return the number of bytes copied,
1183   including the terminating null byte.  If YYRESULT is null, do not
1184   copy anything; just return the number of bytes that would be
1185   copied.  As a special case, return 0 if an ordinary "syntax error"
1186   message will do.  Return YYSIZE_MAXIMUM if overflow occurs during
1187   size calculation.  */
1188static YYSIZE_T
1189yysyntax_error (char *yyresult, int yystate, int yychar)
1190{
1191  int yyn = yypact[yystate];
1192
1193  if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
1194    return 0;
1195  else
1196    {
1197      int yytype = YYTRANSLATE (yychar);
1198      YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
1199      YYSIZE_T yysize = yysize0;
1200      YYSIZE_T yysize1;
1201      int yysize_overflow = 0;
1202      enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1203      char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1204      int yyx;
1205
1206# if 0
1207      /* This is so xgettext sees the translatable formats that are
1208	 constructed on the fly.  */
1209      YY_("syntax error, unexpected %s");
1210      YY_("syntax error, unexpected %s, expecting %s");
1211      YY_("syntax error, unexpected %s, expecting %s or %s");
1212      YY_("syntax error, unexpected %s, expecting %s or %s or %s");
1213      YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
1214# endif
1215      char *yyfmt;
1216      char const *yyf;
1217      static char const yyunexpected[] = "syntax error, unexpected %s";
1218      static char const yyexpecting[] = ", expecting %s";
1219      static char const yyor[] = " or %s";
1220      char yyformat[sizeof yyunexpected
1221		    + sizeof yyexpecting - 1
1222		    + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
1223		       * (sizeof yyor - 1))];
1224      char const *yyprefix = yyexpecting;
1225
1226      /* Start YYX at -YYN if negative to avoid negative indexes in
1227	 YYCHECK.  */
1228      int yyxbegin = yyn < 0 ? -yyn : 0;
1229
1230      /* Stay within bounds of both yycheck and yytname.  */
1231      int yychecklim = YYLAST - yyn + 1;
1232      int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1233      int yycount = 1;
1234
1235      yyarg[0] = yytname[yytype];
1236      yyfmt = yystpcpy (yyformat, yyunexpected);
1237
1238      for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1239	if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1240	  {
1241	    if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1242	      {
1243		yycount = 1;
1244		yysize = yysize0;
1245		yyformat[sizeof yyunexpected - 1] = '\0';
1246		break;
1247	      }
1248	    yyarg[yycount++] = yytname[yyx];
1249	    yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1250	    yysize_overflow |= (yysize1 < yysize);
1251	    yysize = yysize1;
1252	    yyfmt = yystpcpy (yyfmt, yyprefix);
1253	    yyprefix = yyor;
1254	  }
1255
1256      yyf = YY_(yyformat);
1257      yysize1 = yysize + yystrlen (yyf);
1258      yysize_overflow |= (yysize1 < yysize);
1259      yysize = yysize1;
1260
1261      if (yysize_overflow)
1262	return YYSIZE_MAXIMUM;
1263
1264      if (yyresult)
1265	{
1266	  /* Avoid sprintf, as that infringes on the user's name space.
1267	     Don't have undefined behavior even if the translation
1268	     produced a string with the wrong number of "%s"s.  */
1269	  char *yyp = yyresult;
1270	  int yyi = 0;
1271	  while ((*yyp = *yyf) != '\0')
1272	    {
1273	      if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
1274		{
1275		  yyp += yytnamerr (yyp, yyarg[yyi++]);
1276		  yyf += 2;
1277		}
1278	      else
1279		{
1280		  yyp++;
1281		  yyf++;
1282		}
1283	    }
1284	}
1285      return yysize;
1286    }
1287}
1288#endif /* YYERROR_VERBOSE */
1289
1290
1291/*-----------------------------------------------.
1292| Release the memory associated to this symbol.  |
1293`-----------------------------------------------*/
1294
1295/*ARGSUSED*/
1296#if (defined __STDC__ || defined __C99__FUNC__ \
1297     || defined __cplusplus || defined _MSC_VER)
1298static void
1299yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
1300#else
1301static void
1302yydestruct (yymsg, yytype, yyvaluep)
1303    const char *yymsg;
1304    int yytype;
1305    YYSTYPE *yyvaluep;
1306#endif
1307{
1308  YYUSE (yyvaluep);
1309
1310  if (!yymsg)
1311    yymsg = "Deleting";
1312  YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1313
1314  switch (yytype)
1315    {
1316
1317      default:
1318	break;
1319    }
1320}
1321
1322
1323/* Prevent warnings from -Wmissing-prototypes.  */
1324
1325#ifdef YYPARSE_PARAM
1326#if defined __STDC__ || defined __cplusplus
1327int yyparse (void *YYPARSE_PARAM);
1328#else
1329int yyparse ();
1330#endif
1331#else /* ! YYPARSE_PARAM */
1332#if defined __STDC__ || defined __cplusplus
1333int yyparse (void);
1334#else
1335int yyparse ();
1336#endif
1337#endif /* ! YYPARSE_PARAM */
1338
1339
1340
1341/* The look-ahead symbol.  */
1342int yychar;
1343
1344/* The semantic value of the look-ahead symbol.  */
1345YYSTYPE yylval;
1346
1347/* Number of syntax errors so far.  */
1348int yynerrs;
1349
1350
1351
1352/*----------.
1353| yyparse.  |
1354`----------*/
1355
1356#ifdef YYPARSE_PARAM
1357#if (defined __STDC__ || defined __C99__FUNC__ \
1358     || defined __cplusplus || defined _MSC_VER)
1359int
1360yyparse (void *YYPARSE_PARAM)
1361#else
1362int
1363yyparse (YYPARSE_PARAM)
1364    void *YYPARSE_PARAM;
1365#endif
1366#else /* ! YYPARSE_PARAM */
1367#if (defined __STDC__ || defined __C99__FUNC__ \
1368     || defined __cplusplus || defined _MSC_VER)
1369int
1370yyparse (void)
1371#else
1372int
1373yyparse ()
1374
1375#endif
1376#endif
1377{
1378
1379  int yystate;
1380  int yyn;
1381  int yyresult;
1382  /* Number of tokens to shift before error messages enabled.  */
1383  int yyerrstatus;
1384  /* Look-ahead token as an internal (translated) token number.  */
1385  int yytoken = 0;
1386#if YYERROR_VERBOSE
1387  /* Buffer for error messages, and its allocated size.  */
1388  char yymsgbuf[128];
1389  char *yymsg = yymsgbuf;
1390  YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1391#endif
1392
1393  /* Three stacks and their tools:
1394     `yyss': related to states,
1395     `yyvs': related to semantic values,
1396     `yyls': related to locations.
1397
1398     Refer to the stacks thru separate pointers, to allow yyoverflow
1399     to reallocate them elsewhere.  */
1400
1401  /* The state stack.  */
1402  yytype_int16 yyssa[YYINITDEPTH];
1403  yytype_int16 *yyss = yyssa;
1404  yytype_int16 *yyssp;
1405
1406  /* The semantic value stack.  */
1407  YYSTYPE yyvsa[YYINITDEPTH];
1408  YYSTYPE *yyvs = yyvsa;
1409  YYSTYPE *yyvsp;
1410
1411
1412
1413#define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N))
1414
1415  YYSIZE_T yystacksize = YYINITDEPTH;
1416
1417  /* The variables used to return semantic value and location from the
1418     action routines.  */
1419  YYSTYPE yyval;
1420
1421
1422  /* The number of symbols on the RHS of the reduced rule.
1423     Keep to zero when no symbol should be popped.  */
1424  int yylen = 0;
1425
1426  YYDPRINTF ((stderr, "Starting parse\n"));
1427
1428  yystate = 0;
1429  yyerrstatus = 0;
1430  yynerrs = 0;
1431  yychar = YYEMPTY;		/* Cause a token to be read.  */
1432
1433  /* Initialize stack pointers.
1434     Waste one element of value and location stack
1435     so that they stay on the same level as the state stack.
1436     The wasted elements are never initialized.  */
1437
1438  yyssp = yyss;
1439  yyvsp = yyvs;
1440
1441  goto yysetstate;
1442
1443/*------------------------------------------------------------.
1444| yynewstate -- Push a new state, which is found in yystate.  |
1445`------------------------------------------------------------*/
1446 yynewstate:
1447  /* In all cases, when you get here, the value and location stacks
1448     have just been pushed.  So pushing a state here evens the stacks.  */
1449  yyssp++;
1450
1451 yysetstate:
1452  *yyssp = yystate;
1453
1454  if (yyss + yystacksize - 1 <= yyssp)
1455    {
1456      /* Get the current used size of the three stacks, in elements.  */
1457      YYSIZE_T yysize = yyssp - yyss + 1;
1458
1459#ifdef yyoverflow
1460      {
1461	/* Give user a chance to reallocate the stack.  Use copies of
1462	   these so that the &'s don't force the real ones into
1463	   memory.  */
1464	YYSTYPE *yyvs1 = yyvs;
1465	yytype_int16 *yyss1 = yyss;
1466
1467
1468	/* Each stack pointer address is followed by the size of the
1469	   data in use in that stack, in bytes.  This used to be a
1470	   conditional around just the two extra args, but that might
1471	   be undefined if yyoverflow is a macro.  */
1472	yyoverflow (YY_("memory exhausted"),
1473		    &yyss1, yysize * sizeof (*yyssp),
1474		    &yyvs1, yysize * sizeof (*yyvsp),
1475
1476		    &yystacksize);
1477
1478	yyss = yyss1;
1479	yyvs = yyvs1;
1480      }
1481#else /* no yyoverflow */
1482# ifndef YYSTACK_RELOCATE
1483      goto yyexhaustedlab;
1484# else
1485      /* Extend the stack our own way.  */
1486      if (YYMAXDEPTH <= yystacksize)
1487	goto yyexhaustedlab;
1488      yystacksize *= 2;
1489      if (YYMAXDEPTH < yystacksize)
1490	yystacksize = YYMAXDEPTH;
1491
1492      {
1493	yytype_int16 *yyss1 = yyss;
1494	union yyalloc *yyptr =
1495	  (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1496	if (! yyptr)
1497	  goto yyexhaustedlab;
1498	YYSTACK_RELOCATE (yyss);
1499	YYSTACK_RELOCATE (yyvs);
1500
1501#  undef YYSTACK_RELOCATE
1502	if (yyss1 != yyssa)
1503	  YYSTACK_FREE (yyss1);
1504      }
1505# endif
1506#endif /* no yyoverflow */
1507
1508      yyssp = yyss + yysize - 1;
1509      yyvsp = yyvs + yysize - 1;
1510
1511
1512      YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1513		  (unsigned long int) yystacksize));
1514
1515      if (yyss + yystacksize - 1 <= yyssp)
1516	YYABORT;
1517    }
1518
1519  YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1520
1521  goto yybackup;
1522
1523/*-----------.
1524| yybackup.  |
1525`-----------*/
1526yybackup:
1527
1528  /* Do appropriate processing given the current state.  Read a
1529     look-ahead token if we need one and don't already have one.  */
1530
1531  /* First try to decide what to do without reference to look-ahead token.  */
1532  yyn = yypact[yystate];
1533  if (yyn == YYPACT_NINF)
1534    goto yydefault;
1535
1536  /* Not known => get a look-ahead token if don't already have one.  */
1537
1538  /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol.  */
1539  if (yychar == YYEMPTY)
1540    {
1541      YYDPRINTF ((stderr, "Reading a token: "));
1542      yychar = YYLEX;
1543    }
1544
1545  if (yychar <= YYEOF)
1546    {
1547      yychar = yytoken = YYEOF;
1548      YYDPRINTF ((stderr, "Now at end of input.\n"));
1549    }
1550  else
1551    {
1552      yytoken = YYTRANSLATE (yychar);
1553      YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1554    }
1555
1556  /* If the proper action on seeing token YYTOKEN is to reduce or to
1557     detect an error, take that action.  */
1558  yyn += yytoken;
1559  if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1560    goto yydefault;
1561  yyn = yytable[yyn];
1562  if (yyn <= 0)
1563    {
1564      if (yyn == 0 || yyn == YYTABLE_NINF)
1565	goto yyerrlab;
1566      yyn = -yyn;
1567      goto yyreduce;
1568    }
1569
1570  if (yyn == YYFINAL)
1571    YYACCEPT;
1572
1573  /* Count tokens shifted since error; after three, turn off error
1574     status.  */
1575  if (yyerrstatus)
1576    yyerrstatus--;
1577
1578  /* Shift the look-ahead token.  */
1579  YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1580
1581  /* Discard the shifted token unless it is eof.  */
1582  if (yychar != YYEOF)
1583    yychar = YYEMPTY;
1584
1585  yystate = yyn;
1586  *++yyvsp = yylval;
1587
1588  goto yynewstate;
1589
1590
1591/*-----------------------------------------------------------.
1592| yydefault -- do the default action for the current state.  |
1593`-----------------------------------------------------------*/
1594yydefault:
1595  yyn = yydefact[yystate];
1596  if (yyn == 0)
1597    goto yyerrlab;
1598  goto yyreduce;
1599
1600
1601/*-----------------------------.
1602| yyreduce -- Do a reduction.  |
1603`-----------------------------*/
1604yyreduce:
1605  /* yyn is the number of a rule to reduce with.  */
1606  yylen = yyr2[yyn];
1607
1608  /* If YYLEN is nonzero, implement the default value of the action:
1609     `$$ = $1'.
1610
1611     Otherwise, the following line sets YYVAL to garbage.
1612     This behavior is undocumented and Bison
1613     users should not rely upon it.  Assigning to YYVAL
1614     unconditionally makes the parser a bit smaller, and it avoids a
1615     GCC warning that YYVAL may be used uninitialized.  */
1616  yyval = yyvsp[1-yylen];
1617
1618
1619  YY_REDUCE_PRINT (yyn);
1620  switch (yyn)
1621    {
1622        case 5:
1623#line 309 "itbl-parse.y"
1624    {
1625	    DBG (("line %d: entry pnum=%d type=%d name=%s value=x%x\n",
1626	    	    insntbl_line, (yyvsp[(1) - (5)].num), (yyvsp[(2) - (5)].num), (yyvsp[(3) - (5)].str), (yyvsp[(4) - (5)].val)));
1627	    itbl_add_reg ((yyvsp[(1) - (5)].num), (yyvsp[(2) - (5)].num), (yyvsp[(3) - (5)].str), (yyvsp[(4) - (5)].val));
1628	  }
1629    break;
1630
1631  case 6:
1632#line 315 "itbl-parse.y"
1633    {
1634	    DBG (("line %d: entry pnum=%d type=INSN name=%s value=x%x",
1635	    	    insntbl_line, (yyvsp[(1) - (6)].num), (yyvsp[(3) - (6)].str), (yyvsp[(4) - (6)].val)));
1636	    DBG ((" sbit=%d ebit=%d flags=0x%x\n", sbit, ebit, (yyvsp[(6) - (6)].val)));
1637	    insn=itbl_add_insn ((yyvsp[(1) - (6)].num), (yyvsp[(3) - (6)].str), (yyvsp[(4) - (6)].val), sbit, ebit, (yyvsp[(6) - (6)].val));
1638	  }
1639    break;
1640
1641  case 7:
1642#line 322 "itbl-parse.y"
1643    {}
1644    break;
1645
1646  case 13:
1647#line 335 "itbl-parse.y"
1648    {
1649	    DBGL2 (("ftype\n"));
1650	    (yyval.num) = (yyvsp[(1) - (1)].num);
1651	  }
1652    break;
1653
1654  case 14:
1655#line 340 "itbl-parse.y"
1656    {
1657	    DBGL2 (("addr\n"));
1658	    (yyval.num) = ADDR;
1659	  }
1660    break;
1661
1662  case 15:
1663#line 345 "itbl-parse.y"
1664    {
1665	    DBGL2 (("immed\n"));
1666	    (yyval.num) = IMMED;
1667	  }
1668    break;
1669
1670  case 16:
1671#line 353 "itbl-parse.y"
1672    {
1673	    DBG (("line %d: field type=%d sbit=%d ebit=%d, flags=0x%x\n",
1674	    	    insntbl_line, (yyvsp[(1) - (3)].num), sbit, ebit, (yyvsp[(3) - (3)].val)));
1675	    itbl_add_operand (insn, (yyvsp[(1) - (3)].num), sbit, ebit, (yyvsp[(3) - (3)].val));
1676	  }
1677    break;
1678
1679  case 17:
1680#line 362 "itbl-parse.y"
1681    {
1682	    (yyval.val) = (yyvsp[(1) - (3)].num) | (yyvsp[(3) - (3)].val);
1683	  }
1684    break;
1685
1686  case 18:
1687#line 366 "itbl-parse.y"
1688    {
1689	    (yyval.val) = (yyvsp[(2) - (3)].val);
1690	  }
1691    break;
1692
1693  case 19:
1694#line 370 "itbl-parse.y"
1695    {
1696	    (yyval.val) = (yyvsp[(1) - (1)].num);
1697	  }
1698    break;
1699
1700  case 20:
1701#line 377 "itbl-parse.y"
1702    {
1703	    DBGL2 (("flags=%d\n", (yyvsp[(2) - (2)].val)));
1704	    (yyval.val) = (yyvsp[(2) - (2)].val);
1705	  }
1706    break;
1707
1708  case 21:
1709#line 382 "itbl-parse.y"
1710    {
1711	    (yyval.val) = 0;
1712	  }
1713    break;
1714
1715  case 22:
1716#line 389 "itbl-parse.y"
1717    {
1718	    DBGL2 (("range %d %d\n", (yyvsp[(2) - (4)].num), (yyvsp[(4) - (4)].num)));
1719	    sbit = (yyvsp[(2) - (4)].num);
1720	    ebit = (yyvsp[(4) - (4)].num);
1721	  }
1722    break;
1723
1724  case 23:
1725#line 395 "itbl-parse.y"
1726    {
1727	    sbit = 31;
1728	    ebit = 0;
1729	  }
1730    break;
1731
1732  case 24:
1733#line 403 "itbl-parse.y"
1734    {
1735	    DBGL2 (("pnum=%d\n",(yyvsp[(1) - (1)].num)));
1736	    (yyval.num) = (yyvsp[(1) - (1)].num);
1737	  }
1738    break;
1739
1740  case 25:
1741#line 411 "itbl-parse.y"
1742    {
1743	    DBGL2 (("dreg\n"));
1744	    (yyval.num) = DREG;
1745	  }
1746    break;
1747
1748  case 26:
1749#line 416 "itbl-parse.y"
1750    {
1751	    DBGL2 (("creg\n"));
1752	    (yyval.num) = CREG;
1753	  }
1754    break;
1755
1756  case 27:
1757#line 421 "itbl-parse.y"
1758    {
1759	    DBGL2 (("greg\n"));
1760	    (yyval.num) = GREG;
1761	  }
1762    break;
1763
1764  case 28:
1765#line 429 "itbl-parse.y"
1766    {
1767	    DBGL2 (("name=%s\n",(yyvsp[(1) - (1)].str)));
1768	    (yyval.str) = (yyvsp[(1) - (1)].str);
1769	  }
1770    break;
1771
1772  case 29:
1773#line 445 "itbl-parse.y"
1774    {
1775	    DBGL2 (("val=x%x\n",(yyvsp[(1) - (1)].num)));
1776	    (yyval.val) = (yyvsp[(1) - (1)].num);
1777	  }
1778    break;
1779
1780
1781/* Line 1267 of yacc.c.  */
1782#line 1783 "itbl-parse.c"
1783      default: break;
1784    }
1785  YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
1786
1787  YYPOPSTACK (yylen);
1788  yylen = 0;
1789  YY_STACK_PRINT (yyss, yyssp);
1790
1791  *++yyvsp = yyval;
1792
1793
1794  /* Now `shift' the result of the reduction.  Determine what state
1795     that goes to, based on the state we popped back to and the rule
1796     number reduced by.  */
1797
1798  yyn = yyr1[yyn];
1799
1800  yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1801  if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1802    yystate = yytable[yystate];
1803  else
1804    yystate = yydefgoto[yyn - YYNTOKENS];
1805
1806  goto yynewstate;
1807
1808
1809/*------------------------------------.
1810| yyerrlab -- here on detecting error |
1811`------------------------------------*/
1812yyerrlab:
1813  /* If not already recovering from an error, report this error.  */
1814  if (!yyerrstatus)
1815    {
1816      ++yynerrs;
1817#if ! YYERROR_VERBOSE
1818      yyerror (YY_("syntax error"));
1819#else
1820      {
1821	YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
1822	if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
1823	  {
1824	    YYSIZE_T yyalloc = 2 * yysize;
1825	    if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
1826	      yyalloc = YYSTACK_ALLOC_MAXIMUM;
1827	    if (yymsg != yymsgbuf)
1828	      YYSTACK_FREE (yymsg);
1829	    yymsg = (char *) YYSTACK_ALLOC (yyalloc);
1830	    if (yymsg)
1831	      yymsg_alloc = yyalloc;
1832	    else
1833	      {
1834		yymsg = yymsgbuf;
1835		yymsg_alloc = sizeof yymsgbuf;
1836	      }
1837	  }
1838
1839	if (0 < yysize && yysize <= yymsg_alloc)
1840	  {
1841	    (void) yysyntax_error (yymsg, yystate, yychar);
1842	    yyerror (yymsg);
1843	  }
1844	else
1845	  {
1846	    yyerror (YY_("syntax error"));
1847	    if (yysize != 0)
1848	      goto yyexhaustedlab;
1849	  }
1850      }
1851#endif
1852    }
1853
1854
1855
1856  if (yyerrstatus == 3)
1857    {
1858      /* If just tried and failed to reuse look-ahead token after an
1859	 error, discard it.  */
1860
1861      if (yychar <= YYEOF)
1862	{
1863	  /* Return failure if at end of input.  */
1864	  if (yychar == YYEOF)
1865	    YYABORT;
1866	}
1867      else
1868	{
1869	  yydestruct ("Error: discarding",
1870		      yytoken, &yylval);
1871	  yychar = YYEMPTY;
1872	}
1873    }
1874
1875  /* Else will try to reuse look-ahead token after shifting the error
1876     token.  */
1877  goto yyerrlab1;
1878
1879
1880/*---------------------------------------------------.
1881| yyerrorlab -- error raised explicitly by YYERROR.  |
1882`---------------------------------------------------*/
1883yyerrorlab:
1884
1885  /* Pacify compilers like GCC when the user code never invokes
1886     YYERROR and the label yyerrorlab therefore never appears in user
1887     code.  */
1888  if (/*CONSTCOND*/ 0)
1889     goto yyerrorlab;
1890
1891  /* Do not reclaim the symbols of the rule which action triggered
1892     this YYERROR.  */
1893  YYPOPSTACK (yylen);
1894  yylen = 0;
1895  YY_STACK_PRINT (yyss, yyssp);
1896  yystate = *yyssp;
1897  goto yyerrlab1;
1898
1899
1900/*-------------------------------------------------------------.
1901| yyerrlab1 -- common code for both syntax error and YYERROR.  |
1902`-------------------------------------------------------------*/
1903yyerrlab1:
1904  yyerrstatus = 3;	/* Each real token shifted decrements this.  */
1905
1906  for (;;)
1907    {
1908      yyn = yypact[yystate];
1909      if (yyn != YYPACT_NINF)
1910	{
1911	  yyn += YYTERROR;
1912	  if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1913	    {
1914	      yyn = yytable[yyn];
1915	      if (0 < yyn)
1916		break;
1917	    }
1918	}
1919
1920      /* Pop the current state because it cannot handle the error token.  */
1921      if (yyssp == yyss)
1922	YYABORT;
1923
1924
1925      yydestruct ("Error: popping",
1926		  yystos[yystate], yyvsp);
1927      YYPOPSTACK (1);
1928      yystate = *yyssp;
1929      YY_STACK_PRINT (yyss, yyssp);
1930    }
1931
1932  if (yyn == YYFINAL)
1933    YYACCEPT;
1934
1935  *++yyvsp = yylval;
1936
1937
1938  /* Shift the error token.  */
1939  YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
1940
1941  yystate = yyn;
1942  goto yynewstate;
1943
1944
1945/*-------------------------------------.
1946| yyacceptlab -- YYACCEPT comes here.  |
1947`-------------------------------------*/
1948yyacceptlab:
1949  yyresult = 0;
1950  goto yyreturn;
1951
1952/*-----------------------------------.
1953| yyabortlab -- YYABORT comes here.  |
1954`-----------------------------------*/
1955yyabortlab:
1956  yyresult = 1;
1957  goto yyreturn;
1958
1959#ifndef yyoverflow
1960/*-------------------------------------------------.
1961| yyexhaustedlab -- memory exhaustion comes here.  |
1962`-------------------------------------------------*/
1963yyexhaustedlab:
1964  yyerror (YY_("memory exhausted"));
1965  yyresult = 2;
1966  /* Fall through.  */
1967#endif
1968
1969yyreturn:
1970  if (yychar != YYEOF && yychar != YYEMPTY)
1971     yydestruct ("Cleanup: discarding lookahead",
1972		 yytoken, &yylval);
1973  /* Do not reclaim the symbols of the rule which action triggered
1974     this YYABORT or YYACCEPT.  */
1975  YYPOPSTACK (yylen);
1976  YY_STACK_PRINT (yyss, yyssp);
1977  while (yyssp != yyss)
1978    {
1979      yydestruct ("Cleanup: popping",
1980		  yystos[*yyssp], yyvsp);
1981      YYPOPSTACK (1);
1982    }
1983#ifndef yyoverflow
1984  if (yyss != yyssa)
1985    YYSTACK_FREE (yyss);
1986#endif
1987#if YYERROR_VERBOSE
1988  if (yymsg != yymsgbuf)
1989    YYSTACK_FREE (yymsg);
1990#endif
1991  /* Make sure YYID is used.  */
1992  return YYID (yyresult);
1993}
1994
1995
1996#line 450 "itbl-parse.y"
1997
1998
1999static int
2000yyerror (msg)
2001     const char *msg;
2002{
2003  printf ("line %d: %s\n", insntbl_line, msg);
2004  return 0;
2005}
2006
2007