Commit | Line | Data |
---|---|---|
e58de8a2 FF |
1 | /* YACC grammar for Chill expressions, for GDB. |
2 | Copyright (C) 1992 Free Software Foundation, Inc. | |
3 | ||
4 | This file is part of GDB. | |
5 | ||
6 | This program is free software; you can redistribute it and/or modify | |
7 | it under the terms of the GNU General Public License as published by | |
8 | the Free Software Foundation; either version 2 of the License, or | |
9 | (at your option) any later version. | |
10 | ||
11 | This program is distributed in the hope that it will be useful, | |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | GNU General Public License for more details. | |
15 | ||
16 | You should have received a copy of the GNU General Public License | |
17 | along with this program; if not, write to the Free Software | |
18 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ | |
19 | ||
20 | /* Parse a Chill expression from text in a string, | |
21 | and return the result as a struct expression pointer. | |
22 | That structure contains arithmetic operations in reverse polish, | |
23 | with constants represented by operations that are followed by special data. | |
24 | See expression.h for the details of the format. | |
25 | What is important here is that it can be built up sequentially | |
26 | during the process of parsing; the lower levels of the tree always | |
27 | come first in the result. | |
28 | ||
29 | Note that malloc's and realloc's in this file are transformed to | |
30 | xmalloc and xrealloc respectively by the same sed command in the | |
31 | makefile that remaps any other malloc/realloc inserted by the parser | |
32 | generator. Doing this with #defines and trying to control the interaction | |
33 | with include files (<malloc.h> and <stdlib.h> for example) just became | |
34 | too messy, particularly when such includes can be inserted at random | |
35 | times by the parser generator. | |
36 | ||
37 | Also note that the language accepted by this parser is more liberal | |
38 | than the one accepted by an actual Chill compiler. For example, the | |
39 | language rule that a simple name string can not be one of the reserved | |
40 | simple name strings is not enforced (e.g "case" is not treated as a | |
41 | reserved name). Another example is that Chill is a strongly typed | |
42 | language, and certain expressions that violate the type constraints | |
43 | may still be evaluated if gdb can do so in a meaningful manner, while | |
44 | such expressions would be rejected by the compiler. The reason for | |
45 | this more liberal behavior is the philosophy that the debugger | |
46 | is intended to be a tool that is used by the programmer when things | |
47 | go wrong, and as such, it should provide as few artificial barriers | |
48 | to it's use as possible. If it can do something meaningful, even | |
49 | something that violates language contraints that are enforced by the | |
50 | compiler, it should do so without complaint. | |
51 | ||
52 | */ | |
53 | ||
54 | %{ | |
55 | ||
56 | #include <stdio.h> | |
57 | #include <string.h> | |
58 | #include "defs.h" | |
59 | #include "symtab.h" | |
60 | #include "gdbtypes.h" | |
61 | #include "frame.h" | |
62 | #include "expression.h" | |
63 | #include "language.h" | |
64 | #include "value.h" | |
65 | #include "parser-defs.h" | |
66 | #include "bfd.h" | |
67 | #include "symfile.h" | |
68 | #include "objfiles.h" | |
69 | ||
70 | /* These MUST be included in any grammar file!!!! Please choose unique names! | |
71 | Note that this are a combined list of variables that can be produced | |
72 | by any one of bison, byacc, or yacc. */ | |
73 | #define yymaxdepth chill_maxdepth | |
74 | #define yyparse chill_parse | |
75 | #define yylex chill_lex | |
76 | #define yyerror chill_error | |
77 | #define yylval chill_lval | |
78 | #define yychar chill_char | |
79 | #define yydebug chill_debug | |
80 | #define yypact chill_pact | |
81 | #define yyr1 chill_r1 | |
82 | #define yyr2 chill_r2 | |
83 | #define yydef chill_def | |
84 | #define yychk chill_chk | |
85 | #define yypgo chill_pgo | |
86 | #define yyact chill_act | |
87 | #define yyexca chill_exca | |
88 | #define yyerrflag chill_errflag | |
89 | #define yynerrs chill_nerrs | |
90 | #define yyps chill_ps | |
91 | #define yypv chill_pv | |
92 | #define yys chill_s | |
93 | #define yy_yys chill_yys | |
94 | #define yystate chill_state | |
95 | #define yytmp chill_tmp | |
96 | #define yyv chill_v | |
97 | #define yy_yyv chill_yyv | |
98 | #define yyval chill_val | |
99 | #define yylloc chill_lloc | |
100 | #define yyss chill_yyss /* byacc */ | |
101 | #define yyssp chill_yysp /* byacc */ | |
102 | #define yyvs chill_yyvs /* byacc */ | |
103 | #define yyvsp chill_yyvsp /* byacc */ | |
104 | ||
105 | static int | |
106 | yylex PARAMS ((void)); | |
107 | ||
108 | static void | |
109 | yyerror PARAMS ((char *)); | |
110 | ||
111 | int | |
112 | yyparse PARAMS ((void)); | |
113 | ||
114 | /* #define YYDEBUG 1 */ | |
115 | ||
116 | %} | |
117 | ||
118 | /* Although the yacc "value" of an expression is not used, | |
119 | since the result is stored in the structure being created, | |
120 | other node types do have values. */ | |
121 | ||
122 | %union | |
123 | { | |
124 | LONGEST lval; | |
125 | unsigned LONGEST ulval; | |
126 | struct { | |
127 | LONGEST val; | |
128 | struct type *type; | |
129 | } typed_val; | |
130 | double dval; | |
131 | struct symbol *sym; | |
132 | struct type *tval; | |
133 | struct stoken sval; | |
134 | struct ttype tsym; | |
135 | struct symtoken ssym; | |
136 | int voidval; | |
137 | struct block *bval; | |
138 | enum exp_opcode opcode; | |
139 | struct internalvar *ivar; | |
140 | ||
141 | struct type **tvec; | |
142 | int *ivec; | |
143 | } | |
144 | ||
145 | %{ | |
146 | static int parse_number PARAMS ((void)); | |
147 | %} | |
148 | ||
149 | %token <voidval> FIXME | |
150 | ||
151 | %token <typed_val> INTEGER_LITERAL | |
152 | %token <ulval> BOOLEAN_LITERAL | |
2e66cf7d | 153 | %token <typed_val> CHARACTER_LITERAL |
e58de8a2 FF |
154 | %token <voidval> SET_LITERAL |
155 | %token <voidval> EMPTINESS_LITERAL | |
156 | %token <voidval> CHARACTER_STRING_LITERAL | |
157 | %token <voidval> BIT_STRING_LITERAL | |
158 | ||
159 | %token <voidval> STRING | |
160 | %token <voidval> CONSTANT | |
161 | %token <voidval> '.' | |
162 | %token <voidval> ';' | |
163 | %token <voidval> ':' | |
164 | %token <voidval> CASE | |
165 | %token <voidval> OF | |
166 | %token <voidval> ESAC | |
167 | %token <voidval> LOGIOR | |
168 | %token <voidval> ORIF | |
169 | %token <voidval> LOGXOR | |
170 | %token <voidval> LOGAND | |
171 | %token <voidval> ANDIF | |
172 | %token <voidval> '=' | |
173 | %token <voidval> NOTEQUAL | |
174 | %token <voidval> '>' | |
175 | %token <voidval> GTR | |
176 | %token <voidval> '<' | |
177 | %token <voidval> LEQ | |
178 | %token <voidval> IN | |
179 | %token <voidval> '+' | |
180 | %token <voidval> '-' | |
181 | %token <voidval> '*' | |
182 | %token <voidval> '/' | |
183 | %token <voidval> SLASH_SLASH | |
184 | %token <voidval> MOD | |
185 | %token <voidval> REM | |
186 | %token <voidval> NOT | |
187 | %token <voidval> POINTER | |
188 | %token <voidval> RECEIVE | |
189 | %token <voidval> SC | |
190 | %token <voidval> '[' | |
191 | %token <voidval> ']' | |
192 | %token <voidval> '(' | |
193 | %token <voidval> ')' | |
194 | %token <voidval> UP | |
195 | %token <voidval> IF | |
196 | %token <voidval> THEN | |
197 | %token <voidval> ELSE | |
198 | %token <voidval> FI | |
199 | %token <voidval> ELSIF | |
200 | %token <voidval> ILLEGAL_TOKEN | |
201 | ||
202 | %type <voidval> location | |
203 | %type <voidval> primitive_value | |
204 | %type <voidval> location_contents | |
205 | %type <voidval> value_name | |
206 | %type <voidval> literal | |
207 | %type <voidval> tuple | |
208 | %type <voidval> value_string_element | |
209 | %type <voidval> value_string_slice | |
210 | %type <voidval> value_array_element | |
211 | %type <voidval> value_array_slice | |
212 | %type <voidval> value_structure_field | |
213 | %type <voidval> expression_conversion | |
214 | %type <voidval> value_procedure_call | |
215 | %type <voidval> value_built_in_routine_call | |
216 | %type <voidval> start_expression | |
217 | %type <voidval> zero_adic_operator | |
218 | %type <voidval> parenthesised_expression | |
219 | %type <voidval> value | |
220 | %type <voidval> undefined_value | |
221 | %type <voidval> expression | |
222 | %type <voidval> conditional_expression | |
223 | %type <voidval> then_alternative | |
224 | %type <voidval> else_alternative | |
225 | %type <voidval> sub_expression | |
226 | %type <voidval> value_case_alternative | |
227 | %type <voidval> operand_0 | |
228 | %type <voidval> operand_1 | |
229 | %type <voidval> operand_2 | |
230 | %type <voidval> operand_3 | |
231 | %type <voidval> operand_4 | |
232 | %type <voidval> operand_5 | |
233 | %type <voidval> operand_6 | |
234 | %type <voidval> integer_literal_expression | |
235 | %type <voidval> synonym_name | |
236 | %type <voidval> value_enumeration_name | |
237 | %type <voidval> value_do_with_name | |
238 | %type <voidval> value_receive_name | |
239 | %type <voidval> general_procedure_name | |
240 | %type <voidval> string_primitive_value | |
241 | %type <voidval> start_element | |
242 | %type <voidval> left_element | |
243 | %type <voidval> right_element | |
244 | %type <voidval> slice_size | |
245 | %type <voidval> array_primitive_value | |
246 | %type <voidval> expression_list | |
247 | %type <voidval> lower_element | |
248 | %type <voidval> upper_element | |
249 | %type <voidval> first_element | |
250 | %type <voidval> structure_primitive_value | |
251 | %type <voidval> field_name | |
252 | %type <voidval> mode_name | |
253 | %type <voidval> boolean_expression | |
254 | %type <voidval> case_selector_list | |
255 | %type <voidval> subexpression | |
256 | %type <voidval> case_label_specification | |
257 | %type <voidval> buffer_location | |
258 | ||
259 | %% | |
260 | ||
261 | /* Z.200, 5.3.1 */ | |
262 | ||
263 | value : expression | |
264 | { | |
2e66cf7d | 265 | $$ = 0; /* FIXME */ |
e58de8a2 FF |
266 | } |
267 | | undefined_value | |
268 | { | |
2e66cf7d | 269 | $$ = 0; /* FIXME */ |
e58de8a2 FF |
270 | } |
271 | ; | |
272 | ||
273 | undefined_value : FIXME | |
274 | { | |
2e66cf7d | 275 | $$ = 0; /* FIXME */ |
e58de8a2 FF |
276 | } |
277 | ; | |
278 | ||
279 | /* Z.200, 4.2.1 */ | |
280 | ||
281 | location : FIXME | |
282 | { | |
2e66cf7d | 283 | $$ = 0; /* FIXME */ |
e58de8a2 FF |
284 | } |
285 | ; | |
286 | ||
287 | /* Z.200, 5.2.1 */ | |
288 | ||
289 | primitive_value : location_contents | |
290 | { | |
2e66cf7d | 291 | $$ = 0; /* FIXME */ |
e58de8a2 FF |
292 | } |
293 | | value_name | |
294 | { | |
2e66cf7d | 295 | $$ = 0; /* FIXME */ |
e58de8a2 FF |
296 | } |
297 | | literal | |
298 | { | |
2e66cf7d | 299 | $$ = 0; /* FIXME */ |
e58de8a2 FF |
300 | } |
301 | | tuple | |
302 | { | |
2e66cf7d | 303 | $$ = 0; /* FIXME */ |
e58de8a2 FF |
304 | } |
305 | | value_string_element | |
306 | { | |
2e66cf7d | 307 | $$ = 0; /* FIXME */ |
e58de8a2 FF |
308 | } |
309 | | value_string_slice | |
310 | { | |
2e66cf7d | 311 | $$ = 0; /* FIXME */ |
e58de8a2 FF |
312 | } |
313 | | value_array_element | |
314 | { | |
2e66cf7d | 315 | $$ = 0; /* FIXME */ |
e58de8a2 FF |
316 | } |
317 | | value_array_slice | |
318 | { | |
2e66cf7d | 319 | $$ = 0; /* FIXME */ |
e58de8a2 FF |
320 | } |
321 | | value_structure_field | |
322 | { | |
2e66cf7d | 323 | $$ = 0; /* FIXME */ |
e58de8a2 FF |
324 | } |
325 | | expression_conversion | |
326 | { | |
2e66cf7d | 327 | $$ = 0; /* FIXME */ |
e58de8a2 FF |
328 | } |
329 | | value_procedure_call | |
330 | { | |
2e66cf7d | 331 | $$ = 0; /* FIXME */ |
e58de8a2 FF |
332 | } |
333 | | value_built_in_routine_call | |
334 | { | |
2e66cf7d | 335 | $$ = 0; /* FIXME */ |
e58de8a2 FF |
336 | } |
337 | | start_expression | |
338 | { | |
2e66cf7d | 339 | $$ = 0; /* FIXME */ |
e58de8a2 FF |
340 | } |
341 | | zero_adic_operator | |
342 | { | |
2e66cf7d | 343 | $$ = 0; /* FIXME */ |
e58de8a2 FF |
344 | } |
345 | | parenthesised_expression | |
346 | { | |
2e66cf7d | 347 | $$ = 0; /* FIXME */ |
e58de8a2 FF |
348 | } |
349 | ; | |
350 | ||
351 | /* Z.200, 5.2.2 */ | |
352 | ||
353 | location_contents: location | |
354 | { | |
2e66cf7d | 355 | $$ = 0; /* FIXME */ |
e58de8a2 FF |
356 | } |
357 | ; | |
358 | ||
359 | /* Z.200, 5.2.3 */ | |
360 | ||
361 | value_name : synonym_name | |
362 | { | |
2e66cf7d | 363 | $$ = 0; /* FIXME */ |
e58de8a2 FF |
364 | } |
365 | | value_enumeration_name | |
366 | { | |
2e66cf7d | 367 | $$ = 0; /* FIXME */ |
e58de8a2 FF |
368 | } |
369 | | value_do_with_name | |
370 | { | |
2e66cf7d | 371 | $$ = 0; /* FIXME */ |
e58de8a2 FF |
372 | } |
373 | | value_receive_name | |
374 | { | |
2e66cf7d | 375 | $$ = 0; /* FIXME */ |
e58de8a2 FF |
376 | } |
377 | | general_procedure_name | |
378 | { | |
2e66cf7d | 379 | $$ = 0; /* FIXME */ |
e58de8a2 FF |
380 | } |
381 | ; | |
382 | ||
383 | /* Z.200, 5.2.4.1 */ | |
384 | ||
385 | literal : INTEGER_LITERAL | |
386 | { | |
2e66cf7d FF |
387 | write_exp_elt_opcode (OP_LONG); |
388 | write_exp_elt_type ($1.type); | |
389 | write_exp_elt_longcst ((LONGEST) ($1.val)); | |
390 | write_exp_elt_opcode (OP_LONG); | |
e58de8a2 FF |
391 | } |
392 | | BOOLEAN_LITERAL | |
393 | { | |
2e66cf7d FF |
394 | write_exp_elt_opcode (OP_BOOL); |
395 | write_exp_elt_longcst ((LONGEST) $1); | |
396 | write_exp_elt_opcode (OP_BOOL); | |
e58de8a2 FF |
397 | } |
398 | | CHARACTER_LITERAL | |
399 | { | |
2e66cf7d FF |
400 | write_exp_elt_opcode (OP_LONG); |
401 | write_exp_elt_type ($1.type); | |
402 | write_exp_elt_longcst ((LONGEST) ($1.val)); | |
403 | write_exp_elt_opcode (OP_LONG); | |
e58de8a2 FF |
404 | } |
405 | | SET_LITERAL | |
406 | { | |
2e66cf7d | 407 | $$ = 0; /* FIXME */ |
e58de8a2 FF |
408 | } |
409 | | EMPTINESS_LITERAL | |
410 | { | |
2e66cf7d | 411 | $$ = 0; /* FIXME */ |
e58de8a2 FF |
412 | } |
413 | | CHARACTER_STRING_LITERAL | |
414 | { | |
2e66cf7d | 415 | $$ = 0; /* FIXME */ |
e58de8a2 FF |
416 | } |
417 | | BIT_STRING_LITERAL | |
418 | { | |
2e66cf7d | 419 | $$ = 0; /* FIXME */ |
e58de8a2 FF |
420 | } |
421 | ; | |
422 | ||
423 | /* Z.200, 5.2.5 */ | |
424 | ||
425 | tuple : FIXME | |
426 | { | |
2e66cf7d | 427 | $$ = 0; /* FIXME */ |
e58de8a2 FF |
428 | } |
429 | ; | |
430 | ||
431 | ||
432 | /* Z.200, 5.2.6 */ | |
433 | ||
434 | value_string_element: string_primitive_value '(' start_element ')' | |
435 | { | |
2e66cf7d | 436 | $$ = 0; /* FIXME */ |
e58de8a2 FF |
437 | } |
438 | ; | |
439 | ||
440 | /* Z.200, 5.2.7 */ | |
441 | ||
442 | value_string_slice: string_primitive_value '(' left_element ':' right_element ')' | |
443 | { | |
2e66cf7d | 444 | $$ = 0; /* FIXME */ |
e58de8a2 FF |
445 | } |
446 | | string_primitive_value '(' start_element UP slice_size ')' | |
447 | { | |
2e66cf7d | 448 | $$ = 0; /* FIXME */ |
e58de8a2 FF |
449 | } |
450 | ; | |
451 | ||
452 | /* Z.200, 5.2.8 */ | |
453 | ||
454 | value_array_element: array_primitive_value '(' expression_list ')' | |
455 | { | |
2e66cf7d | 456 | $$ = 0; /* FIXME */ |
e58de8a2 FF |
457 | } |
458 | ; | |
459 | ||
460 | /* Z.200, 5.2.9 */ | |
461 | ||
462 | value_array_slice: array_primitive_value '(' lower_element ':' upper_element ')' | |
463 | { | |
2e66cf7d | 464 | $$ = 0; /* FIXME */ |
e58de8a2 FF |
465 | } |
466 | | array_primitive_value '(' first_element UP slice_size '(' | |
467 | { | |
2e66cf7d | 468 | $$ = 0; /* FIXME */ |
e58de8a2 FF |
469 | } |
470 | ; | |
471 | ||
472 | /* Z.200, 5.2.10 */ | |
473 | ||
474 | value_structure_field: structure_primitive_value '.' field_name | |
475 | { | |
2e66cf7d | 476 | $$ = 0; /* FIXME */ |
e58de8a2 FF |
477 | } |
478 | ; | |
479 | ||
480 | /* Z.200, 5.2.11 */ | |
481 | ||
482 | expression_conversion: mode_name '(' expression ')' | |
483 | { | |
2e66cf7d | 484 | $$ = 0; /* FIXME */ |
e58de8a2 FF |
485 | } |
486 | ; | |
487 | ||
488 | /* Z.200, 5.2.12 */ | |
489 | ||
490 | value_procedure_call: FIXME | |
491 | { | |
2e66cf7d | 492 | $$ = 0; /* FIXME */ |
e58de8a2 FF |
493 | } |
494 | ; | |
495 | ||
496 | /* Z.200, 5.2.13 */ | |
497 | ||
498 | value_built_in_routine_call: FIXME | |
499 | { | |
2e66cf7d | 500 | $$ = 0; /* FIXME */ |
e58de8a2 FF |
501 | } |
502 | ; | |
503 | ||
504 | /* Z.200, 5.2.14 */ | |
505 | ||
506 | start_expression: FIXME | |
507 | { | |
2e66cf7d | 508 | $$ = 0; /* FIXME */ |
e58de8a2 FF |
509 | } /* Not in GNU-Chill */ |
510 | ; | |
511 | ||
512 | /* Z.200, 5.2.15 */ | |
513 | ||
514 | zero_adic_operator: FIXME | |
515 | { | |
2e66cf7d | 516 | $$ = 0; /* FIXME */ |
e58de8a2 FF |
517 | } |
518 | ; | |
519 | ||
520 | /* Z.200, 5.2.16 */ | |
521 | ||
522 | parenthesised_expression: '(' expression ')' | |
523 | { | |
2e66cf7d | 524 | $$ = 0; /* FIXME */ |
e58de8a2 FF |
525 | } |
526 | ; | |
527 | ||
528 | /* Z.200, 5.3.2 */ | |
529 | ||
530 | expression : operand_0 | |
531 | { | |
2e66cf7d | 532 | $$ = 0; /* FIXME */ |
e58de8a2 FF |
533 | } |
534 | | conditional_expression | |
535 | { | |
2e66cf7d | 536 | $$ = 0; /* FIXME */ |
e58de8a2 FF |
537 | } |
538 | ; | |
539 | ||
540 | conditional_expression : IF boolean_expression then_alternative else_alternative FI | |
541 | { | |
2e66cf7d | 542 | $$ = 0; /* FIXME */ |
e58de8a2 FF |
543 | } |
544 | | CASE case_selector_list OF value_case_alternative '[' ELSE sub_expression ']' ESAC | |
545 | { | |
2e66cf7d | 546 | $$ = 0; /* FIXME */ |
e58de8a2 FF |
547 | } |
548 | ; | |
549 | ||
550 | then_alternative: THEN subexpression | |
551 | { | |
2e66cf7d | 552 | $$ = 0; /* FIXME */ |
e58de8a2 FF |
553 | } |
554 | ; | |
555 | ||
556 | else_alternative: ELSE subexpression | |
557 | { | |
2e66cf7d | 558 | $$ = 0; /* FIXME */ |
e58de8a2 FF |
559 | } |
560 | | ELSIF boolean_expression then_alternative else_alternative | |
561 | { | |
2e66cf7d | 562 | $$ = 0; /* FIXME */ |
e58de8a2 FF |
563 | } |
564 | ; | |
565 | ||
566 | sub_expression : expression | |
567 | { | |
2e66cf7d | 568 | $$ = 0; /* FIXME */ |
e58de8a2 FF |
569 | } |
570 | ; | |
571 | ||
572 | value_case_alternative: case_label_specification ':' sub_expression ';' | |
573 | { | |
2e66cf7d | 574 | $$ = 0; /* FIXME */ |
e58de8a2 FF |
575 | } |
576 | ; | |
577 | ||
578 | /* Z.200, 5.3.3 */ | |
579 | ||
580 | operand_0 : operand_1 | |
581 | { | |
2e66cf7d | 582 | $$ = 0; /* FIXME */ |
e58de8a2 FF |
583 | } |
584 | | operand_0 LOGIOR operand_1 | |
585 | { | |
2e66cf7d | 586 | write_exp_elt_opcode (BINOP_BITWISE_IOR); |
e58de8a2 FF |
587 | } |
588 | | operand_0 ORIF operand_1 | |
589 | { | |
2e66cf7d | 590 | $$ = 0; /* FIXME */ |
e58de8a2 FF |
591 | } |
592 | | operand_0 LOGXOR operand_1 | |
593 | { | |
2e66cf7d | 594 | write_exp_elt_opcode (BINOP_BITWISE_XOR); |
e58de8a2 FF |
595 | } |
596 | ; | |
597 | ||
598 | /* Z.200, 5.3.4 */ | |
599 | ||
600 | operand_1 : operand_2 | |
601 | { | |
2e66cf7d | 602 | $$ = 0; /* FIXME */ |
e58de8a2 FF |
603 | } |
604 | | operand_1 LOGAND operand_2 | |
605 | { | |
2e66cf7d | 606 | write_exp_elt_opcode (BINOP_BITWISE_AND); |
e58de8a2 FF |
607 | } |
608 | | operand_1 ANDIF operand_2 | |
609 | { | |
2e66cf7d | 610 | $$ = 0; /* FIXME */ |
e58de8a2 FF |
611 | } |
612 | ; | |
613 | ||
614 | /* Z.200, 5.3.5 */ | |
615 | ||
616 | operand_2 : operand_3 | |
617 | { | |
2e66cf7d | 618 | $$ = 0; /* FIXME */ |
e58de8a2 FF |
619 | } |
620 | | operand_2 '=' operand_3 | |
621 | { | |
2e66cf7d | 622 | write_exp_elt_opcode (BINOP_EQUAL); |
e58de8a2 FF |
623 | } |
624 | | operand_2 NOTEQUAL operand_3 | |
625 | { | |
2e66cf7d | 626 | write_exp_elt_opcode (BINOP_NOTEQUAL); |
e58de8a2 FF |
627 | } |
628 | | operand_2 '>' operand_3 | |
629 | { | |
2e66cf7d | 630 | write_exp_elt_opcode (BINOP_GTR); |
e58de8a2 FF |
631 | } |
632 | | operand_2 GTR operand_3 | |
633 | { | |
2e66cf7d | 634 | write_exp_elt_opcode (BINOP_GEQ); |
e58de8a2 FF |
635 | } |
636 | | operand_2 '<' operand_3 | |
637 | { | |
2e66cf7d | 638 | write_exp_elt_opcode (BINOP_LESS); |
e58de8a2 FF |
639 | } |
640 | | operand_2 LEQ operand_3 | |
641 | { | |
2e66cf7d | 642 | write_exp_elt_opcode (BINOP_LEQ); |
e58de8a2 FF |
643 | } |
644 | | operand_2 IN operand_3 | |
645 | { | |
2e66cf7d | 646 | $$ = 0; /* FIXME */ |
e58de8a2 FF |
647 | } |
648 | ; | |
649 | ||
650 | ||
651 | /* Z.200, 5.3.6 */ | |
652 | ||
653 | operand_3 : operand_4 | |
654 | { | |
2e66cf7d | 655 | $$ = 0; /* FIXME */ |
e58de8a2 FF |
656 | } |
657 | | operand_3 '+' operand_4 | |
658 | { | |
2e66cf7d | 659 | write_exp_elt_opcode (BINOP_ADD); |
e58de8a2 FF |
660 | } |
661 | | operand_3 '-' operand_4 | |
662 | { | |
2e66cf7d | 663 | write_exp_elt_opcode (BINOP_SUB); |
e58de8a2 FF |
664 | } |
665 | | operand_3 SLASH_SLASH operand_4 | |
666 | { | |
2e66cf7d | 667 | $$ = 0; /* FIXME */ |
e58de8a2 FF |
668 | } |
669 | ; | |
670 | ||
671 | /* Z.200, 5.3.7 */ | |
672 | ||
673 | operand_4 : operand_5 | |
674 | { | |
2e66cf7d | 675 | $$ = 0; /* FIXME */ |
e58de8a2 FF |
676 | } |
677 | | operand_4 '*' operand_5 | |
678 | { | |
2e66cf7d | 679 | write_exp_elt_opcode (BINOP_MUL); |
e58de8a2 FF |
680 | } |
681 | | operand_4 '/' operand_5 | |
682 | { | |
2e66cf7d | 683 | write_exp_elt_opcode (BINOP_DIV); |
e58de8a2 FF |
684 | } |
685 | | operand_4 MOD operand_5 | |
686 | { | |
2e66cf7d | 687 | $$ = 0; /* FIXME */ |
e58de8a2 FF |
688 | } |
689 | | operand_4 REM operand_5 | |
690 | { | |
2e66cf7d | 691 | $$ = 0; /* FIXME */ |
e58de8a2 FF |
692 | } |
693 | ; | |
694 | ||
695 | /* Z.200, 5.3.8 */ | |
696 | ||
697 | operand_5 : operand_6 | |
698 | { | |
2e66cf7d | 699 | $$ = 0; /* FIXME */ |
e58de8a2 FF |
700 | } |
701 | | '-' operand_6 | |
702 | { | |
2e66cf7d | 703 | write_exp_elt_opcode (UNOP_NEG); |
e58de8a2 FF |
704 | } |
705 | | NOT operand_6 | |
706 | { | |
2e66cf7d | 707 | write_exp_elt_opcode (UNOP_LOGICAL_NOT); |
e58de8a2 FF |
708 | } |
709 | | '(' integer_literal_expression ')' operand_6 | |
710 | { | |
2e66cf7d | 711 | $$ = 0; /* FIXME */ |
e58de8a2 FF |
712 | } |
713 | ; | |
714 | ||
715 | /* Z.200, 5.3.9 */ | |
716 | ||
717 | operand_6 : POINTER location | |
718 | { | |
2e66cf7d | 719 | $$ = 0; /* FIXME */ |
e58de8a2 FF |
720 | } |
721 | | RECEIVE buffer_location | |
722 | { | |
2e66cf7d | 723 | $$ = 0; /* FIXME */ |
e58de8a2 FF |
724 | } |
725 | | primitive_value | |
726 | { | |
2e66cf7d | 727 | $$ = 0; /* FIXME */ |
e58de8a2 FF |
728 | } |
729 | ; | |
730 | ||
731 | ||
732 | /* Z.200, 12.4.3 */ | |
733 | /* FIXME: For now we just accept only a single integer literal. */ | |
734 | ||
735 | integer_literal_expression: | |
736 | INTEGER_LITERAL | |
737 | { | |
2e66cf7d | 738 | $$ = 0; |
e58de8a2 FF |
739 | } |
740 | ||
741 | /* Things which still need productions... */ | |
742 | synonym_name : FIXME { $$ = 0; } | |
743 | value_enumeration_name : FIXME { $$ = 0; } | |
744 | value_do_with_name : FIXME { $$ = 0; } | |
745 | value_receive_name : FIXME { $$ = 0; } | |
746 | general_procedure_name : FIXME { $$ = 0; } | |
747 | string_primitive_value : FIXME { $$ = 0; } | |
748 | start_element : FIXME { $$ = 0; } | |
749 | left_element : FIXME { $$ = 0; } | |
750 | right_element : FIXME { $$ = 0; } | |
751 | slice_size : FIXME { $$ = 0; } | |
752 | array_primitive_value : FIXME { $$ = 0; } | |
753 | expression_list : FIXME { $$ = 0; } | |
754 | lower_element : FIXME { $$ = 0; } | |
755 | upper_element : FIXME { $$ = 0; } | |
756 | first_element : FIXME { $$ = 0; } | |
757 | structure_primitive_value: FIXME { $$ = 0; } | |
758 | field_name : FIXME { $$ = 0; } | |
759 | mode_name : FIXME { $$ = 0; } | |
760 | boolean_expression : FIXME { $$ = 0; } | |
761 | case_selector_list : FIXME { $$ = 0; } | |
762 | subexpression : FIXME { $$ = 0; } | |
763 | case_label_specification: FIXME { $$ = 0; } | |
764 | buffer_location : FIXME { $$ = 0; } | |
765 | ||
766 | %% | |
767 | ||
e58de8a2 | 768 | static int |
2e66cf7d FF |
769 | decode_integer_literal (valptr, tokptrptr) |
770 | int *valptr; | |
771 | char **tokptrptr; | |
e58de8a2 | 772 | { |
2e66cf7d FF |
773 | char *tokptr = *tokptrptr; |
774 | int base = 0; | |
775 | int ival = 0; | |
776 | int digits = 0; | |
777 | int temp; | |
778 | int explicit_base = 0; | |
779 | ||
780 | /* Look for an explicit base specifier, which is optional. */ | |
781 | ||
782 | switch (*tokptr) | |
783 | { | |
784 | case 'd': | |
785 | case 'D': | |
786 | explicit_base++; | |
787 | base = 10; | |
788 | tokptr++; | |
789 | break; | |
790 | case 'b': | |
791 | case 'B': | |
792 | explicit_base++; | |
793 | base = 2; | |
794 | tokptr++; | |
795 | break; | |
796 | case 'h': | |
797 | case 'H': | |
798 | explicit_base++; | |
799 | base = 16; | |
800 | tokptr++; | |
801 | break; | |
802 | case 'o': | |
803 | case 'O': | |
804 | explicit_base++; | |
805 | base = 8; | |
806 | tokptr++; | |
807 | break; | |
808 | default: | |
809 | base = 10; | |
810 | break; | |
811 | } | |
812 | ||
813 | /* If we found an explicit base ensure that the character after the | |
814 | explicit base is a single quote. */ | |
815 | ||
816 | if (explicit_base && (*tokptr++ != '\'')) | |
817 | { | |
818 | return (0); | |
819 | } | |
820 | ||
821 | /* Start looking for a value composed of valid digits as set by the base | |
822 | in use. Note that '_' characters are valid anywhere, in any quantity, | |
823 | and are simply ignored. Since we must find at least one valid digit, | |
824 | or reject this token as an integer literal, we keep track of how many | |
825 | digits we have encountered. */ | |
826 | ||
827 | while (*tokptr != '\0') | |
828 | { | |
829 | temp = tolower (*tokptr); | |
830 | tokptr++; | |
831 | switch (temp) | |
e58de8a2 | 832 | { |
2e66cf7d FF |
833 | case '_': |
834 | continue; | |
835 | case '0': case '1': case '2': case '3': case '4': | |
836 | case '5': case '6': case '7': case '8': case '9': | |
837 | temp -= '0'; | |
838 | break; | |
839 | case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': | |
840 | temp -= 'a'; | |
841 | temp += 10; | |
842 | break; | |
843 | default: | |
844 | temp = base; | |
845 | break; | |
e58de8a2 | 846 | } |
2e66cf7d | 847 | if (temp < base) |
e58de8a2 | 848 | { |
2e66cf7d FF |
849 | digits++; |
850 | ival *= base; | |
851 | ival += temp; | |
e58de8a2 | 852 | } |
2e66cf7d | 853 | else |
e58de8a2 | 854 | { |
2e66cf7d FF |
855 | /* Found something not in domain for current base. */ |
856 | tokptr--; /* Unconsume what gave us indigestion. */ | |
857 | break; | |
e58de8a2 | 858 | } |
2e66cf7d FF |
859 | } |
860 | ||
861 | /* If we didn't find any digits, then we don't have a valid integer | |
862 | literal, so reject the entire token. Also, if we have an explicit | |
863 | base, then the next character must not be a single quote, or we | |
864 | have a bitstring literal, so reject the entire token in this case | |
865 | as well. Otherwise, update the lexical scan pointer, and return | |
866 | non-zero for success. */ | |
867 | ||
868 | if (digits == 0) | |
869 | { | |
870 | return (0); | |
871 | } | |
872 | else if (explicit_base && (*tokptr == '\'')) | |
873 | { | |
874 | return (0); | |
875 | } | |
876 | else | |
877 | { | |
878 | *valptr = ival; | |
879 | *tokptrptr = tokptr; | |
880 | return (1); | |
881 | } | |
882 | } | |
883 | ||
884 | /* Recognize a character literal. A character literal is single character | |
885 | or a control sequence, enclosed in single quotes. A control sequence | |
886 | is a comma separated list of one or more integer literals, enclosed | |
887 | in parenthesis and introduced with a circumflex character. | |
888 | ||
889 | EX: 'a' '^(7)' '^(7,8)' | |
890 | ||
891 | Returns CHARACTER_LITERAL if a match is found. | |
892 | */ | |
893 | ||
894 | static int | |
895 | match_character_literal () | |
896 | { | |
897 | char *tokptr = lexptr; | |
898 | int ival = 0; | |
899 | ||
900 | /* All character literals must start with a single quote. If we don't | |
901 | find it, don't bother looking any further. */ | |
902 | ||
903 | if (*tokptr++ != '\'') | |
904 | { | |
905 | return (0); | |
906 | } | |
907 | ||
908 | /* Determine which form we have, either a control sequence or the | |
909 | single character form. */ | |
910 | ||
911 | if ((*tokptr == '^') && (*(tokptr + 1) == '(')) | |
912 | { | |
913 | /* Match and decode a control sequence. Return zero if we don't | |
914 | find a valid integer literal, or if the next unconsumed character | |
915 | after the integer literal is not the trailing ')'. | |
916 | FIXME: We currently don't handle the multiple integer literal | |
917 | form. */ | |
918 | tokptr += 2; | |
919 | if (!decode_integer_literal (&ival, &tokptr) || (*tokptr++ != ')')) | |
e58de8a2 | 920 | { |
2e66cf7d | 921 | return (0); |
e58de8a2 | 922 | } |
2e66cf7d FF |
923 | } |
924 | else | |
925 | { | |
926 | ival = *tokptr++; | |
927 | } | |
928 | ||
929 | /* The trailing quote has not yet been consumed. If we don't find | |
930 | it, then we have no match. */ | |
931 | ||
932 | if (*tokptr++ != '\'') | |
933 | { | |
934 | return (0); | |
935 | } | |
936 | ||
937 | yylval.typed_val.val = ival; | |
938 | yylval.typed_val.type = builtin_type_chill_char; | |
939 | lexptr = tokptr; | |
940 | return (CHARACTER_LITERAL); | |
e58de8a2 FF |
941 | } |
942 | ||
943 | /* Recognize an integer literal, as specified in Z.200 sec 5.2.4.2. | |
944 | Note that according to 5.2.4.2, a single "_" is also a valid integer | |
945 | literal, however GNU-chill requires there to be at least one "digit" | |
946 | in any integer literal. */ | |
947 | ||
948 | static int | |
2e66cf7d | 949 | match_integer_literal () |
e58de8a2 | 950 | { |
2e66cf7d | 951 | char *tokptr = lexptr; |
ae0afa4b | 952 | int ival; |
2e66cf7d | 953 | |
ae0afa4b | 954 | if (!decode_integer_literal (&ival, &tokptr)) |
2e66cf7d FF |
955 | { |
956 | return (0); | |
957 | } | |
ae0afa4b | 958 | else |
2e66cf7d FF |
959 | { |
960 | yylval.typed_val.val = ival; | |
961 | yylval.typed_val.type = builtin_type_int; | |
962 | lexptr = tokptr; | |
963 | return (INTEGER_LITERAL); | |
964 | } | |
e58de8a2 FF |
965 | } |
966 | ||
967 | static void convert_float () | |
968 | { | |
969 | #if 0 | |
970 | extern double strtod (); | |
971 | double d; | |
972 | char tmp[256]; | |
973 | char *p = yytext, *p1 = tmp; | |
974 | char c; | |
975 | ||
976 | while (c = *p++) | |
977 | { | |
978 | switch (c) | |
979 | { | |
980 | case '_': | |
981 | break; | |
982 | case 'E': | |
983 | case 'd': | |
984 | case 'D': | |
985 | *p1++ = 'e'; | |
986 | break; | |
987 | default: | |
988 | *p1++ = c; | |
989 | break; | |
990 | } | |
991 | } | |
992 | *p1 = '\0'; | |
993 | d = strtod (tmp, &p1); | |
994 | if (*p1) | |
995 | { | |
996 | /* add error handling here */ | |
997 | ; | |
998 | } | |
999 | yylval.dval = d; | |
1000 | #endif | |
1001 | } | |
1002 | ||
1003 | /* Take care of parsing a number (anything that starts with a digit). | |
1004 | Set yylval and return the token type; update lexptr. | |
1005 | LEN is the number of characters in it. */ | |
1006 | ||
1007 | /*** Needs some error checking for the float case ***/ | |
1008 | ||
1009 | static int | |
1010 | parse_number () | |
1011 | { | |
1012 | } | |
1013 | ||
1014 | struct token | |
1015 | { | |
1016 | char *operator; | |
1017 | int token; | |
1018 | }; | |
1019 | ||
1020 | const static struct token tokentab5[] = | |
1021 | { | |
1022 | { "ANDIF", ANDIF } | |
1023 | }; | |
1024 | ||
1025 | const static struct token tokentab4[] = | |
1026 | { | |
1027 | { "ORIF", ORIF } | |
1028 | }; | |
1029 | ||
1030 | const static struct token tokentab3[] = | |
1031 | { | |
1032 | { "NOT", NOT }, | |
1033 | { "XOR", LOGXOR }, | |
1034 | { "AND", LOGAND } | |
1035 | }; | |
1036 | ||
1037 | const static struct token tokentab2[] = | |
1038 | { | |
1039 | { "//", SLASH_SLASH }, | |
1040 | { "/=", NOTEQUAL }, | |
1041 | { "<=", LEQ }, | |
1042 | { ">=", GTR }, | |
1043 | { "IN", IN }, | |
1044 | { "OR", LOGIOR } | |
1045 | }; | |
1046 | ||
1047 | /* Read one token, getting characters through lexptr. */ | |
1048 | /* This is where we will check to make sure that the language and the | |
1049 | operators used are compatible. */ | |
1050 | ||
1051 | static int | |
1052 | yylex () | |
1053 | { | |
1054 | unsigned int i; | |
1055 | int token; | |
1056 | ||
1057 | /* Skip over any leading whitespace. */ | |
1058 | while (isspace (*lexptr)) | |
1059 | { | |
1060 | lexptr++; | |
1061 | } | |
1062 | /* Look for special single character cases which can't be the first | |
1063 | character of some other multicharacter token. */ | |
1064 | switch (*lexptr) | |
1065 | { | |
1066 | case '\0': | |
1067 | return (0); | |
1068 | case '.': | |
1069 | case '=': | |
1070 | case ':': | |
1071 | case ';': | |
1072 | case '!': | |
1073 | case '+': | |
1074 | case '-': | |
1075 | case '*': | |
1076 | case '/': | |
1077 | case '(': | |
1078 | case ')': | |
1079 | case '[': | |
1080 | case ']': | |
1081 | return (*lexptr++); | |
1082 | } | |
1083 | /* Look for characters which start a particular kind of multicharacter | |
1084 | token, such as a character literal. */ | |
1085 | switch (*lexptr) | |
2e66cf7d | 1086 | { |
2e66cf7d FF |
1087 | case '\'': |
1088 | token = match_character_literal (); | |
1089 | if (token != 0) | |
1090 | { | |
1091 | return (token); | |
1092 | } | |
1093 | break; | |
1094 | } | |
e58de8a2 FF |
1095 | /* See if it is a special token of length 5. */ |
1096 | for (i = 0; i < sizeof (tokentab5) / sizeof (tokentab5[0]); i++) | |
1097 | { | |
1098 | if (strncmp (lexptr, tokentab5[i].operator, 5) == 0) | |
1099 | { | |
1100 | lexptr += 5; | |
1101 | return (tokentab5[i].token); | |
1102 | } | |
1103 | } | |
1104 | /* See if it is a special token of length 4. */ | |
1105 | for (i = 0; i < sizeof (tokentab4) / sizeof (tokentab4[0]); i++) | |
1106 | { | |
1107 | if (strncmp (lexptr, tokentab4[i].operator, 4) == 0) | |
1108 | { | |
1109 | lexptr += 4; | |
1110 | return (tokentab4[i].token); | |
1111 | } | |
1112 | } | |
1113 | /* See if it is a special token of length 3. */ | |
1114 | for (i = 0; i < sizeof (tokentab3) / sizeof (tokentab3[0]); i++) | |
1115 | { | |
1116 | if (strncmp (lexptr, tokentab3[i].operator, 3) == 0) | |
1117 | { | |
1118 | lexptr += 3; | |
1119 | return (tokentab3[i].token); | |
1120 | } | |
1121 | } | |
1122 | /* See if it is a special token of length 2. */ | |
1123 | for (i = 0; i < sizeof (tokentab2) / sizeof (tokentab2[0]); i++) | |
1124 | { | |
1125 | if (strncmp (lexptr, tokentab2[i].operator, 2) == 0) | |
1126 | { | |
1127 | lexptr += 2; | |
1128 | return (tokentab2[i].token); | |
1129 | } | |
1130 | } | |
1131 | /* Look for single character cases which which could be the first | |
1132 | character of some other multicharacter token, but aren't, or we | |
1133 | would already have found it. */ | |
1134 | switch (*lexptr) | |
1135 | { | |
1136 | case '/': | |
1137 | case '<': | |
1138 | case '>': | |
1139 | return (*lexptr++); | |
1140 | } | |
1141 | /* Look for other special tokens. */ | |
1142 | if (strncmp (lexptr, "TRUE", 4) == 0) /* FIXME: What about lowercase? */ | |
1143 | { | |
1144 | yylval.ulval = 1; | |
1145 | lexptr += 4; | |
1146 | return (BOOLEAN_LITERAL); | |
1147 | } | |
1148 | if (strncmp (lexptr, "FALSE", 5) == 0) /* FIXME: What about lowercase? */ | |
1149 | { | |
1150 | yylval.ulval = 0; | |
1151 | lexptr += 5; | |
1152 | return (BOOLEAN_LITERAL); | |
1153 | } | |
2e66cf7d FF |
1154 | token = match_integer_literal (); |
1155 | if (token != 0); | |
e58de8a2 FF |
1156 | { |
1157 | return (token); | |
1158 | } | |
1159 | return (ILLEGAL_TOKEN); | |
1160 | } | |
1161 | ||
1162 | static void | |
1163 | yyerror (msg) | |
1164 | char *msg; /* unused */ | |
1165 | { | |
1166 | printf ("Parsing: %s\n", lexptr); | |
1167 | if (yychar < 256) | |
1168 | { | |
1169 | error ("Invalid syntax in expression near character '%c'.", yychar); | |
1170 | } | |
1171 | else | |
1172 | { | |
1173 | error ("Invalid syntax in expression"); | |
1174 | } | |
1175 | } | |
1176 | ||
1177 | \f | |
1178 | /* Table of operators and their precedences for printing expressions. */ | |
1179 | ||
1180 | const static struct op_print chill_op_print_tab[] = { | |
1181 | {"AND", BINOP_LOGICAL_AND, PREC_LOGICAL_AND, 0}, | |
1182 | {"OR", BINOP_LOGICAL_OR, PREC_LOGICAL_OR, 0}, | |
1183 | {"NOT", UNOP_LOGICAL_NOT, PREC_PREFIX, 0}, | |
1184 | {"MOD", BINOP_REM, PREC_MUL, 0}, | |
1185 | {":=", BINOP_ASSIGN, PREC_ASSIGN, 1}, | |
1186 | {"=", BINOP_EQUAL, PREC_EQUAL, 0}, | |
1187 | {"/=", BINOP_NOTEQUAL, PREC_EQUAL, 0}, | |
1188 | {"<=", BINOP_LEQ, PREC_ORDER, 0}, | |
1189 | {">=", BINOP_GEQ, PREC_ORDER, 0}, | |
1190 | {">", BINOP_GTR, PREC_ORDER, 0}, | |
1191 | {"<", BINOP_LESS, PREC_ORDER, 0}, | |
1192 | {"+", BINOP_ADD, PREC_ADD, 0}, | |
1193 | {"-", BINOP_SUB, PREC_ADD, 0}, | |
1194 | {"*", BINOP_MUL, PREC_MUL, 0}, | |
1195 | {"/", BINOP_DIV, PREC_MUL, 0}, | |
1196 | {"-", UNOP_NEG, PREC_PREFIX, 0}, | |
1197 | {NULL, 0, 0, 0} | |
1198 | }; | |
1199 | ||
1200 | \f | |
1201 | /* The built-in types of Chill. */ | |
1202 | ||
1203 | struct type *builtin_type_chill_bool; | |
2e66cf7d | 1204 | struct type *builtin_type_chill_char; |
e58de8a2 FF |
1205 | struct type *builtin_type_chill_long; |
1206 | struct type *builtin_type_chill_ulong; | |
1207 | struct type *builtin_type_chill_real; | |
1208 | ||
1209 | struct type ** const (chill_builtin_types[]) = | |
1210 | { | |
1211 | &builtin_type_chill_bool, | |
2e66cf7d | 1212 | &builtin_type_chill_char, |
e58de8a2 FF |
1213 | &builtin_type_chill_long, |
1214 | &builtin_type_chill_ulong, | |
1215 | &builtin_type_chill_real, | |
1216 | 0 | |
1217 | }; | |
1218 | ||
1219 | const struct language_defn chill_language_defn = { | |
1220 | "chill", | |
1221 | language_chill, | |
1222 | chill_builtin_types, | |
1223 | range_check_on, | |
1224 | type_check_on, | |
1225 | chill_parse, /* parser */ | |
1226 | chill_error, /* parser error function */ | |
1227 | &BUILTIN_TYPE_LONGEST, /* longest signed integral type */ | |
1228 | &BUILTIN_TYPE_UNSIGNED_LONGEST,/* longest unsigned integral type */ | |
1229 | &builtin_type_chill_real, /* longest floating point type */ | |
2e66cf7d FF |
1230 | {"", "B'", "", ""}, /* Binary format info */ |
1231 | {"O'%o", "O'", "o", ""}, /* Octal format info */ | |
1232 | {"D'%d", "D'", "d", ""}, /* Decimal format info */ | |
1233 | {"H'%x", "H'", "x", ""}, /* Hex format info */ | |
e58de8a2 FF |
1234 | chill_op_print_tab, /* expression operators for printing */ |
1235 | LANG_MAGIC | |
1236 | }; | |
1237 | ||
1238 | /* Initialization for Chill */ | |
1239 | ||
1240 | void | |
1241 | _initialize_chill_exp () | |
1242 | { | |
1243 | builtin_type_chill_bool = | |
1244 | init_type (TYPE_CODE_BOOL, TARGET_INT_BIT / TARGET_CHAR_BIT, | |
1245 | TYPE_FLAG_UNSIGNED, | |
1246 | "BOOL", (struct objfile *) NULL); | |
2e66cf7d FF |
1247 | builtin_type_chill_char = |
1248 | init_type (TYPE_CODE_CHAR, TARGET_CHAR_BIT / TARGET_CHAR_BIT, | |
1249 | TYPE_FLAG_UNSIGNED, | |
1250 | "CHAR", (struct objfile *) NULL); | |
e58de8a2 FF |
1251 | builtin_type_chill_long = |
1252 | init_type (TYPE_CODE_INT, TARGET_LONG_BIT / TARGET_CHAR_BIT, | |
1253 | 0, | |
1254 | "LONG", (struct objfile *) NULL); | |
1255 | builtin_type_chill_ulong = | |
1256 | init_type (TYPE_CODE_INT, TARGET_LONG_BIT / TARGET_CHAR_BIT, | |
1257 | TYPE_FLAG_UNSIGNED, | |
1258 | "ULONG", (struct objfile *) NULL); | |
1259 | builtin_type_chill_real = | |
1260 | init_type (TYPE_CODE_FLT, TARGET_DOUBLE_BIT / TARGET_CHAR_BIT, | |
1261 | 0, | |
1262 | "LONG_REAL", (struct objfile *) NULL); | |
1263 | ||
1264 | add_language (&chill_language_defn); | |
1265 | } |