1 |
|
---|
2 | /* A Bison parser, made from itbl-parse.y
|
---|
3 | by GNU Bison version 1.28 */
|
---|
4 |
|
---|
5 | #define YYBISON 1 /* Identify Bison output. */
|
---|
6 |
|
---|
7 | #define DREG 257
|
---|
8 | #define CREG 258
|
---|
9 | #define GREG 259
|
---|
10 | #define IMMED 260
|
---|
11 | #define ADDR 261
|
---|
12 | #define INSN 262
|
---|
13 | #define NUM 263
|
---|
14 | #define ID 264
|
---|
15 | #define NL 265
|
---|
16 | #define PNUM 266
|
---|
17 |
|
---|
18 | #line 21 "itbl-parse.y"
|
---|
19 |
|
---|
20 |
|
---|
21 | /*
|
---|
22 |
|
---|
23 | Yacc grammar for instruction table entries.
|
---|
24 |
|
---|
25 | =======================================================================
|
---|
26 | Original Instruction table specification document:
|
---|
27 |
|
---|
28 | MIPS Coprocessor Table Specification
|
---|
29 | ====================================
|
---|
30 |
|
---|
31 | This document describes the format of the MIPS coprocessor table. The
|
---|
32 | table specifies a list of valid functions, data registers and control
|
---|
33 | registers that can be used in coprocessor instructions. This list,
|
---|
34 | together with the coprocessor instruction classes listed below,
|
---|
35 | specifies the complete list of coprocessor instructions that will
|
---|
36 | be recognized and assembled by the GNU assembler. In effect,
|
---|
37 | this makes the GNU assembler table-driven, where the table is
|
---|
38 | specified by the programmer.
|
---|
39 |
|
---|
40 | The table is an ordinary text file that the GNU assembler reads when
|
---|
41 | it starts. Using the information in the table, the assembler
|
---|
42 | generates an internal list of valid coprocessor registers and
|
---|
43 | functions. The assembler uses this internal list in addition to the
|
---|
44 | standard MIPS registers and instructions which are built-in to the
|
---|
45 | assembler during code generation.
|
---|
46 |
|
---|
47 | To specify the coprocessor table when invoking the GNU assembler, use
|
---|
48 | the command line option "--itbl file", where file is the
|
---|
49 | complete name of the table, including path and extension.
|
---|
50 |
|
---|
51 | Examples:
|
---|
52 |
|
---|
53 | gas -t cop.tbl test.s -o test.o
|
---|
54 | gas -t /usr/local/lib/cop.tbl test.s -o test.o
|
---|
55 | gas --itbl d:\gnu\data\cop.tbl test.s -o test.o
|
---|
56 |
|
---|
57 | Only one table may be supplied during a single invocation of
|
---|
58 | the assembler.
|
---|
59 |
|
---|
60 |
|
---|
61 | Instruction classes
|
---|
62 | ===================
|
---|
63 |
|
---|
64 | Below is a list of the valid coprocessor instruction classes for
|
---|
65 | any given coprocessor "z". These instructions are already recognized
|
---|
66 | by the assembler, and are listed here only for reference.
|
---|
67 |
|
---|
68 | Class format instructions
|
---|
69 | -------------------------------------------------
|
---|
70 | Class1:
|
---|
71 | op base rt offset
|
---|
72 | LWCz rt,offset (base)
|
---|
73 | SWCz rt,offset (base)
|
---|
74 | Class2:
|
---|
75 | COPz sub rt rd 0
|
---|
76 | MTCz rt,rd
|
---|
77 | MFCz rt,rd
|
---|
78 | CTCz rt,rd
|
---|
79 | CFCz rt,rd
|
---|
80 | Class3:
|
---|
81 | COPz CO cofun
|
---|
82 | COPz cofun
|
---|
83 | Class4:
|
---|
84 | COPz BC br offset
|
---|
85 | BCzT offset
|
---|
86 | BCzF offset
|
---|
87 | Class5:
|
---|
88 | COPz sub rt rd 0
|
---|
89 | DMFCz rt,rd
|
---|
90 | DMTCz rt,rd
|
---|
91 | Class6:
|
---|
92 | op base rt offset
|
---|
93 | LDCz rt,offset (base)
|
---|
94 | SDCz rt,offset (base)
|
---|
95 | Class7:
|
---|
96 | COPz BC br offset
|
---|
97 | BCzTL offset
|
---|
98 | BCzFL offset
|
---|
99 |
|
---|
100 | The coprocessor table defines coprocessor-specific registers that can
|
---|
101 | be used with all of the above classes of instructions, where
|
---|
102 | appropriate. It also defines additional coprocessor-specific
|
---|
103 | functions for Class3 (COPz cofun) instructions, Thus, the table allows
|
---|
104 | the programmer to use convenient mnemonics and operands for these
|
---|
105 | functions, instead of the COPz mmenmonic and cofun operand.
|
---|
106 |
|
---|
107 | The names of the MIPS general registers and their aliases are defined
|
---|
108 | by the assembler and will be recognized as valid register names by the
|
---|
109 | assembler when used (where allowed) in coprocessor instructions.
|
---|
110 | However, the names and values of all coprocessor data and control
|
---|
111 | register mnemonics must be specified in the coprocessor table.
|
---|
112 |
|
---|
113 |
|
---|
114 | Table Grammar
|
---|
115 | =============
|
---|
116 |
|
---|
117 | Here is the grammar for the coprocessor table:
|
---|
118 |
|
---|
119 | table -> entry*
|
---|
120 |
|
---|
121 | entry -> [z entrydef] [comment] '\n'
|
---|
122 |
|
---|
123 | entrydef -> type name val
|
---|
124 | entrydef -> 'insn' name val funcdef ; type of entry (instruction)
|
---|
125 |
|
---|
126 | z -> 'p'['0'..'3'] ; processor number
|
---|
127 | type -> ['dreg' | 'creg' | 'greg' ] ; type of entry (register)
|
---|
128 | ; 'dreg', 'creg' or 'greg' specifies a data, control, or general
|
---|
129 | ; register mnemonic, respectively
|
---|
130 | name -> [ltr|dec]* ; mnemonic of register/function
|
---|
131 | val -> [dec|hex] ; register/function number (integer constant)
|
---|
132 |
|
---|
133 | funcdef -> frange flags fields
|
---|
134 | ; bitfield range for opcode
|
---|
135 | ; list of fields' formats
|
---|
136 | fields -> field*
|
---|
137 | field -> [','] ftype frange flags
|
---|
138 | flags -> ['*' flagexpr]
|
---|
139 | flagexpr -> '[' flagexpr ']'
|
---|
140 | flagexpr -> val '|' flagexpr
|
---|
141 | ftype -> [ type | 'immed' | 'addr' ]
|
---|
142 | ; 'immed' specifies an immediate value; see grammar for "val" above
|
---|
143 | ; 'addr' specifies a C identifier; name of symbol to be resolved at
|
---|
144 | ; link time
|
---|
145 | frange -> ':' val '-' val ; starting to ending bit positions, where
|
---|
146 | ; where 0 is least significant bit
|
---|
147 | frange -> (null) ; default range of 31-0 will be assumed
|
---|
148 |
|
---|
149 | comment -> [';'|'#'] [char]*
|
---|
150 | char -> any printable character
|
---|
151 | ltr -> ['a'..'z'|'A'..'Z']
|
---|
152 | dec -> ['0'..'9']* ; value in decimal
|
---|
153 | hex -> '0x'['0'..'9' | 'a'..'f' | 'A'..'F']* ; value in hexidecimal
|
---|
154 |
|
---|
155 |
|
---|
156 | Examples
|
---|
157 | ========
|
---|
158 |
|
---|
159 | Example 1:
|
---|
160 |
|
---|
161 | The table:
|
---|
162 |
|
---|
163 | p1 dreg d1 1 ; data register "d1" for COP1 has value 1
|
---|
164 | p1 creg c3 3 ; ctrl register "c3" for COP1 has value 3
|
---|
165 | p3 func fill 0x1f:24-20 ; function "fill" for COP3 has value 31 and
|
---|
166 | ; no fields
|
---|
167 |
|
---|
168 | will allow the assembler to accept the following coprocessor instructions:
|
---|
169 |
|
---|
170 | LWC1 d1,0x100 ($2)
|
---|
171 | fill
|
---|
172 |
|
---|
173 | Here, the general purpose register "$2", and instruction "LWC1", are standard
|
---|
174 | mnemonics built-in to the MIPS assembler.
|
---|
175 |
|
---|
176 |
|
---|
177 | Example 2:
|
---|
178 |
|
---|
179 | The table:
|
---|
180 |
|
---|
181 | p3 dreg d3 3 ; data register "d3" for COP3 has value 3
|
---|
182 | p3 creg c2 22 ; control register "c2" for COP3 has value 22
|
---|
183 | p3 func fee 0x1f:24-20 dreg:17-13 creg:12-8 immed:7-0
|
---|
184 | ; function "fee" for COP3 has value 31, and 3 fields
|
---|
185 | ; consisting of a data register, a control register,
|
---|
186 | ; and an immediate value.
|
---|
187 |
|
---|
188 | will allow the assembler to accept the following coprocessor instruction:
|
---|
189 |
|
---|
190 | fee d3,c2,0x1
|
---|
191 |
|
---|
192 | and will emit the object code:
|
---|
193 |
|
---|
194 | 31-26 25 24-20 19-18 17-13 12-8 7-0
|
---|
195 | COPz CO fun dreg creg immed
|
---|
196 | 010011 1 11111 00 00011 10110 00000001
|
---|
197 |
|
---|
198 | 0x4ff07601
|
---|
199 |
|
---|
200 |
|
---|
201 | Example 3:
|
---|
202 |
|
---|
203 | The table:
|
---|
204 |
|
---|
205 | p3 dreg d3 3 ; data register "d3" for COP3 has value 3
|
---|
206 | p3 creg c2 22 ; control register "c2" for COP3 has value 22
|
---|
207 | p3 func fuu 0x01f00001 dreg:17-13 creg:12-8
|
---|
208 |
|
---|
209 | will allow the assembler to accept the following coprocessor
|
---|
210 | instruction:
|
---|
211 |
|
---|
212 | fuu d3,c2
|
---|
213 |
|
---|
214 | and will emit the object code:
|
---|
215 |
|
---|
216 | 31-26 25 24-20 19-18 17-13 12-8 7-0
|
---|
217 | COPz CO fun dreg creg
|
---|
218 | 010011 1 11111 00 00011 10110 00000001
|
---|
219 |
|
---|
220 | 0x4ff07601
|
---|
221 |
|
---|
222 | In this way, the programmer can force arbitrary bits of an instruction
|
---|
223 | to have predefined values.
|
---|
224 |
|
---|
225 | =======================================================================
|
---|
226 | Additional notes:
|
---|
227 |
|
---|
228 | Encoding of ranges:
|
---|
229 | To handle more than one bit position range within an instruction,
|
---|
230 | use 0s to mask out the ranges which don't apply.
|
---|
231 | May decide to modify the syntax to allow commas separate multiple
|
---|
232 | ranges within an instruction (range','range).
|
---|
233 |
|
---|
234 | Changes in grammar:
|
---|
235 | The number of parms argument to the function entry
|
---|
236 | was deleted from the original format such that we now count the fields.
|
---|
237 |
|
---|
238 | ----
|
---|
239 | FIXME! should really change lexical analyzer
|
---|
240 | to recognize 'dreg' etc. in context sensative way.
|
---|
241 | Currently function names or mnemonics may be incorrectly parsed as keywords
|
---|
242 |
|
---|
243 | FIXME! hex is ambiguous with any digit
|
---|
244 |
|
---|
245 | */
|
---|
246 |
|
---|
247 | #include <stdio.h>
|
---|
248 | #include "itbl-ops.h"
|
---|
249 |
|
---|
250 | /* #define DEBUG */
|
---|
251 |
|
---|
252 | #ifdef DEBUG
|
---|
253 | #ifndef DBG_LVL
|
---|
254 | #define DBG_LVL 1
|
---|
255 | #endif
|
---|
256 | #else
|
---|
257 | #define DBG_LVL 0
|
---|
258 | #endif
|
---|
259 |
|
---|
260 | #if DBG_LVL >= 1
|
---|
261 | #define DBG(x) printf x
|
---|
262 | #else
|
---|
263 | #define DBG(x)
|
---|
264 | #endif
|
---|
265 |
|
---|
266 | #if DBG_LVL >= 2
|
---|
267 | #define DBGL2(x) printf x
|
---|
268 | #else
|
---|
269 | #define DBGL2(x)
|
---|
270 | #endif
|
---|
271 |
|
---|
272 | static int sbit, ebit;
|
---|
273 | static struct itbl_entry *insn=0;
|
---|
274 | extern int insntbl_line;
|
---|
275 | int yyparse PARAMS ((void));
|
---|
276 | int yylex PARAMS ((void));
|
---|
277 | static int yyerror PARAMS ((const char *));
|
---|
278 |
|
---|
279 |
|
---|
280 | #line 283 "itbl-parse.y"
|
---|
281 | typedef union
|
---|
282 | {
|
---|
283 | char *str;
|
---|
284 | int num;
|
---|
285 | int processor;
|
---|
286 | unsigned long val;
|
---|
287 | } YYSTYPE;
|
---|
288 | #include <stdio.h>
|
---|
289 |
|
---|
290 | #ifndef __cplusplus
|
---|
291 | #ifndef __STDC__
|
---|
292 | #define const
|
---|
293 | #endif
|
---|
294 | #endif
|
---|
295 |
|
---|
296 |
|
---|
297 |
|
---|
298 | #define YYFINAL 51
|
---|
299 | #define YYFLAG -32768
|
---|
300 | #define YYNTBASE 20
|
---|
301 |
|
---|
302 | #define YYTRANSLATE(x) ((unsigned)(x) <= 266 ? yytranslate[x] : 34)
|
---|
303 |
|
---|
304 | static const char yytranslate[] = { 0,
|
---|
305 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
---|
306 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
---|
307 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
---|
308 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
---|
309 | 2, 17, 2, 13, 19, 2, 2, 2, 2, 2,
|
---|
310 | 2, 2, 2, 2, 2, 2, 2, 18, 2, 2,
|
---|
311 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
---|
312 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
---|
313 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
---|
314 | 15, 2, 16, 2, 2, 2, 2, 2, 2, 2,
|
---|
315 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
---|
316 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
---|
317 | 2, 2, 2, 14, 2, 2, 2, 2, 2, 2,
|
---|
318 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
---|
319 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
---|
320 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
---|
321 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
---|
322 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
---|
323 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
---|
324 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
---|
325 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
---|
326 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
---|
327 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
---|
328 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
---|
329 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
---|
330 | 2, 2, 2, 2, 2, 1, 3, 4, 5, 6,
|
---|
331 | 7, 8, 9, 10, 11, 12
|
---|
332 | };
|
---|
333 |
|
---|
334 | #if YYDEBUG != 0
|
---|
335 | static const short yyprhs[] = { 0,
|
---|
336 | 0, 2, 5, 6, 12, 13, 23, 25, 28, 32,
|
---|
337 | 35, 36, 38, 40, 42, 46, 50, 54, 56, 59,
|
---|
338 | 60, 65, 66, 68, 70, 72, 74, 76, 78
|
---|
339 | };
|
---|
340 |
|
---|
341 | static const short yyrhs[] = { 21,
|
---|
342 | 0, 22, 21, 0, 0, 30, 31, 32, 33, 11,
|
---|
343 | 0, 0, 30, 8, 32, 33, 29, 28, 23, 24,
|
---|
344 | 11, 0, 11, 0, 1, 11, 0, 13, 26, 24,
|
---|
345 | 0, 26, 24, 0, 0, 31, 0, 7, 0, 6,
|
---|
346 | 0, 25, 29, 28, 0, 9, 14, 27, 0, 15,
|
---|
347 | 27, 16, 0, 9, 0, 17, 27, 0, 0, 18,
|
---|
348 | 9, 19, 9, 0, 0, 12, 0, 3, 0, 4,
|
---|
349 | 0, 5, 0, 10, 0, 9, 0, 9, 0
|
---|
350 | };
|
---|
351 |
|
---|
352 | #endif
|
---|
353 |
|
---|
354 | #if YYDEBUG != 0
|
---|
355 | static const short yyrline[] = { 0,
|
---|
356 | 300, 304, 306, 309, 316, 323, 324, 325, 328, 330,
|
---|
357 | 331, 334, 340, 345, 352, 361, 366, 370, 376, 382,
|
---|
358 | 388, 395, 402, 410, 416, 421, 428, 436, 444
|
---|
359 | };
|
---|
360 | #endif
|
---|
361 |
|
---|
362 |
|
---|
363 | #if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
|
---|
364 |
|
---|
365 | static const char * const yytname[] = { "$","error","$undefined.","DREG","CREG",
|
---|
366 | "GREG","IMMED","ADDR","INSN","NUM","ID","NL","PNUM","','","'|'","'['","']'",
|
---|
367 | "'*'","':'","'-'","insntbl","entrys","entry","@1","fieldspecs","ftype","fieldspec",
|
---|
368 | "flagexpr","flags","range","pnum","regtype","name","value", NULL
|
---|
369 | };
|
---|
370 | #endif
|
---|
371 |
|
---|
372 | static const short yyr1[] = { 0,
|
---|
373 | 20, 21, 21, 22, 23, 22, 22, 22, 24, 24,
|
---|
374 | 24, 25, 25, 25, 26, 27, 27, 27, 28, 28,
|
---|
375 | 29, 29, 30, 31, 31, 31, 32, -1, 33
|
---|
376 | };
|
---|
377 |
|
---|
378 | static const short yyr2[] = { 0,
|
---|
379 | 1, 2, 0, 5, 0, 9, 1, 2, 3, 2,
|
---|
380 | 0, 1, 1, 1, 3, 3, 3, 1, 2, 0,
|
---|
381 | 4, 0, 1, 1, 1, 1, 1, 1, 1
|
---|
382 | };
|
---|
383 |
|
---|
384 | static const short yydefact[] = { 0,
|
---|
385 | 0, 7, 23, 1, 0, 0, 8, 2, 24, 25,
|
---|
386 | 26, 0, 0, 27, 0, 0, 29, 22, 0, 0,
|
---|
387 | 20, 4, 0, 0, 5, 0, 18, 0, 19, 11,
|
---|
388 | 21, 0, 0, 14, 13, 0, 0, 22, 11, 12,
|
---|
389 | 16, 17, 11, 6, 20, 10, 9, 15, 0, 0,
|
---|
390 | 0
|
---|
391 | };
|
---|
392 |
|
---|
393 | static const short yydefgoto[] = { 49,
|
---|
394 | 4, 5, 30, 37, 38, 39, 29, 25, 21, 6,
|
---|
395 | 40, 15, 18
|
---|
396 | };
|
---|
397 |
|
---|
398 | static const short yypact[] = { 0,
|
---|
399 | -9,-32768,-32768,-32768, 0, 12,-32768,-32768,-32768,-32768,
|
---|
400 | -32768, 3, 3,-32768, 9, 9,-32768, -8, 8, 19,
|
---|
401 | 15,-32768, 10, -6,-32768, 24, 20, -6,-32768, 1,
|
---|
402 | -32768, -6, 21,-32768,-32768, 18, 25, -8, 1,-32768,
|
---|
403 | -32768,-32768, 1,-32768, 15,-32768,-32768,-32768, 35, 38,
|
---|
404 | -32768
|
---|
405 | };
|
---|
406 |
|
---|
407 | static const short yypgoto[] = {-32768,
|
---|
408 | 34,-32768,-32768, -13,-32768, 4, -1, -4, 5,-32768,
|
---|
409 | 36, 31, 29
|
---|
410 | };
|
---|
411 |
|
---|
412 |
|
---|
413 | #define YYLAST 45
|
---|
414 |
|
---|
415 |
|
---|
416 | static const short yytable[] = { -3,
|
---|
417 | 1, 7, 27, 9, 10, 11, 34, 35, 28, 20,
|
---|
418 | 2, 3, 14, 36, 9, 10, 11, 17, 22, 12,
|
---|
419 | 9, 10, 11, 34, 35, 46, 33, 23, 26, 47,
|
---|
420 | 41, 24, 31, 32, 50, 44, 42, 51, 8, 43,
|
---|
421 | 48, 13, 45, 16, 19
|
---|
422 | };
|
---|
423 |
|
---|
424 | static const short yycheck[] = { 0,
|
---|
425 | 1, 11, 9, 3, 4, 5, 6, 7, 15, 18,
|
---|
426 | 11, 12, 10, 13, 3, 4, 5, 9, 11, 8,
|
---|
427 | 3, 4, 5, 6, 7, 39, 28, 9, 19, 43,
|
---|
428 | 32, 17, 9, 14, 0, 11, 16, 0, 5, 36,
|
---|
429 | 45, 6, 38, 13, 16
|
---|
430 | };
|
---|
431 | /* -*-C-*- Note some compilers choke on comments on `#line' lines. */
|
---|
432 | #line 3 "/usr/share/bison/bison.simple"
|
---|
433 | /* This file comes from bison-1.28. */
|
---|
434 |
|
---|
435 | /* Skeleton output parser for bison,
|
---|
436 | Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
|
---|
437 |
|
---|
438 | This program is free software; you can redistribute it and/or modify
|
---|
439 | it under the terms of the GNU General Public License as published by
|
---|
440 | the Free Software Foundation; either version 2, or (at your option)
|
---|
441 | any later version.
|
---|
442 |
|
---|
443 | This program is distributed in the hope that it will be useful,
|
---|
444 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
445 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
446 | GNU General Public License for more details.
|
---|
447 |
|
---|
448 | You should have received a copy of the GNU General Public License
|
---|
449 | along with this program; if not, write to the Free Software
|
---|
450 | Foundation, Inc., 59 Temple Place - Suite 330,
|
---|
451 | Boston, MA 02111-1307, USA. */
|
---|
452 |
|
---|
453 | /* As a special exception, when this file is copied by Bison into a
|
---|
454 | Bison output file, you may use that output file without restriction.
|
---|
455 | This special exception was added by the Free Software Foundation
|
---|
456 | in version 1.24 of Bison. */
|
---|
457 |
|
---|
458 | /* This is the parser code that is written into each bison parser
|
---|
459 | when the %semantic_parser declaration is not specified in the grammar.
|
---|
460 | It was written by Richard Stallman by simplifying the hairy parser
|
---|
461 | used when %semantic_parser is specified. */
|
---|
462 |
|
---|
463 | #ifndef YYSTACK_USE_ALLOCA
|
---|
464 | #ifdef alloca
|
---|
465 | #define YYSTACK_USE_ALLOCA
|
---|
466 | #else /* alloca not defined */
|
---|
467 | #ifdef __GNUC__
|
---|
468 | #define YYSTACK_USE_ALLOCA
|
---|
469 | #define alloca __builtin_alloca
|
---|
470 | #else /* not GNU C. */
|
---|
471 | #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
|
---|
472 | #define YYSTACK_USE_ALLOCA
|
---|
473 | #include <alloca.h>
|
---|
474 | #else /* not sparc */
|
---|
475 | /* We think this test detects Watcom and Microsoft C. */
|
---|
476 | /* This used to test MSDOS, but that is a bad idea
|
---|
477 | since that symbol is in the user namespace. */
|
---|
478 | #if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
|
---|
479 | #if 0 /* No need for malloc.h, which pollutes the namespace;
|
---|
480 | instead, just don't use alloca. */
|
---|
481 | #include <malloc.h>
|
---|
482 | #endif
|
---|
483 | #else /* not MSDOS, or __TURBOC__ */
|
---|
484 | #if defined(_AIX)
|
---|
485 | /* I don't know what this was needed for, but it pollutes the namespace.
|
---|
486 | So I turned it off. rms, 2 May 1997. */
|
---|
487 | /* #include <malloc.h> */
|
---|
488 | #pragma alloca
|
---|
489 | #define YYSTACK_USE_ALLOCA
|
---|
490 | #else /* not MSDOS, or __TURBOC__, or _AIX */
|
---|
491 | #if 0
|
---|
492 | #ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up,
|
---|
493 | and on HPUX 10. Eventually we can turn this on. */
|
---|
494 | #define YYSTACK_USE_ALLOCA
|
---|
495 | #define alloca __builtin_alloca
|
---|
496 | #endif /* __hpux */
|
---|
497 | #endif
|
---|
498 | #endif /* not _AIX */
|
---|
499 | #endif /* not MSDOS, or __TURBOC__ */
|
---|
500 | #endif /* not sparc */
|
---|
501 | #endif /* not GNU C */
|
---|
502 | #endif /* alloca not defined */
|
---|
503 | #endif /* YYSTACK_USE_ALLOCA not defined */
|
---|
504 |
|
---|
505 | #ifdef YYSTACK_USE_ALLOCA
|
---|
506 | #define YYSTACK_ALLOC alloca
|
---|
507 | #else
|
---|
508 | #define YYSTACK_ALLOC malloc
|
---|
509 | #endif
|
---|
510 |
|
---|
511 | /* Note: there must be only one dollar sign in this file.
|
---|
512 | It is replaced by the list of actions, each action
|
---|
513 | as one case of the switch. */
|
---|
514 |
|
---|
515 | #define yyerrok (yyerrstatus = 0)
|
---|
516 | #define yyclearin (yychar = YYEMPTY)
|
---|
517 | #define YYEMPTY -2
|
---|
518 | #define YYEOF 0
|
---|
519 | #define YYACCEPT goto yyacceptlab
|
---|
520 | #define YYABORT goto yyabortlab
|
---|
521 | #define YYERROR goto yyerrlab1
|
---|
522 | /* Like YYERROR except do call yyerror.
|
---|
523 | This remains here temporarily to ease the
|
---|
524 | transition to the new meaning of YYERROR, for GCC.
|
---|
525 | Once GCC version 2 has supplanted version 1, this can go. */
|
---|
526 | #define YYFAIL goto yyerrlab
|
---|
527 | #define YYRECOVERING() (!!yyerrstatus)
|
---|
528 | #define YYBACKUP(token, value) \
|
---|
529 | do \
|
---|
530 | if (yychar == YYEMPTY && yylen == 1) \
|
---|
531 | { yychar = (token), yylval = (value); \
|
---|
532 | yychar1 = YYTRANSLATE (yychar); \
|
---|
533 | YYPOPSTACK; \
|
---|
534 | goto yybackup; \
|
---|
535 | } \
|
---|
536 | else \
|
---|
537 | { yyerror ("syntax error: cannot back up"); YYERROR; } \
|
---|
538 | while (0)
|
---|
539 |
|
---|
540 | #define YYTERROR 1
|
---|
541 | #define YYERRCODE 256
|
---|
542 |
|
---|
543 | #ifndef YYPURE
|
---|
544 | #define YYLEX yylex()
|
---|
545 | #endif
|
---|
546 |
|
---|
547 | #ifdef YYPURE
|
---|
548 | #ifdef YYLSP_NEEDED
|
---|
549 | #ifdef YYLEX_PARAM
|
---|
550 | #define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
|
---|
551 | #else
|
---|
552 | #define YYLEX yylex(&yylval, &yylloc)
|
---|
553 | #endif
|
---|
554 | #else /* not YYLSP_NEEDED */
|
---|
555 | #ifdef YYLEX_PARAM
|
---|
556 | #define YYLEX yylex(&yylval, YYLEX_PARAM)
|
---|
557 | #else
|
---|
558 | #define YYLEX yylex(&yylval)
|
---|
559 | #endif
|
---|
560 | #endif /* not YYLSP_NEEDED */
|
---|
561 | #endif
|
---|
562 |
|
---|
563 | /* If nonreentrant, generate the variables here */
|
---|
564 |
|
---|
565 | #ifndef YYPURE
|
---|
566 |
|
---|
567 | int yychar; /* the lookahead symbol */
|
---|
568 | YYSTYPE yylval; /* the semantic value of the */
|
---|
569 | /* lookahead symbol */
|
---|
570 |
|
---|
571 | #ifdef YYLSP_NEEDED
|
---|
572 | YYLTYPE yylloc; /* location data for the lookahead */
|
---|
573 | /* symbol */
|
---|
574 | #endif
|
---|
575 |
|
---|
576 | int yynerrs; /* number of parse errors so far */
|
---|
577 | #endif /* not YYPURE */
|
---|
578 |
|
---|
579 | #if YYDEBUG != 0
|
---|
580 | int yydebug; /* nonzero means print parse trace */
|
---|
581 | /* Since this is uninitialized, it does not stop multiple parsers
|
---|
582 | from coexisting. */
|
---|
583 | #endif
|
---|
584 |
|
---|
585 | /* YYINITDEPTH indicates the initial size of the parser's stacks */
|
---|
586 |
|
---|
587 | #ifndef YYINITDEPTH
|
---|
588 | #define YYINITDEPTH 200
|
---|
589 | #endif
|
---|
590 |
|
---|
591 | /* YYMAXDEPTH is the maximum size the stacks can grow to
|
---|
592 | (effective only if the built-in stack extension method is used). */
|
---|
593 |
|
---|
594 | #if YYMAXDEPTH == 0
|
---|
595 | #undef YYMAXDEPTH
|
---|
596 | #endif
|
---|
597 |
|
---|
598 | #ifndef YYMAXDEPTH
|
---|
599 | #define YYMAXDEPTH 10000
|
---|
600 | #endif
|
---|
601 | |
---|
602 |
|
---|
603 | /* Define __yy_memcpy. Note that the size argument
|
---|
604 | should be passed with type unsigned int, because that is what the non-GCC
|
---|
605 | definitions require. With GCC, __builtin_memcpy takes an arg
|
---|
606 | of type size_t, but it can handle unsigned int. */
|
---|
607 |
|
---|
608 | #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
|
---|
609 | #define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT)
|
---|
610 | #else /* not GNU C or C++ */
|
---|
611 | #ifndef __cplusplus
|
---|
612 |
|
---|
613 | /* This is the most reliable way to avoid incompatibilities
|
---|
614 | in available built-in functions on various systems. */
|
---|
615 | static void
|
---|
616 | __yy_memcpy (to, from, count)
|
---|
617 | char *to;
|
---|
618 | char *from;
|
---|
619 | unsigned int count;
|
---|
620 | {
|
---|
621 | register char *f = from;
|
---|
622 | register char *t = to;
|
---|
623 | register int i = count;
|
---|
624 |
|
---|
625 | while (i-- > 0)
|
---|
626 | *t++ = *f++;
|
---|
627 | }
|
---|
628 |
|
---|
629 | #else /* __cplusplus */
|
---|
630 |
|
---|
631 | /* This is the most reliable way to avoid incompatibilities
|
---|
632 | in available built-in functions on various systems. */
|
---|
633 | static void
|
---|
634 | __yy_memcpy (char *to, char *from, unsigned int count)
|
---|
635 | {
|
---|
636 | register char *t = to;
|
---|
637 | register char *f = from;
|
---|
638 | register int i = count;
|
---|
639 |
|
---|
640 | while (i-- > 0)
|
---|
641 | *t++ = *f++;
|
---|
642 | }
|
---|
643 |
|
---|
644 | #endif
|
---|
645 | #endif
|
---|
646 | |
---|
647 |
|
---|
648 | #line 217 "/usr/share/bison/bison.simple"
|
---|
649 |
|
---|
650 | /* The user can define YYPARSE_PARAM as the name of an argument to be passed
|
---|
651 | into yyparse. The argument should have type void *.
|
---|
652 | It should actually point to an object.
|
---|
653 | Grammar actions can access the variable by casting it
|
---|
654 | to the proper pointer type. */
|
---|
655 |
|
---|
656 | #ifdef YYPARSE_PARAM
|
---|
657 | #ifdef __cplusplus
|
---|
658 | #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
|
---|
659 | #define YYPARSE_PARAM_DECL
|
---|
660 | #else /* not __cplusplus */
|
---|
661 | #define YYPARSE_PARAM_ARG YYPARSE_PARAM
|
---|
662 | #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
|
---|
663 | #endif /* not __cplusplus */
|
---|
664 | #else /* not YYPARSE_PARAM */
|
---|
665 | #define YYPARSE_PARAM_ARG
|
---|
666 | #define YYPARSE_PARAM_DECL
|
---|
667 | #endif /* not YYPARSE_PARAM */
|
---|
668 |
|
---|
669 | /* Prevent warning if -Wstrict-prototypes. */
|
---|
670 | #ifdef __GNUC__
|
---|
671 | #ifdef YYPARSE_PARAM
|
---|
672 | int yyparse (void *);
|
---|
673 | #else
|
---|
674 | int yyparse (void);
|
---|
675 | #endif
|
---|
676 | #endif
|
---|
677 |
|
---|
678 | int
|
---|
679 | yyparse(YYPARSE_PARAM_ARG)
|
---|
680 | YYPARSE_PARAM_DECL
|
---|
681 | {
|
---|
682 | register int yystate;
|
---|
683 | register int yyn;
|
---|
684 | register short *yyssp;
|
---|
685 | register YYSTYPE *yyvsp;
|
---|
686 | int yyerrstatus; /* number of tokens to shift before error messages enabled */
|
---|
687 | int yychar1 = 0; /* lookahead token as an internal (translated) token number */
|
---|
688 |
|
---|
689 | short yyssa[YYINITDEPTH]; /* the state stack */
|
---|
690 | YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */
|
---|
691 |
|
---|
692 | short *yyss = yyssa; /* refer to the stacks thru separate pointers */
|
---|
693 | YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */
|
---|
694 |
|
---|
695 | #ifdef YYLSP_NEEDED
|
---|
696 | YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */
|
---|
697 | YYLTYPE *yyls = yylsa;
|
---|
698 | YYLTYPE *yylsp;
|
---|
699 |
|
---|
700 | #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
|
---|
701 | #else
|
---|
702 | #define YYPOPSTACK (yyvsp--, yyssp--)
|
---|
703 | #endif
|
---|
704 |
|
---|
705 | int yystacksize = YYINITDEPTH;
|
---|
706 | int yyfree_stacks = 0;
|
---|
707 |
|
---|
708 | #ifdef YYPURE
|
---|
709 | int yychar;
|
---|
710 | YYSTYPE yylval;
|
---|
711 | int yynerrs;
|
---|
712 | #ifdef YYLSP_NEEDED
|
---|
713 | YYLTYPE yylloc;
|
---|
714 | #endif
|
---|
715 | #endif
|
---|
716 |
|
---|
717 | YYSTYPE yyval; /* the variable used to return */
|
---|
718 | /* semantic values from the action */
|
---|
719 | /* routines */
|
---|
720 |
|
---|
721 | int yylen;
|
---|
722 |
|
---|
723 | #if YYDEBUG != 0
|
---|
724 | if (yydebug)
|
---|
725 | fprintf(stderr, "Starting parse\n");
|
---|
726 | #endif
|
---|
727 |
|
---|
728 | yystate = 0;
|
---|
729 | yyerrstatus = 0;
|
---|
730 | yynerrs = 0;
|
---|
731 | yychar = YYEMPTY; /* Cause a token to be read. */
|
---|
732 |
|
---|
733 | /* Initialize stack pointers.
|
---|
734 | Waste one element of value and location stack
|
---|
735 | so that they stay on the same level as the state stack.
|
---|
736 | The wasted elements are never initialized. */
|
---|
737 |
|
---|
738 | yyssp = yyss - 1;
|
---|
739 | yyvsp = yyvs;
|
---|
740 | #ifdef YYLSP_NEEDED
|
---|
741 | yylsp = yyls;
|
---|
742 | #endif
|
---|
743 |
|
---|
744 | /* Push a new state, which is found in yystate . */
|
---|
745 | /* In all cases, when you get here, the value and location stacks
|
---|
746 | have just been pushed. so pushing a state here evens the stacks. */
|
---|
747 | yynewstate:
|
---|
748 |
|
---|
749 | *++yyssp = yystate;
|
---|
750 |
|
---|
751 | if (yyssp >= yyss + yystacksize - 1)
|
---|
752 | {
|
---|
753 | /* Give user a chance to reallocate the stack */
|
---|
754 | /* Use copies of these so that the &'s don't force the real ones into memory. */
|
---|
755 | YYSTYPE *yyvs1 = yyvs;
|
---|
756 | short *yyss1 = yyss;
|
---|
757 | #ifdef YYLSP_NEEDED
|
---|
758 | YYLTYPE *yyls1 = yyls;
|
---|
759 | #endif
|
---|
760 |
|
---|
761 | /* Get the current used size of the three stacks, in elements. */
|
---|
762 | int size = yyssp - yyss + 1;
|
---|
763 |
|
---|
764 | #ifdef yyoverflow
|
---|
765 | /* Each stack pointer address is followed by the size of
|
---|
766 | the data in use in that stack, in bytes. */
|
---|
767 | #ifdef YYLSP_NEEDED
|
---|
768 | /* This used to be a conditional around just the two extra args,
|
---|
769 | but that might be undefined if yyoverflow is a macro. */
|
---|
770 | yyoverflow("parser stack overflow",
|
---|
771 | &yyss1, size * sizeof (*yyssp),
|
---|
772 | &yyvs1, size * sizeof (*yyvsp),
|
---|
773 | &yyls1, size * sizeof (*yylsp),
|
---|
774 | &yystacksize);
|
---|
775 | #else
|
---|
776 | yyoverflow("parser stack overflow",
|
---|
777 | &yyss1, size * sizeof (*yyssp),
|
---|
778 | &yyvs1, size * sizeof (*yyvsp),
|
---|
779 | &yystacksize);
|
---|
780 | #endif
|
---|
781 |
|
---|
782 | yyss = yyss1; yyvs = yyvs1;
|
---|
783 | #ifdef YYLSP_NEEDED
|
---|
784 | yyls = yyls1;
|
---|
785 | #endif
|
---|
786 | #else /* no yyoverflow */
|
---|
787 | /* Extend the stack our own way. */
|
---|
788 | if (yystacksize >= YYMAXDEPTH)
|
---|
789 | {
|
---|
790 | yyerror("parser stack overflow");
|
---|
791 | if (yyfree_stacks)
|
---|
792 | {
|
---|
793 | free (yyss);
|
---|
794 | free (yyvs);
|
---|
795 | #ifdef YYLSP_NEEDED
|
---|
796 | free (yyls);
|
---|
797 | #endif
|
---|
798 | }
|
---|
799 | return 2;
|
---|
800 | }
|
---|
801 | yystacksize *= 2;
|
---|
802 | if (yystacksize > YYMAXDEPTH)
|
---|
803 | yystacksize = YYMAXDEPTH;
|
---|
804 | #ifndef YYSTACK_USE_ALLOCA
|
---|
805 | yyfree_stacks = 1;
|
---|
806 | #endif
|
---|
807 | yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp));
|
---|
808 | __yy_memcpy ((char *)yyss, (char *)yyss1,
|
---|
809 | size * (unsigned int) sizeof (*yyssp));
|
---|
810 | yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp));
|
---|
811 | __yy_memcpy ((char *)yyvs, (char *)yyvs1,
|
---|
812 | size * (unsigned int) sizeof (*yyvsp));
|
---|
813 | #ifdef YYLSP_NEEDED
|
---|
814 | yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp));
|
---|
815 | __yy_memcpy ((char *)yyls, (char *)yyls1,
|
---|
816 | size * (unsigned int) sizeof (*yylsp));
|
---|
817 | #endif
|
---|
818 | #endif /* no yyoverflow */
|
---|
819 |
|
---|
820 | yyssp = yyss + size - 1;
|
---|
821 | yyvsp = yyvs + size - 1;
|
---|
822 | #ifdef YYLSP_NEEDED
|
---|
823 | yylsp = yyls + size - 1;
|
---|
824 | #endif
|
---|
825 |
|
---|
826 | #if YYDEBUG != 0
|
---|
827 | if (yydebug)
|
---|
828 | fprintf(stderr, "Stack size increased to %d\n", yystacksize);
|
---|
829 | #endif
|
---|
830 |
|
---|
831 | if (yyssp >= yyss + yystacksize - 1)
|
---|
832 | YYABORT;
|
---|
833 | }
|
---|
834 |
|
---|
835 | #if YYDEBUG != 0
|
---|
836 | if (yydebug)
|
---|
837 | fprintf(stderr, "Entering state %d\n", yystate);
|
---|
838 | #endif
|
---|
839 |
|
---|
840 | goto yybackup;
|
---|
841 | yybackup:
|
---|
842 |
|
---|
843 | /* Do appropriate processing given the current state. */
|
---|
844 | /* Read a lookahead token if we need one and don't already have one. */
|
---|
845 | /* yyresume: */
|
---|
846 |
|
---|
847 | /* First try to decide what to do without reference to lookahead token. */
|
---|
848 |
|
---|
849 | yyn = yypact[yystate];
|
---|
850 | if (yyn == YYFLAG)
|
---|
851 | goto yydefault;
|
---|
852 |
|
---|
853 | /* Not known => get a lookahead token if don't already have one. */
|
---|
854 |
|
---|
855 | /* yychar is either YYEMPTY or YYEOF
|
---|
856 | or a valid token in external form. */
|
---|
857 |
|
---|
858 | if (yychar == YYEMPTY)
|
---|
859 | {
|
---|
860 | #if YYDEBUG != 0
|
---|
861 | if (yydebug)
|
---|
862 | fprintf(stderr, "Reading a token: ");
|
---|
863 | #endif
|
---|
864 | yychar = YYLEX;
|
---|
865 | }
|
---|
866 |
|
---|
867 | /* Convert token to internal form (in yychar1) for indexing tables with */
|
---|
868 |
|
---|
869 | if (yychar <= 0) /* This means end of input. */
|
---|
870 | {
|
---|
871 | yychar1 = 0;
|
---|
872 | yychar = YYEOF; /* Don't call YYLEX any more */
|
---|
873 |
|
---|
874 | #if YYDEBUG != 0
|
---|
875 | if (yydebug)
|
---|
876 | fprintf(stderr, "Now at end of input.\n");
|
---|
877 | #endif
|
---|
878 | }
|
---|
879 | else
|
---|
880 | {
|
---|
881 | yychar1 = YYTRANSLATE(yychar);
|
---|
882 |
|
---|
883 | #if YYDEBUG != 0
|
---|
884 | if (yydebug)
|
---|
885 | {
|
---|
886 | fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
|
---|
887 | /* Give the individual parser a way to print the precise meaning
|
---|
888 | of a token, for further debugging info. */
|
---|
889 | #ifdef YYPRINT
|
---|
890 | YYPRINT (stderr, yychar, yylval);
|
---|
891 | #endif
|
---|
892 | fprintf (stderr, ")\n");
|
---|
893 | }
|
---|
894 | #endif
|
---|
895 | }
|
---|
896 |
|
---|
897 | yyn += yychar1;
|
---|
898 | if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
|
---|
899 | goto yydefault;
|
---|
900 |
|
---|
901 | yyn = yytable[yyn];
|
---|
902 |
|
---|
903 | /* yyn is what to do for this token type in this state.
|
---|
904 | Negative => reduce, -yyn is rule number.
|
---|
905 | Positive => shift, yyn is new state.
|
---|
906 | New state is final state => don't bother to shift,
|
---|
907 | just return success.
|
---|
908 | 0, or most negative number => error. */
|
---|
909 |
|
---|
910 | if (yyn < 0)
|
---|
911 | {
|
---|
912 | if (yyn == YYFLAG)
|
---|
913 | goto yyerrlab;
|
---|
914 | yyn = -yyn;
|
---|
915 | goto yyreduce;
|
---|
916 | }
|
---|
917 | else if (yyn == 0)
|
---|
918 | goto yyerrlab;
|
---|
919 |
|
---|
920 | if (yyn == YYFINAL)
|
---|
921 | YYACCEPT;
|
---|
922 |
|
---|
923 | /* Shift the lookahead token. */
|
---|
924 |
|
---|
925 | #if YYDEBUG != 0
|
---|
926 | if (yydebug)
|
---|
927 | fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
|
---|
928 | #endif
|
---|
929 |
|
---|
930 | /* Discard the token being shifted unless it is eof. */
|
---|
931 | if (yychar != YYEOF)
|
---|
932 | yychar = YYEMPTY;
|
---|
933 |
|
---|
934 | *++yyvsp = yylval;
|
---|
935 | #ifdef YYLSP_NEEDED
|
---|
936 | *++yylsp = yylloc;
|
---|
937 | #endif
|
---|
938 |
|
---|
939 | /* count tokens shifted since error; after three, turn off error status. */
|
---|
940 | if (yyerrstatus) yyerrstatus--;
|
---|
941 |
|
---|
942 | yystate = yyn;
|
---|
943 | goto yynewstate;
|
---|
944 |
|
---|
945 | /* Do the default action for the current state. */
|
---|
946 | yydefault:
|
---|
947 |
|
---|
948 | yyn = yydefact[yystate];
|
---|
949 | if (yyn == 0)
|
---|
950 | goto yyerrlab;
|
---|
951 |
|
---|
952 | /* Do a reduction. yyn is the number of a rule to reduce with. */
|
---|
953 | yyreduce:
|
---|
954 | yylen = yyr2[yyn];
|
---|
955 | if (yylen > 0)
|
---|
956 | yyval = yyvsp[1-yylen]; /* implement default value of the action */
|
---|
957 |
|
---|
958 | #if YYDEBUG != 0
|
---|
959 | if (yydebug)
|
---|
960 | {
|
---|
961 | int i;
|
---|
962 |
|
---|
963 | fprintf (stderr, "Reducing via rule %d (line %d), ",
|
---|
964 | yyn, yyrline[yyn]);
|
---|
965 |
|
---|
966 | /* Print the symbols being reduced, and their result. */
|
---|
967 | for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
|
---|
968 | fprintf (stderr, "%s ", yytname[yyrhs[i]]);
|
---|
969 | fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
|
---|
970 | }
|
---|
971 | #endif
|
---|
972 |
|
---|
973 |
|
---|
974 | switch (yyn) {
|
---|
975 |
|
---|
976 | case 4:
|
---|
977 | #line 311 "itbl-parse.y"
|
---|
978 | {
|
---|
979 | DBG (("line %d: entry pnum=%d type=%d name=%s value=x%x\n",
|
---|
980 | insntbl_line, yyvsp[-4].num, yyvsp[-3].num, yyvsp[-2].str, yyvsp[-1].val));
|
---|
981 | itbl_add_reg (yyvsp[-4].num, yyvsp[-3].num, yyvsp[-2].str, yyvsp[-1].val);
|
---|
982 | ;
|
---|
983 | break;}
|
---|
984 | case 5:
|
---|
985 | #line 317 "itbl-parse.y"
|
---|
986 | {
|
---|
987 | DBG (("line %d: entry pnum=%d type=INSN name=%s value=x%x",
|
---|
988 | insntbl_line, yyvsp[-5].num, yyvsp[-3].str, yyvsp[-2].val));
|
---|
989 | DBG ((" sbit=%d ebit=%d flags=0x%x\n", sbit, ebit, yyvsp[0].val));
|
---|
990 | insn=itbl_add_insn (yyvsp[-5].num, yyvsp[-3].str, yyvsp[-2].val, sbit, ebit, yyvsp[0].val);
|
---|
991 | ;
|
---|
992 | break;}
|
---|
993 | case 12:
|
---|
994 | #line 336 "itbl-parse.y"
|
---|
995 | {
|
---|
996 | DBGL2 (("ftype\n"));
|
---|
997 | yyval.num = yyvsp[0].num;
|
---|
998 | ;
|
---|
999 | break;}
|
---|
1000 | case 13:
|
---|
1001 | #line 341 "itbl-parse.y"
|
---|
1002 | {
|
---|
1003 | DBGL2 (("addr\n"));
|
---|
1004 | yyval.num = ADDR;
|
---|
1005 | ;
|
---|
1006 | break;}
|
---|
1007 | case 14:
|
---|
1008 | #line 346 "itbl-parse.y"
|
---|
1009 | {
|
---|
1010 | DBGL2 (("immed\n"));
|
---|
1011 | yyval.num = IMMED;
|
---|
1012 | ;
|
---|
1013 | break;}
|
---|
1014 | case 15:
|
---|
1015 | #line 354 "itbl-parse.y"
|
---|
1016 | {
|
---|
1017 | DBG (("line %d: field type=%d sbit=%d ebit=%d, flags=0x%x\n",
|
---|
1018 | insntbl_line, yyvsp[-2].num, sbit, ebit, yyvsp[0].val));
|
---|
1019 | itbl_add_operand (insn, yyvsp[-2].num, sbit, ebit, yyvsp[0].val);
|
---|
1020 | ;
|
---|
1021 | break;}
|
---|
1022 | case 16:
|
---|
1023 | #line 363 "itbl-parse.y"
|
---|
1024 | {
|
---|
1025 | yyval.val = yyvsp[-2].num | yyvsp[0].val;
|
---|
1026 | ;
|
---|
1027 | break;}
|
---|
1028 | case 17:
|
---|
1029 | #line 367 "itbl-parse.y"
|
---|
1030 | {
|
---|
1031 | yyval.val = yyvsp[-1].val;
|
---|
1032 | ;
|
---|
1033 | break;}
|
---|
1034 | case 18:
|
---|
1035 | #line 371 "itbl-parse.y"
|
---|
1036 | {
|
---|
1037 | yyval.val = yyvsp[0].num;
|
---|
1038 | ;
|
---|
1039 | break;}
|
---|
1040 | case 19:
|
---|
1041 | #line 378 "itbl-parse.y"
|
---|
1042 | {
|
---|
1043 | DBGL2 (("flags=%d\n", yyvsp[0].val));
|
---|
1044 | yyval.val = yyvsp[0].val;
|
---|
1045 | ;
|
---|
1046 | break;}
|
---|
1047 | case 20:
|
---|
1048 | #line 383 "itbl-parse.y"
|
---|
1049 | {
|
---|
1050 | yyval.val = 0;
|
---|
1051 | ;
|
---|
1052 | break;}
|
---|
1053 | case 21:
|
---|
1054 | #line 390 "itbl-parse.y"
|
---|
1055 | {
|
---|
1056 | DBGL2 (("range %d %d\n", yyvsp[-2].num, yyvsp[0].num));
|
---|
1057 | sbit = yyvsp[-2].num;
|
---|
1058 | ebit = yyvsp[0].num;
|
---|
1059 | ;
|
---|
1060 | break;}
|
---|
1061 | case 22:
|
---|
1062 | #line 396 "itbl-parse.y"
|
---|
1063 | {
|
---|
1064 | sbit = 31;
|
---|
1065 | ebit = 0;
|
---|
1066 | ;
|
---|
1067 | break;}
|
---|
1068 | case 23:
|
---|
1069 | #line 404 "itbl-parse.y"
|
---|
1070 | {
|
---|
1071 | DBGL2 (("pnum=%d\n",yyvsp[0].num));
|
---|
1072 | yyval.num = yyvsp[0].num;
|
---|
1073 | ;
|
---|
1074 | break;}
|
---|
1075 | case 24:
|
---|
1076 | #line 412 "itbl-parse.y"
|
---|
1077 | {
|
---|
1078 | DBGL2 (("dreg\n"));
|
---|
1079 | yyval.num = DREG;
|
---|
1080 | ;
|
---|
1081 | break;}
|
---|
1082 | case 25:
|
---|
1083 | #line 417 "itbl-parse.y"
|
---|
1084 | {
|
---|
1085 | DBGL2 (("creg\n"));
|
---|
1086 | yyval.num = CREG;
|
---|
1087 | ;
|
---|
1088 | break;}
|
---|
1089 | case 26:
|
---|
1090 | #line 422 "itbl-parse.y"
|
---|
1091 | {
|
---|
1092 | DBGL2 (("greg\n"));
|
---|
1093 | yyval.num = GREG;
|
---|
1094 | ;
|
---|
1095 | break;}
|
---|
1096 | case 27:
|
---|
1097 | #line 430 "itbl-parse.y"
|
---|
1098 | {
|
---|
1099 | DBGL2 (("name=%s\n",yyvsp[0].str));
|
---|
1100 | yyval.str = yyvsp[0].str;
|
---|
1101 | ;
|
---|
1102 | break;}
|
---|
1103 | case 28:
|
---|
1104 | #line 438 "itbl-parse.y"
|
---|
1105 | {
|
---|
1106 | DBGL2 (("num=%d\n",yyvsp[0].num));
|
---|
1107 | yyval.num = yyvsp[0].num;
|
---|
1108 | ;
|
---|
1109 | break;}
|
---|
1110 | case 29:
|
---|
1111 | #line 446 "itbl-parse.y"
|
---|
1112 | {
|
---|
1113 | DBGL2 (("val=x%x\n",yyvsp[0].num));
|
---|
1114 | yyval.val = yyvsp[0].num;
|
---|
1115 | ;
|
---|
1116 | break;}
|
---|
1117 | }
|
---|
1118 | /* the action file gets copied in in place of this dollarsign */
|
---|
1119 | #line 543 "/usr/share/bison/bison.simple"
|
---|
1120 | |
---|
1121 |
|
---|
1122 | yyvsp -= yylen;
|
---|
1123 | yyssp -= yylen;
|
---|
1124 | #ifdef YYLSP_NEEDED
|
---|
1125 | yylsp -= yylen;
|
---|
1126 | #endif
|
---|
1127 |
|
---|
1128 | #if YYDEBUG != 0
|
---|
1129 | if (yydebug)
|
---|
1130 | {
|
---|
1131 | short *ssp1 = yyss - 1;
|
---|
1132 | fprintf (stderr, "state stack now");
|
---|
1133 | while (ssp1 != yyssp)
|
---|
1134 | fprintf (stderr, " %d", *++ssp1);
|
---|
1135 | fprintf (stderr, "\n");
|
---|
1136 | }
|
---|
1137 | #endif
|
---|
1138 |
|
---|
1139 | *++yyvsp = yyval;
|
---|
1140 |
|
---|
1141 | #ifdef YYLSP_NEEDED
|
---|
1142 | yylsp++;
|
---|
1143 | if (yylen == 0)
|
---|
1144 | {
|
---|
1145 | yylsp->first_line = yylloc.first_line;
|
---|
1146 | yylsp->first_column = yylloc.first_column;
|
---|
1147 | yylsp->last_line = (yylsp-1)->last_line;
|
---|
1148 | yylsp->last_column = (yylsp-1)->last_column;
|
---|
1149 | yylsp->text = 0;
|
---|
1150 | }
|
---|
1151 | else
|
---|
1152 | {
|
---|
1153 | yylsp->last_line = (yylsp+yylen-1)->last_line;
|
---|
1154 | yylsp->last_column = (yylsp+yylen-1)->last_column;
|
---|
1155 | }
|
---|
1156 | #endif
|
---|
1157 |
|
---|
1158 | /* Now "shift" the result of the reduction.
|
---|
1159 | Determine what state that goes to,
|
---|
1160 | based on the state we popped back to
|
---|
1161 | and the rule number reduced by. */
|
---|
1162 |
|
---|
1163 | yyn = yyr1[yyn];
|
---|
1164 |
|
---|
1165 | yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
|
---|
1166 | if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
|
---|
1167 | yystate = yytable[yystate];
|
---|
1168 | else
|
---|
1169 | yystate = yydefgoto[yyn - YYNTBASE];
|
---|
1170 |
|
---|
1171 | goto yynewstate;
|
---|
1172 |
|
---|
1173 | yyerrlab: /* here on detecting error */
|
---|
1174 |
|
---|
1175 | if (! yyerrstatus)
|
---|
1176 | /* If not already recovering from an error, report this error. */
|
---|
1177 | {
|
---|
1178 | ++yynerrs;
|
---|
1179 |
|
---|
1180 | #ifdef YYERROR_VERBOSE
|
---|
1181 | yyn = yypact[yystate];
|
---|
1182 |
|
---|
1183 | if (yyn > YYFLAG && yyn < YYLAST)
|
---|
1184 | {
|
---|
1185 | int size = 0;
|
---|
1186 | char *msg;
|
---|
1187 | int x, count;
|
---|
1188 |
|
---|
1189 | count = 0;
|
---|
1190 | /* Start X at -yyn if nec to avoid negative indexes in yycheck. */
|
---|
1191 | for (x = (yyn < 0 ? -yyn : 0);
|
---|
1192 | x < (sizeof(yytname) / sizeof(char *)); x++)
|
---|
1193 | if (yycheck[x + yyn] == x)
|
---|
1194 | size += strlen(yytname[x]) + 15, count++;
|
---|
1195 | msg = (char *) malloc(size + 15);
|
---|
1196 | if (msg != 0)
|
---|
1197 | {
|
---|
1198 | strcpy(msg, "parse error");
|
---|
1199 |
|
---|
1200 | if (count < 5)
|
---|
1201 | {
|
---|
1202 | count = 0;
|
---|
1203 | for (x = (yyn < 0 ? -yyn : 0);
|
---|
1204 | x < (sizeof(yytname) / sizeof(char *)); x++)
|
---|
1205 | if (yycheck[x + yyn] == x)
|
---|
1206 | {
|
---|
1207 | strcat(msg, count == 0 ? ", expecting `" : " or `");
|
---|
1208 | strcat(msg, yytname[x]);
|
---|
1209 | strcat(msg, "'");
|
---|
1210 | count++;
|
---|
1211 | }
|
---|
1212 | }
|
---|
1213 | yyerror(msg);
|
---|
1214 | free(msg);
|
---|
1215 | }
|
---|
1216 | else
|
---|
1217 | yyerror ("parse error; also virtual memory exceeded");
|
---|
1218 | }
|
---|
1219 | else
|
---|
1220 | #endif /* YYERROR_VERBOSE */
|
---|
1221 | yyerror("parse error");
|
---|
1222 | }
|
---|
1223 |
|
---|
1224 | goto yyerrlab1;
|
---|
1225 | yyerrlab1: /* here on error raised explicitly by an action */
|
---|
1226 |
|
---|
1227 | if (yyerrstatus == 3)
|
---|
1228 | {
|
---|
1229 | /* if just tried and failed to reuse lookahead token after an error, discard it. */
|
---|
1230 |
|
---|
1231 | /* return failure if at end of input */
|
---|
1232 | if (yychar == YYEOF)
|
---|
1233 | YYABORT;
|
---|
1234 |
|
---|
1235 | #if YYDEBUG != 0
|
---|
1236 | if (yydebug)
|
---|
1237 | fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
|
---|
1238 | #endif
|
---|
1239 |
|
---|
1240 | yychar = YYEMPTY;
|
---|
1241 | }
|
---|
1242 |
|
---|
1243 | /* Else will try to reuse lookahead token
|
---|
1244 | after shifting the error token. */
|
---|
1245 |
|
---|
1246 | yyerrstatus = 3; /* Each real token shifted decrements this */
|
---|
1247 |
|
---|
1248 | goto yyerrhandle;
|
---|
1249 |
|
---|
1250 | yyerrdefault: /* current state does not do anything special for the error token. */
|
---|
1251 |
|
---|
1252 | #if 0
|
---|
1253 | /* This is wrong; only states that explicitly want error tokens
|
---|
1254 | should shift them. */
|
---|
1255 | yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/
|
---|
1256 | if (yyn) goto yydefault;
|
---|
1257 | #endif
|
---|
1258 |
|
---|
1259 | yyerrpop: /* pop the current state because it cannot handle the error token */
|
---|
1260 |
|
---|
1261 | if (yyssp == yyss) YYABORT;
|
---|
1262 | yyvsp--;
|
---|
1263 | yystate = *--yyssp;
|
---|
1264 | #ifdef YYLSP_NEEDED
|
---|
1265 | yylsp--;
|
---|
1266 | #endif
|
---|
1267 |
|
---|
1268 | #if YYDEBUG != 0
|
---|
1269 | if (yydebug)
|
---|
1270 | {
|
---|
1271 | short *ssp1 = yyss - 1;
|
---|
1272 | fprintf (stderr, "Error: state stack now");
|
---|
1273 | while (ssp1 != yyssp)
|
---|
1274 | fprintf (stderr, " %d", *++ssp1);
|
---|
1275 | fprintf (stderr, "\n");
|
---|
1276 | }
|
---|
1277 | #endif
|
---|
1278 |
|
---|
1279 | yyerrhandle:
|
---|
1280 |
|
---|
1281 | yyn = yypact[yystate];
|
---|
1282 | if (yyn == YYFLAG)
|
---|
1283 | goto yyerrdefault;
|
---|
1284 |
|
---|
1285 | yyn += YYTERROR;
|
---|
1286 | if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
|
---|
1287 | goto yyerrdefault;
|
---|
1288 |
|
---|
1289 | yyn = yytable[yyn];
|
---|
1290 | if (yyn < 0)
|
---|
1291 | {
|
---|
1292 | if (yyn == YYFLAG)
|
---|
1293 | goto yyerrpop;
|
---|
1294 | yyn = -yyn;
|
---|
1295 | goto yyreduce;
|
---|
1296 | }
|
---|
1297 | else if (yyn == 0)
|
---|
1298 | goto yyerrpop;
|
---|
1299 |
|
---|
1300 | if (yyn == YYFINAL)
|
---|
1301 | YYACCEPT;
|
---|
1302 |
|
---|
1303 | #if YYDEBUG != 0
|
---|
1304 | if (yydebug)
|
---|
1305 | fprintf(stderr, "Shifting error token, ");
|
---|
1306 | #endif
|
---|
1307 |
|
---|
1308 | *++yyvsp = yylval;
|
---|
1309 | #ifdef YYLSP_NEEDED
|
---|
1310 | *++yylsp = yylloc;
|
---|
1311 | #endif
|
---|
1312 |
|
---|
1313 | yystate = yyn;
|
---|
1314 | goto yynewstate;
|
---|
1315 |
|
---|
1316 | yyacceptlab:
|
---|
1317 | /* YYACCEPT comes here. */
|
---|
1318 | if (yyfree_stacks)
|
---|
1319 | {
|
---|
1320 | free (yyss);
|
---|
1321 | free (yyvs);
|
---|
1322 | #ifdef YYLSP_NEEDED
|
---|
1323 | free (yyls);
|
---|
1324 | #endif
|
---|
1325 | }
|
---|
1326 | return 0;
|
---|
1327 |
|
---|
1328 | yyabortlab:
|
---|
1329 | /* YYABORT comes here. */
|
---|
1330 | if (yyfree_stacks)
|
---|
1331 | {
|
---|
1332 | free (yyss);
|
---|
1333 | free (yyvs);
|
---|
1334 | #ifdef YYLSP_NEEDED
|
---|
1335 | free (yyls);
|
---|
1336 | #endif
|
---|
1337 | }
|
---|
1338 | return 1;
|
---|
1339 | }
|
---|
1340 | #line 451 "itbl-parse.y"
|
---|
1341 |
|
---|
1342 |
|
---|
1343 | static int
|
---|
1344 | yyerror (msg)
|
---|
1345 | const char *msg;
|
---|
1346 | {
|
---|
1347 | printf ("line %d: %s\n", insntbl_line, msg);
|
---|
1348 | return 0;
|
---|
1349 | }
|
---|