]> git.saurik.com Git - bison.git/blob - tests/torture.at
Use bitset operations when possible, not loops over bits.
[bison.git] / tests / torture.at
1 # Torturing Bison. -*- Autotest -*-
2 # Copyright 2001 Free Software Foundation, Inc.
3
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2, or (at your option)
7 # any later version.
8
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
13
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
17 # 02111-1307, USA.
18
19 AT_BANNER([[Torture Tests.]])
20
21
22 # AT_DATA_STACK_TORTURE(C-PROLOGUE)
23 # ---------------------------------
24 # A parser specialized in torturing the stack size.
25 m4_define([AT_DATA_STACK_TORTURE],
26 [# A grammar of parens growing the stack thanks to right recursion.
27 # exp:
28 AT_DATA([input.y],
29 [[%{
30 #include <stdio.h>
31 #include <stdlib.h>
32 #include <assert.h>
33 ]$1[
34 static int yylex (void);
35 static void yyerror (const char *msg);
36 #define YYPRINT(File, Type, Value) \
37 fprintf (File, " (%d, stack size = %d, max = %d)", \
38 Value, yyssp - yyss + 1, yystacksize);
39 %}
40 %error-verbose
41 %debug
42 %token WAIT_FOR_EOF
43 %%
44 exp: WAIT_FOR_EOF exp | ;
45 %%
46 static void
47 yyerror (const char *msg)
48 {
49 fprintf (stderr, "%s\n", msg);
50 exit (1);
51 }
52
53 /* There are YYLVAL_MAX of WAIT_FOR_EOFs. */
54 unsigned int yylval_max;
55
56 static int
57 yylex (void)
58 {
59 if (yylval--)
60 return WAIT_FOR_EOF;
61 else
62 return EOF;
63 }
64
65 int
66 main (int argc, const char **argv)
67 {
68 assert (argc == 2);
69 yylval = atoi (argv[1]);
70 yydebug = 1;
71 return yyparse ();
72 }
73 ]])
74 AT_CHECK([bison input.y -o input.c])
75 AT_CHECK([$CC $CFLAGS $CPPFLAGS input.c -o input], 0, [], [ignore])
76 ])
77
78
79 ## -------------------------------------- ##
80 ## Exploding the Stack Size with Alloca. ##
81 ## -------------------------------------- ##
82
83 AT_SETUP([Exploding the Stack Size with Alloca])
84
85 AT_DATA_STACK_TORTURE
86
87 # Below the limit of 200.
88 AT_CHECK([./input 20], 0, [], [ignore])
89 # Two enlargements: 2 * 2 * 200.
90 AT_CHECK([./input 900], 0, [], [ignore])
91 # Fails: beyond the limit of 10,000 (which we don't reach anyway since we
92 # multiply by two starting at 200 => 5120 is the last possible).
93 AT_CHECK([./input 10000], 1, [], [ignore])
94
95 AT_CLEANUP
96
97
98
99
100 ## -------------------------------------- ##
101 ## Exploding the Stack Size with Malloc. ##
102 ## -------------------------------------- ##
103
104 AT_SETUP([Exploding the Stack Size with Malloc])
105
106 AT_DATA_STACK_TORTURE([[#define YYSTACK_USE_ALLOCA 0]])
107
108 # Below the limit of 200.
109 AT_CHECK([./input 20], 0, [], [ignore])
110 # Two enlargements: 2 * 2 * 200.
111 AT_CHECK([./input 900], 0, [], [ignore])
112 # Fails: beyond the limit of 10,000 (which we don't reach anyway since we
113 # multiply by two starting at 200 => 5120 is the possible).
114 AT_CHECK([./input 10000], 1, [], [ignore])
115
116 AT_CLEANUP
117
118
119 ## ----------------- ##
120 ## GNU AWK Grammar. ##
121 ## ----------------- ##
122
123 AT_SETUP([GNU AWK Grammar])
124
125 # We have been careful to strip all the actions excepts the
126 # mid-rule actions. We rely on %expect to check that there are
127 # indeed 65 SR conflicts.
128 #
129 # Bison was once wrong, due to an incorrect computation of nullable.
130 # It reported 485 SR conflicts!
131
132 AT_DATA([[input.y]],
133 [[%expect 65
134
135 %token FUNC_CALL NAME REGEXP
136 %token ERROR
137 %token YNUMBER YSTRING
138 %token RELOP APPEND_OP
139 %token ASSIGNOP MATCHOP NEWLINE CONCAT_OP
140 %token LEX_BEGIN LEX_END LEX_IF LEX_ELSE LEX_RETURN LEX_DELETE
141 %token LEX_WHILE LEX_DO LEX_FOR LEX_BREAK LEX_CONTINUE
142 %token LEX_PRINT LEX_PRINTF LEX_NEXT LEX_EXIT LEX_FUNCTION
143 %token LEX_GETLINE LEX_NEXTFILE
144 %token LEX_IN
145 %token LEX_AND LEX_OR INCREMENT DECREMENT
146 %token LEX_BUILTIN LEX_LENGTH
147
148 /* Lowest to highest */
149 %right ASSIGNOP
150 %right '?' ':'
151 %left LEX_OR
152 %left LEX_AND
153 %left LEX_GETLINE
154 %nonassoc LEX_IN
155 %left FUNC_CALL LEX_BUILTIN LEX_LENGTH
156 %nonassoc ','
157 %nonassoc MATCHOP
158 %nonassoc RELOP '<' '>' '|' APPEND_OP TWOWAYIO
159 %left CONCAT_OP
160 %left YSTRING YNUMBER
161 %left '+' '-'
162 %left '*' '/' '%'
163 %right '!' UNARY
164 %right '^'
165 %left INCREMENT DECREMENT
166 %left '$'
167 %left '(' ')'
168 %%
169
170 start
171 : opt_nls program opt_nls
172 ;
173
174 program
175 : rule
176 | program rule
177 | error
178 | program error
179 | /* empty */
180 ;
181
182 rule
183 : LEX_BEGIN {} action
184 | LEX_END {} action
185 | LEX_BEGIN statement_term
186 | LEX_END statement_term
187 | pattern action
188 | action
189 | pattern statement_term
190 | function_prologue function_body
191 ;
192
193 func_name
194 : NAME
195 | FUNC_CALL
196 | lex_builtin
197 ;
198
199 lex_builtin
200 : LEX_BUILTIN
201 | LEX_LENGTH
202 ;
203
204 function_prologue
205 : LEX_FUNCTION {} func_name '(' opt_param_list r_paren opt_nls
206 ;
207
208 function_body
209 : l_brace statements r_brace opt_semi opt_nls
210 | l_brace r_brace opt_semi opt_nls
211 ;
212
213
214 pattern
215 : exp
216 | exp ',' exp
217 ;
218
219 regexp
220 /*
221 * In this rule, want_regexp tells yylex that the next thing
222 * is a regexp so it should read up to the closing slash.
223 */
224 : '/' {} REGEXP '/'
225 ;
226
227 action
228 : l_brace statements r_brace opt_semi opt_nls
229 | l_brace r_brace opt_semi opt_nls
230 ;
231
232 statements
233 : statement
234 | statements statement
235 | error
236 | statements error
237 ;
238
239 statement_term
240 : nls
241 | semi opt_nls
242 ;
243
244 statement
245 : semi opt_nls
246 | l_brace r_brace
247 | l_brace statements r_brace
248 | if_statement
249 | LEX_WHILE '(' exp r_paren opt_nls statement
250 | LEX_DO opt_nls statement LEX_WHILE '(' exp r_paren opt_nls
251 | LEX_FOR '(' NAME LEX_IN NAME r_paren opt_nls statement
252 | LEX_FOR '(' opt_exp semi opt_nls exp semi opt_nls opt_exp r_paren opt_nls statement
253 | LEX_FOR '(' opt_exp semi opt_nls semi opt_nls opt_exp r_paren opt_nls statement
254 | LEX_BREAK statement_term
255 | LEX_CONTINUE statement_term
256 | print '(' expression_list r_paren output_redir statement_term
257 | print opt_rexpression_list output_redir statement_term
258 | LEX_NEXT statement_term
259 | LEX_NEXTFILE statement_term
260 | LEX_EXIT opt_exp statement_term
261 | LEX_RETURN {} opt_exp statement_term
262 | LEX_DELETE NAME '[' expression_list ']' statement_term
263 | LEX_DELETE NAME statement_term
264 | exp statement_term
265 ;
266
267 print
268 : LEX_PRINT
269 | LEX_PRINTF
270 ;
271
272 if_statement
273 : LEX_IF '(' exp r_paren opt_nls statement
274 | LEX_IF '(' exp r_paren opt_nls statement
275 LEX_ELSE opt_nls statement
276 ;
277
278 nls
279 : NEWLINE
280 | nls NEWLINE
281 ;
282
283 opt_nls
284 : /* empty */
285 | nls
286 ;
287
288 input_redir
289 : /* empty */
290 | '<' simp_exp
291 ;
292
293 output_redir
294 : /* empty */
295 | '>' exp
296 | APPEND_OP exp
297 | '|' exp
298 | TWOWAYIO exp
299 ;
300
301 opt_param_list
302 : /* empty */
303 | param_list
304 ;
305
306 param_list
307 : NAME
308 | param_list comma NAME
309 | error
310 | param_list error
311 | param_list comma error
312 ;
313
314 /* optional expression, as in for loop */
315 opt_exp
316 : /* empty */
317 | exp
318 ;
319
320 opt_rexpression_list
321 : /* empty */
322 | rexpression_list
323 ;
324
325 rexpression_list
326 : rexp
327 | rexpression_list comma rexp
328 | error
329 | rexpression_list error
330 | rexpression_list error rexp
331 | rexpression_list comma error
332 ;
333
334 opt_expression_list
335 : /* empty */
336 | expression_list
337 ;
338
339 expression_list
340 : exp
341 | expression_list comma exp
342 | error
343 | expression_list error
344 | expression_list error exp
345 | expression_list comma error
346 ;
347
348 /* Expressions, not including the comma operator. */
349 exp : variable ASSIGNOP {} exp
350 | '(' expression_list r_paren LEX_IN NAME
351 | exp '|' LEX_GETLINE opt_variable
352 | exp TWOWAYIO LEX_GETLINE opt_variable
353 | LEX_GETLINE opt_variable input_redir
354 | exp LEX_AND exp
355 | exp LEX_OR exp
356 | exp MATCHOP exp
357 | regexp
358 | '!' regexp %prec UNARY
359 | exp LEX_IN NAME
360 | exp RELOP exp
361 | exp '<' exp
362 | exp '>' exp
363 | exp '?' exp ':' exp
364 | simp_exp
365 | exp simp_exp %prec CONCAT_OP
366 ;
367
368 rexp
369 : variable ASSIGNOP {} rexp
370 | rexp LEX_AND rexp
371 | rexp LEX_OR rexp
372 | LEX_GETLINE opt_variable input_redir
373 | regexp
374 | '!' regexp %prec UNARY
375 | rexp MATCHOP rexp
376 | rexp LEX_IN NAME
377 | rexp RELOP rexp
378 | rexp '?' rexp ':' rexp
379 | simp_exp
380 | rexp simp_exp %prec CONCAT_OP
381 ;
382
383 simp_exp
384 : non_post_simp_exp
385 /* Binary operators in order of decreasing precedence. */
386 | simp_exp '^' simp_exp
387 | simp_exp '*' simp_exp
388 | simp_exp '/' simp_exp
389 | simp_exp '%' simp_exp
390 | simp_exp '+' simp_exp
391 | simp_exp '-' simp_exp
392 | variable INCREMENT
393 | variable DECREMENT
394 ;
395
396 non_post_simp_exp
397 : '!' simp_exp %prec UNARY
398 | '(' exp r_paren
399 | LEX_BUILTIN
400 '(' opt_expression_list r_paren
401 | LEX_LENGTH '(' opt_expression_list r_paren
402 | LEX_LENGTH
403 | FUNC_CALL '(' opt_expression_list r_paren
404 | variable
405 | INCREMENT variable
406 | DECREMENT variable
407 | YNUMBER
408 | YSTRING
409 | '-' simp_exp %prec UNARY
410 | '+' simp_exp %prec UNARY
411 ;
412
413 opt_variable
414 : /* empty */
415 | variable
416 ;
417
418 variable
419 : NAME
420 | NAME '[' expression_list ']'
421 | '$' non_post_simp_exp
422 ;
423
424 l_brace
425 : '{' opt_nls
426 ;
427
428 r_brace
429 : '}' opt_nls
430 ;
431
432 r_paren
433 : ')'
434 ;
435
436 opt_semi
437 : /* empty */
438 | semi
439 ;
440
441 semi
442 : ';'
443 ;
444
445 comma : ',' opt_nls
446 ;
447
448 %%
449 ]])
450
451 # Pass plenty of options, to exercise plenty of code, even if we
452 # don't actually check the output. But SEGV is watching us, and
453 # so might do dmalloc.
454 AT_CHECK([[bison --verbose --defines input.y]])
455
456 AT_CLEANUP
457
458
459 ## ----------------- ##
460 ## GNU Cim Grammar. ##
461 ## ----------------- ##
462
463 AT_SETUP([GNU Cim Grammar])
464
465 # GNU Cim, the GNU Simula 87 Compiler.
466
467 # Bison was once wrong, due to an incorrect computation of the RR conflicts.
468 # It reported 80 SR && 99 RR conflicts instead of 78/10!!!
469
470 AT_DATA([[input.y]],
471 [[%union {
472 long token;
473 long ival;
474 long arrdim;
475 double rval;
476 char *ident;
477 char *tval;
478 char stat_decl;
479 }
480
481 %token
482 HACTIVATE HAFTER /*HAND*/ HARRAY HAT
483 HBEFORE HBEGIN HBOOLEAN
484 HCHARACTER HCLASS /*HCOMMENT*/ HCONC
485 HDELAY HDO
486 HELSE HEND HEQ /*HEQV*/ HEXTERNAL
487 HFOR
488 HGE HGO HGOTO HGT
489 HHIDDEN
490 HIF /*HIMP*/ HIN HINNER HINSPECT HINTEGER HIS
491 HLABEL HLE HLONG HLT
492 HNAME HNE HNEW HNONE /*HNOT*/ HNOTEXT
493 /*HOR*/ HOTHERWISE
494 HPRIOR HPROCEDURE HPROTECTED
495 HQUA
496 HREACTIVATE HREAL HREF
497 HSHORT HSTEP HSWITCH
498 HTEXT HTHEN HTHIS HTO
499 HUNTIL
500 HVALUE HVAR HVIRTUAL
501 HWHEN HWHILE
502
503 HASSIGNVALUE HASSIGNREF
504 /*HDOT*/ HPAREXPSEPARATOR HLABELSEPARATOR HSTATEMENTSEPARATOR
505 HBEGPAR HENDPAR
506 HEQR HNER
507 HADD HSUB HMUL HDIV HINTDIV HEXP
508 HDOTDOTDOT
509
510 %token <ident> HIDENTIFIER
511 %token <ival> HBOOLEANKONST HINTEGERKONST HCHARACTERKONST
512 %token <rval> HREALKONST
513 %token <tval> HTEXTKONST
514
515 %type <tval> EXT_IDENT
516 %type <stat_decl> DECLSTATEMENT MODULSTATEMENT MBEE_DECLSTMS MBEE_DECLSTMSU
517 %type <stat_decl> MODULS
518 %type <ident> EXPRESSION_SIMP MBEE_ARG_R_PT
519 %type <arrdim> BAUND_PAIR_LIST
520
521 %right <token> HASSIGN
522 %left HORELSE
523 %left HANDTHEN
524 %left HEQV
525 %left HIMP
526 %left HOR
527 %left HAND
528
529 %left HNOT
530
531 %left <token> HVALRELOPERATOR HREFRELOPERATOR HOBJRELOPERATOR
532
533 %left HCONC
534
535 %left <token> HTERMOPERATOR
536 %left <token> UNEAR
537 %left <token> HFACTOROPERATOR
538 %left HPRIMARYOPERATOR
539
540 %left HQUA
541
542 %left HDOT
543
544 %start MAIN_MODULE
545 %%
546 /* GRAMATIKK FOR PROGRAM MODULES */
547 MAIN_MODULE : { categ=CLOCAL; mout(MBLOCK);
548 beginBlock(KBLOKK);separat_comp=FALSE;}
549 MODULS { endBlock(NULL,CCNO); mout(MENDBLOCK);}
550 | error HSTATEMENTSEPARATOR MBEE_DECLSTMS
551 ;
552 EXT_DECLARATION : HEXTERNAL
553 MBEE_TYPE
554 HPROCEDURE
555 { MBEENEWBLOCK();
556 kind=KPROC;}
557 EXT_LIST
558 |
559 HEXTERNAL
560 HIDENTIFIER
561 HPROCEDURE
562 { MBEENEWBLOCK();
563 type=TNOTY;
564 kind=KPROC;
565 if($2==Ckind)categ=CCPROC;else
566 yerror (1);
567 ysensitive=sensitive;
568 sensitive=ON;}
569 HIDENTIFIER { $<ident>$=$5;
570 sensitive=ysensitive;}
571 EXTERNAL_KIND_ITEM
572 { categ=CLOCAL;}
573 | HEXTERNAL
574 HCLASS
575 { MBEENEWBLOCK();
576 kind=KCLASS;}
577 EXT_LIST
578
579 ;
580 EXTERNAL_KIND_ITEM: EXT_IDENT
581 HOBJRELOPERATOR
582 { if($2!=HIS)yerror (2);}
583 MBEE_TYPE HPROCEDURE
584 HIDENTIFIER
585 { regDecl($6, type, KPROC, CCPROC);
586 beginBlock(kind);}
587 HEADING EMPTY_BLOCK
588 { categ=CLOCAL;
589 endBlock($1==NULL?$<ident>0:tag($1),CCCPROC);}
590 /* |
591 EXT_IDENT
592 { if($1!=NULL)yerror (3);
593 regDecl($0, type, kind, categ);}
594 MBEE_REST_EXT_LIST
595 { endBlock(NULL,CCNO);}
596 ;
597 MBEE_REST_EXT_LIST: /* EMPTY
598 | HPAREXPSEPARATOR EXT_KIND_LIST
599 ;
600 EXT_KIND_LIST : EXT_KIND_ITEM
601 | EXT_KIND_LIST HPAREXPSEPARATOR EXT_KIND_ITEM
602 ;
603 EXT_KIND_ITEM : HIDENTIFIER
604 EXT_IDENT
605 { if($2!=NULL)yerror (3);
606 regDecl($1, type, kind, categ);}*/
607 ;
608 EMPTY_BLOCK : /*EMPT*/
609 | HBEGIN HEND
610 ;
611 EXT_LIST : EXT_ITEM
612 | EXT_LIST HPAREXPSEPARATOR EXT_ITEM
613 ;
614 EXT_ITEM : HIDENTIFIER
615 EXT_IDENT
616 { lesinn_external_spec($1,$2, kind);}
617 ;
618 EXT_IDENT : /* EMPTY */ { $$=NULL;}
619 | HVALRELOPERATOR { if($1!=HEQ)yerror (9);
620 external=TRUE;}
621 HTEXTKONST { $$=$3;external=FALSE;}
622 ;
623 /* GRAMATIKK FOR TYPER */
624 NO_TYPE : /*EMPT*/ { type=TNOTY;}
625 ;
626 MBEE_TYPE : NO_TYPE
627 | TYPE
628 ;
629 TYPE : HREF HBEGPAR
630 HIDENTIFIER
631 { prefquantident=$3;
632 type=TREF;}
633 HENDPAR
634 | HTEXT { type=TTEXT;}
635 | HBOOLEAN { type=TBOOL;}
636 | HCHARACTER { type=TCHAR;}
637 | HSHORT HINTEGER { type=TSHORT;}
638 | HINTEGER { type=TINTG;}
639 | HREAL { type=TREAL;}
640 | HLONG HREAL { type=TLONG;}
641 ;
642
643 /* GRAMATIKK FOR DEL AV SETNINGER */
644 MBEE_ELSE_PART : /*EMPT*/
645 /* | HELSE
646 HIF
647 EXPRESSION
648 HTHEN { mout(MELSE);
649 mout(MIF);
650 OBSBLOCK();}
651 BLOCK { MBEEENDBLOCK();}
652 MBEE_ELSE_PART { mout(MENDIF);}*/
653 | HELSE { OBSBLOCK(); mout(MELSE);}
654 BLOCK { MBEEENDBLOCK();}
655 ;
656 FOR_LIST : FOR_LIST_ELEMENT { mout(MENDSEP);
657 mout(MLISTSEP);}
658 | FOR_LIST_ELEMENT
659 HPAREXPSEPARATOR
660 FOR_LIST { mout(MLISTSEP);}
661 ;
662 FOR_LIST_ELEMENT: EXPRESSION
663 MBEE_F_L_EL_R_PT
664 ;
665 MBEE_F_L_EL_R_PT: /*EMPT*/
666 | HWHILE
667 EXPRESSION { mout(MFORWHILE);}
668 | HSTEP
669 EXPRESSION
670 HUNTIL
671 EXPRESSION { mout(MUNTIL);
672 mout(MSTEP);}
673 ;
674 GOTO : HGO
675 HTO
676 | HGOTO
677 ;
678 CONN_STATE_R_PT : WHEN_CLAUSE_LIST
679 | HDO { beginBlock(KCON); mout(MDO);
680 OBSBLOCK(); }
681 BLOCK { endBlock(NULL,CCNO);
682 MBEEENDBLOCK(); mout(MENDDO);}
683 ;
684 WHEN_CLAUSE_LIST: HWHEN
685 HIDENTIFIER
686 HDO { beginBlock(KCON); mout(MIDENTIFIER);
687 OBSBLOCK(); moutId($2);
688 mout(MWHEN);}
689 BLOCK { endBlock(NULL,CCNO);
690 MBEEENDBLOCK(); mout(MENDWHEN);}
691 | WHEN_CLAUSE_LIST
692 HWHEN
693 HIDENTIFIER
694 HDO { beginBlock(KCON); mout(MIDENTIFIER);
695 OBSBLOCK(); moutId($3);
696 mout(MWHEN);}
697 BLOCK { endBlock(NULL,CCNO);
698 MBEEENDBLOCK(); mout(MENDWHEN);}
699 ;
700 MBEE_OTWI_CLAUS : /*EMPT*/
701 | HOTHERWISE {OBSBLOCK(); mout(MOTHERWISE);}
702
703 BLOCK {MBEEENDBLOCK();mout(MENDOTHERWISE);}
704 ;
705 ACTIVATOR : HACTIVATE { mout(MBOOLEANKONST);
706 moutIval(FALSE);}
707 | HREACTIVATE { mout(MBOOLEANKONST);
708 moutIval(TRUE);}
709 ;
710 SCHEDULE : /*EMPT*/ { mout(MCHARACTERKONST);
711 moutIval(DIRECT);
712 mout(MINTEGERKONST);
713 moutIval(0);
714 mout(MNONE);
715 mout(MBOOLEANKONST);
716 moutIval(FALSE);}
717 | ATDELAY EXPRESSION { mout(MNONE);}
718 PRIOR
719 | BEFOREAFTER { mout(MINTEGERKONST);
720 moutIval(0);}
721 EXPRESSION { mout(MBOOLEANKONST);
722 moutIval(FALSE);}
723 ;
724 ATDELAY : HAT { mout(MCHARACTERKONST);
725 moutIval(AT);}
726 | HDELAY { mout(MCHARACTERKONST);
727 moutIval(DELAYS);}
728 ;
729 BEFOREAFTER : HBEFORE { mout(MCHARACTERKONST);
730 moutIval(BEFORE);}
731 | HAFTER { mout(MCHARACTERKONST);
732 moutIval(AFTER);}
733 ;
734 PRIOR : /*EMPT*/ { mout(MBOOLEANKONST);
735 moutIval(FALSE);}
736 | HPRIOR { mout(MBOOLEANKONST);
737 moutIval(TRUE);}
738 ;
739 /* GRAMATIKK FOR SETNINGER OG DEKLARASJONER */
740 MODULSTATEMENT : HWHILE
741 EXPRESSION
742 HDO { STOPOBSBLOCK(); mout(MWHILE);
743 OBSBLOCK();}
744 BLOCK { MBEEENDBLOCK(); mout(MENDWHILE);
745 $$=STATEMENT;}
746 | HIF
747 EXPRESSION
748 HTHEN { STOPOBSBLOCK(); mout(MIF);
749 OBSBLOCK();}
750 BLOCK { MBEEENDBLOCK();}
751 MBEE_ELSE_PART { mout(MENDIF);
752 $$=STATEMENT;}
753 | HFOR
754 HIDENTIFIER
755 HASSIGN { STOPOBSBLOCK(); mout(MIDENTIFIER);
756 moutId($2);}
757 FOR_LIST
758 HDO { beginBlock(KFOR);
759 if($3==HASSIGNVALUE) mout(MFOR);
760 else mout(MFORR);
761 OBSBLOCK(); mout(MFORDO);}
762 BLOCK { MBEEENDBLOCK();
763 endBlock(NULL,CCNO); mout(MENDFOR);
764 $$=STATEMENT;}
765 | GOTO
766 EXPRESSION { mout(MGOTO);
767 STOPOBSBLOCK(); $$=STATEMENT;}
768 | HINSPECT
769 EXPRESSION { mout(MINSPECT);
770 STOPOBSBLOCK();
771 beginBlock(KINSP);}
772 CONN_STATE_R_PT
773 { endBlock(NULL,CCNO);}
774 MBEE_OTWI_CLAUS { mout(MENDINSPECT);
775 $$=STATEMENT;}
776 | HINNER { STOPOBSBLOCK(); mout(MINNER);
777 regInner(); $$=STATEMENT;}
778 | HIDENTIFIER
779 HLABELSEPARATOR
780 { STOPOBSBLOCK();
781 regDecl($1, TLABEL, KSIMPLE, categ); mout(MLABEL);
782 moutId($1);
783 mout(MENDLABEL);}
784 DECLSTATEMENT { if($4<=DECLARATION)
785 { yerror (27);
786 $$=DECLARATION;}
787 else $$=$4;}
788 | EXPRESSION_SIMP
789 HBEGIN
790 { $<ident>$=$1; }
791 IMPORT_SPEC_MODULE
792 { mout(MPRBLOCK);
793 prefquantident=$1;
794 beginBlock(KPRBLK);}
795 MBEE_DECLSTMS
796 HEND { endBlock(NULL,CCNO); mout(MENDPRBLOCK);
797 $$=STATEMENT;}
798 | EXPRESSION_SIMP HBEGIN error HSTATEMENTSEPARATOR
799 MBEE_DECLSTMS HEND { $$=STATEMENT;
800 endBlock(NULL,CCNO); mout(MENDPRBLOCK);}
801 | EXPRESSION_SIMP HBEGIN error HEND
802 { $$=STATEMENT;
803 endBlock(NULL,CCNO); mout(MENDPRBLOCK);}
804
805 | EXPRESSION_SIMP
806 { STOPOBSBLOCK(); $$=STATEMENT;
807 mout(MENDASSIGN);}
808 | ACTIVATOR EXPRESSION SCHEDULE
809 { $$=STATEMENT;
810 mout(MENDSEP);
811 mout(MARGUMENTSEP);
812 mout(MARGUMENTSEP);
813 mout(MARGUMENTSEP);
814 mout(MARGUMENTSEP);
815 mout(MARGUMENTSEP);
816 mout(MARGUMENTSEP);
817 mout(MARGUMENT);
818 moutId(activateid);
819 mout(MENDASSIGN);}
820 | HBEGIN
821 { STOPOBSBLOCK();
822 OBSBLOCK();}
823 MBEE_DECLSTMS
824 HEND { MBEEENDBLOCK(); $$=STATEMENT;}
825 | MBEE_TYPE HPROCEDURE
826 HIDENTIFIER
827 { MBEENEWBLOCK(); mout(MPROCEDURE);
828 regDecl($3, type, KPROC, categ);
829 beginBlock(KPROC);}
830 HEADING BLOCK { endBlock(NULL,CCNO); $$=DECLARATION;
831 mout(MENDPROCEDURE);}
832 | HIDENTIFIER
833 HCLASS
834 NO_TYPE
835 { $<ident>$=$1; }
836 IMPORT_SPEC_MODULE
837 HIDENTIFIER
838 { prefquantident=$1;
839 mout(MCLASS);
840 regDecl($6, TNOTY, KCLASS, categ);
841 beginBlock(KCLASS);}
842 HEADING
843 BLOCK { endBlock(NULL,CCNO); $$=DECLARATION;
844 mout(MENDCLASS);}
845 | HCLASS
846 NO_TYPE
847 HIDENTIFIER
848 { prefquantident=0;
849 MBEENEWBLOCK(); mout(MCLASS);
850 regDecl($3, TNOTY, KCLASS, categ);
851 beginBlock(KCLASS);}
852 HEADING
853 BLOCK { endBlock(NULL,CCNO); $$=DECLARATION;
854 mout(MENDCLASS);}
855 | EXT_DECLARATION { $$=EXTDECLARATION;}
856 | /*EMPT*/{ STOPOBSBLOCK(); $$=EMPTYSTATEMENT;}
857 ;
858 IMPORT_SPEC_MODULE: { MBEENEWBLOCK();
859 kind=KCLASS;
860 if($<ident>0==simsetident &&
861 findDecl(simsetident,cblock,FALSE)==NULL)
862 lesinn_external_spec(simsetident,
863 SIMSETATRFILE, kind);
864 if($<ident>0==simulationident && findDecl(
865 simulationident,cblock,FALSE)==NULL)
866 lesinn_external_spec(simulationident,
867 SIMULATIONATRFILE, kind);
868 if(($<ident>0==fileident && findDecl(
869 fileident,cblock,FALSE)==NULL) ||
870 ($<ident>0==outfileident && findDecl(
871 outfileident,cblock,FALSE)==NULL) ||
872 ($<ident>0==infileident && findDecl(
873 infileident,cblock,FALSE)==NULL) ||
874 ($<ident>0==directfileident && findDecl(
875 directfileident,cblock,FALSE)==NULL) ||
876 ($<ident>0==printfileident && findDecl(
877 printfileident,cblock,FALSE)==NULL) ||
878 ($<ident>0==bytefileident && findDecl(
879 bytefileident,cblock,FALSE)==NULL) ||
880 ($<ident>0==inbytefileident && findDecl(
881 inbytefileident,cblock,FALSE)==NULL) ||
882 ($<ident>0==outbytefileident && findDecl(
883 outbytefileident,cblock,FALSE)==NULL) ||
884 ($<ident>0==directbytefileident && findDecl(
885 directbytefileident,cblock,FALSE)==NULL))
886 lesinn_external_spec(fileident,
887 FILEATRFILE, kind);}
888 ;
889 DECLSTATEMENT : MODULSTATEMENT
890 | TYPE
891 HIDENTIFIER
892 MBEE_CONSTANT
893 HPAREXPSEPARATOR
894 { MBEENEWBLOCK();
895 kind=KSIMPLE;
896 regDecl($2, type, KSIMPLE, categ);
897 categ=CLOCAL;}
898 IDENTIFIER_LISTC { $$=DECLARATION;}
899 | TYPE
900 HIDENTIFIER
901 MBEE_CONSTANT
902 { MBEENEWBLOCK();
903 regDecl($2, type, KSIMPLE, categ);
904 categ=CLOCAL; $$=DECLARATION;}
905 | MBEE_TYPE
906 HARRAY { MBEENEWBLOCK();
907 kind=KARRAY;}
908 ARR_SEGMENT_LIST { $$=DECLARATION;}
909 | HSWITCH
910 HIDENTIFIER
911 HASSIGN { MBEENEWBLOCK(); mout(MIDENTIFIER);
912 moutId($2);
913 regDecl($2, TLABEL, KARRAY, categ);}
914 SWITCH_LIST { $$=DECLARATION;
915 mout(MSWITCH);
916 mout(MENDSWITCH);}
917 ;
918 BLOCK : DECLSTATEMENT { if($1<=DECLARATION)yerror (29);}
919 | HBEGIN MBEE_DECLSTMS HEND
920 | HBEGIN error HSTATEMENTSEPARATOR MBEE_DECLSTMS HEND
921 | HBEGIN error HEND
922 ;
923 MBEE_DECLSTMS : MBEE_DECLSTMSU { if($1<=DECLARATION)yerror (28);
924 $$=$1;}
925 ;
926 MBEE_DECLSTMSU : DECLSTATEMENT { $$=$1;}
927 | MBEE_DECLSTMSU
928 HSTATEMENTSEPARATOR
929 DECLSTATEMENT { if($1>=STATEMENT && $3<=DECLARATION)
930 yerror (26);
931 $$=$3;}
932 ;
933 MODULS : MODULSTATEMENT { if($1==DECLARATION)
934 {separat_comp=TRUE;gettimestamp();}
935 $$=$1;}
936 | MODULS HSTATEMENTSEPARATOR MODULSTATEMENT
937 { if($1>=STATEMENT && $3<=DECLARATION)
938 yerror (26);else
939 if($1>=STATEMENT
940 && $3!=EMPTYSTATEMENT)yerror (25);
941 if(separat_comp && $3==STATEMENT)
942 yerror (25);
943 if($3==DECLARATION && !separat_comp)
944 {separat_comp=TRUE;gettimestamp();}
945 $$=$3;}
946 ;
947 /* GRAMATIKK FOR DEL AV DEKLARASJONER */
948 ARR_SEGMENT_LIST: ARR_SEGMENT
949 | ARR_SEGMENT_LIST
950 HPAREXPSEPARATOR
951 ARR_SEGMENT
952 ;
953 ARR_SEGMENT : ARRAY_SEGMENT
954 HBEGPAR
955 BAUND_PAIR_LIST HENDPAR { mout(MARRAY);
956 mout(MENDARRAY);
957 setArrayDim($3);}
958 ;
959 ARRAY_SEGMENT : ARRAY_SEGMENT_EL { mout(MENDSEP);
960 mout(MARRAYSEP);}
961
962 | ARRAY_SEGMENT_EL
963 HPAREXPSEPARATOR
964 ARRAY_SEGMENT { mout(MARRAYSEP);}
965 ;
966 ARRAY_SEGMENT_EL: HIDENTIFIER { mout(MIDENTIFIER);
967 moutId($1);
968 regDecl($1, type, kind, categ);
969 if(lastArray==NULL)
970 lastArray=cblock->lastparloc;}
971 ;
972 BAUND_PAIR_LIST : BAUND_PAIR { mout(MENDSEP);
973 mout(MBOUNDSEP);
974 $$=1;}
975 | BAUND_PAIR
976 HPAREXPSEPARATOR
977 BAUND_PAIR_LIST { mout(MBOUNDSEP);
978 $$=$3+1;}
979 ;
980 BAUND_PAIR : EXPRESSION
981 HLABELSEPARATOR
982 EXPRESSION { mout(MBOUNDPARSEP);}
983 ;
984 SWITCH_LIST : EXPRESSION { mout(MENDSEP);
985 mout(MSWITCHSEP);}
986 | EXPRESSION
987 HPAREXPSEPARATOR
988 SWITCH_LIST { mout(MSWITCHSEP);}
989 ;
990 HEADING : MBEE_FMAL_PAR_P HSTATEMENTSEPARATOR { kind=KNOKD;}
991 MBEE_MODE_PART { categ=CSPEC;}
992 MBEE_SPEC_PART { kind=KNOKD;}
993 MBEE_PROT_PART { categ=CVIRT;}
994 MBEE_VIRT_PART
995 { categ=CLOCAL;}
996 ;
997 MBEE_FMAL_PAR_P : /*EMPT*/
998 | FMAL_PAR_PART
999 ;
1000 FMAL_PAR_PART : HBEGPAR NO_TYPE
1001 MBEE_LISTV HENDPAR
1002 ;
1003 MBEE_LISTV : /*EMPT*/
1004 | LISTV
1005 ;
1006 LISTV : HIDENTIFIER { regDecl($1, type, KNOKD, CDEFLT);}
1007 | FPP_CATEG HDOTDOTDOT { regDecl(varargsid, TVARARGS, KNOKD, categ);}
1008 | HIDENTIFIER { regDecl($1, type, KNOKD, CDEFLT);}
1009 HPAREXPSEPARATOR LISTV
1010 | FPP_SPEC
1011 | FPP_SPEC
1012 HPAREXPSEPARATOR LISTV
1013 ;
1014 FPP_HEADING : HBEGPAR NO_TYPE
1015 FPP_MBEE_LISTV HENDPAR
1016 ;
1017 FPP_MBEE_LISTV : /*EMPT*/
1018 | FPP_LISTV
1019 ;
1020 FPP_LISTV : FPP_CATEG HDOTDOTDOT { regDecl(varargsid, TVARARGS, KNOKD, categ);}
1021 | FPP_SPEC
1022 | FPP_SPEC
1023 HPAREXPSEPARATOR LISTV
1024 ;
1025 FPP_SPEC : FPP_CATEG SPECIFIER HIDENTIFIER
1026 { regDecl($3, type, kind, categ);}
1027 | FPP_CATEG FPP_PROC_DECL_IN_SPEC
1028 ;
1029 FPP_CATEG : HNAME HLABELSEPARATOR
1030 { categ=CNAME;}
1031 | HVALUE HLABELSEPARATOR
1032 { categ=CVALUE;}
1033 | HVAR HLABELSEPARATOR
1034 { categ=CVAR;}
1035 | /*EMPT*/ { categ=CDEFLT;}
1036 ;
1037 FPP_PROC_DECL_IN_SPEC: MBEE_TYPE HPROCEDURE
1038 HIDENTIFIER
1039 { $<ival>$=categ;
1040 regDecl($3, type, KPROC, categ);
1041 beginBlock(KPROC);}
1042 FPP_HEADING
1043 { categ=$<ival>4; /* M} settes tilbake*/}
1044 { endBlock(NULL,CCNO);}
1045 ;
1046 IDENTIFIER_LISTV: HIDENTIFIER { regDecl($1, type, kind, categ);}
1047 | HDOTDOTDOT { regDecl(varargsid, TVARARGS, kind, categ);}
1048 | HIDENTIFIER { regDecl($1, type, kind, categ);}
1049 HPAREXPSEPARATOR IDENTIFIER_LISTV
1050 ;
1051 MBEE_MODE_PART : /*EMPT*/
1052 | MODE_PART
1053 ;
1054 MODE_PART : NAME_PART
1055 | VALUE_PART
1056 | VAR_PART
1057 | NAME_PART VALUE_PART
1058 | VALUE_PART NAME_PART
1059 | NAME_PART VAR_PART
1060 | VAR_PART NAME_PART
1061 | VALUE_PART VAR_PART
1062 | VAR_PART VALUE_PART
1063 | VAR_PART NAME_PART VALUE_PART
1064 | NAME_PART VAR_PART VALUE_PART
1065 | NAME_PART VALUE_PART VAR_PART
1066 | VAR_PART VALUE_PART NAME_PART
1067 | VALUE_PART VAR_PART NAME_PART
1068 | VALUE_PART NAME_PART VAR_PART
1069 ;
1070 NAME_PART : HNAME { categ=CNAME;}
1071 IDENTIFIER_LISTV
1072 HSTATEMENTSEPARATOR
1073 ;
1074 VAR_PART : HVAR { categ=CVAR;}
1075 IDENTIFIER_LISTV
1076 HSTATEMENTSEPARATOR
1077 ;
1078 VALUE_PART : HVALUE { categ=CVALUE;}
1079 IDENTIFIER_LISTV HSTATEMENTSEPARATOR
1080 ;
1081 MBEE_SPEC_PART : /*EMPT*/
1082 | SPEC_PART
1083 ;
1084 SPEC_PART : ONE_SPEC
1085 | SPEC_PART ONE_SPEC
1086 ;
1087 ONE_SPEC : SPECIFIER IDENTIFIER_LIST HSTATEMENTSEPARATOR
1088 | NO_TYPE HPROCEDURE HIDENTIFIER HOBJRELOPERATOR
1089 { if($4!=HIS) yerror (8);}
1090 PROC_DECL_IN_SPEC HSTATEMENTSEPARATOR
1091 | FPP_PROC_DECL_IN_SPEC HSTATEMENTSEPARATOR
1092 | MBEE_TYPE HPROCEDURE HIDENTIFIER HSTATEMENTSEPARATOR
1093 { yerror (45);}
1094 | MBEE_TYPE HPROCEDURE HIDENTIFIER HPAREXPSEPARATOR
1095 IDENTIFIER_LIST HSTATEMENTSEPARATOR
1096 { yerror (45);}
1097 ;
1098 SPECIFIER : TYPE { kind=KSIMPLE;}
1099 | MBEE_TYPE
1100 HARRAY { kind=KARRAY;}
1101 | HLABEL { type=TLABEL;
1102 kind=KSIMPLE;}
1103 | HSWITCH { type=TLABEL;
1104 kind=KARRAY;}
1105 ;
1106 PROC_DECL_IN_SPEC: MBEE_TYPE HPROCEDURE
1107 HIDENTIFIER
1108 { $<ival>$=categ;
1109 regDecl($3, type, KPROC, categ);
1110 beginBlock(KPROC);}
1111 HEADING
1112 { categ=$<ival>4; /* M} settes tilbake*/}
1113 MBEE_BEGIN_END
1114 { endBlock(NULL,CCNO);}
1115 ;
1116 MBEE_BEGIN_END : /* EMPTY */
1117 | HBEGIN HEND
1118 ;
1119 MBEE_PROT_PART : /*EMPT*/
1120 | PROTECTION_PART
1121 ;
1122 PROTECTION_PART : PROT_SPECIFIER IDENTIFIER_LIST
1123 HSTATEMENTSEPARATOR
1124 | PROTECTION_PART PROT_SPECIFIER
1125 IDENTIFIER_LIST HSTATEMENTSEPARATOR
1126 ;
1127 PROT_SPECIFIER : HHIDDEN { categ=CHIDEN;}
1128 | HPROTECTED { categ=CPROT;}
1129 | HHIDDEN
1130 HPROTECTED { categ=CHIPRO;}
1131 | HPROTECTED
1132 HHIDDEN { categ=CHIPRO;}
1133 ;
1134 MBEE_VIRT_PART : /*EMPT*/
1135 | VIRTUAL_PART
1136 ;
1137 VIRTUAL_PART : HVIRTUAL
1138 HLABELSEPARATOR
1139 MBEE_SPEC_PART
1140 ;
1141 IDENTIFIER_LIST : HIDENTIFIER { regDecl($1, type, kind, categ);}
1142 | IDENTIFIER_LIST HPAREXPSEPARATOR
1143 HIDENTIFIER { regDecl($3, type, kind, categ);}
1144 ;
1145 IDENTIFIER_LISTC: HIDENTIFIER
1146 MBEE_CONSTANT { regDecl($1, type, kind, categ);
1147 categ=CLOCAL;}
1148 | IDENTIFIER_LISTC HPAREXPSEPARATOR
1149 HIDENTIFIER
1150 MBEE_CONSTANT { regDecl($3, type, kind, categ);
1151 categ=CLOCAL;}
1152 ;
1153 MBEE_CONSTANT : /* EMPTY */
1154 | HVALRELOPERATOR
1155 { MBEENEWBLOCK();
1156 if($1!=HEQ) yerror (8);
1157 if(type==TREF)yerror (7);
1158 categ=CCONSTU;
1159 mout(MIDENTIFIER);
1160 moutId($<token>0);}
1161 EXPRESSION { mout(MASSIGN);
1162 mout(MCONST);}
1163 ;
1164
1165 /* GRAMATIKK FOR UTTRYKK */
1166 EXPRESSION : EXPRESSION_SIMP {}
1167 | HIF
1168 EXPRESSION
1169 HTHEN
1170 EXPRESSION
1171 HELSE
1172 EXPRESSION { mout(MELSEE);
1173 mout(MIFE);}
1174 ;
1175 EXPRESSION_SIMP : EXPRESSION_SIMP
1176 HASSIGN
1177 EXPRESSION { if($2==HASSIGNREF)mout(MASSIGNR);
1178 else mout(MASSIGN);$$=NULL;}
1179 |
1180
1181 EXPRESSION_SIMP
1182 HCONC
1183 EXPRESSION_SIMP { mout(MCONC);$$=NULL;}
1184 | EXPRESSION_SIMP HOR
1185 HELSE
1186 EXPRESSION_SIMP
1187 %prec HORELSE { mout(MORELSEE);$$=NULL;}
1188 | EXPRESSION_SIMP HAND
1189 HTHEN
1190 EXPRESSION_SIMP
1191 %prec HANDTHEN { mout(MANDTHENE);$$=NULL;}
1192 | EXPRESSION_SIMP
1193 HEQV EXPRESSION_SIMP { mout(MEQV);$$=NULL;}
1194 | EXPRESSION_SIMP
1195 HIMP EXPRESSION_SIMP { mout(MIMP);$$=NULL;}
1196 | EXPRESSION_SIMP
1197 HOR EXPRESSION_SIMP { mout(MOR);$$=NULL;}
1198 | EXPRESSION_SIMP
1199 HAND EXPRESSION_SIMP { mout(MAND);$$=NULL;}
1200 | HNOT EXPRESSION_SIMP { mout(MNOT);$$=NULL;}
1201 | EXPRESSION_SIMP
1202 HVALRELOPERATOR
1203 EXPRESSION_SIMP
1204 { switch($2)
1205 { case HEQ: mout(MEQ);break;
1206 case HNE: mout(MNE);break;
1207 case HLT: mout(MLT);break;
1208 case HLE: mout(MLE);break;
1209 case HGT: mout(MGT);break;
1210 case HGE: mout(MGE);break;
1211 }$$=NULL;}
1212 | EXPRESSION_SIMP
1213 HREFRELOPERATOR
1214 EXPRESSION_SIMP
1215 { if($2==HNER) mout(MNER);
1216 else mout(MEQR);$$=NULL;}
1217 | EXPRESSION_SIMP
1218 HOBJRELOPERATOR
1219 EXPRESSION_SIMP
1220 { if($2==HIS) mout(MIS);
1221 else mout(MINS);$$=NULL;}
1222 | HTERMOPERATOR
1223 EXPRESSION_SIMP %prec UNEAR
1224 { if($1==HADD) mout(MUADD);
1225 else mout(MUSUB);$$=NULL;}
1226 | EXPRESSION_SIMP
1227 HTERMOPERATOR
1228 EXPRESSION_SIMP
1229 { if($2==HADD) mout(MADD);
1230 else mout(MSUB);$$=NULL;}
1231 | EXPRESSION_SIMP
1232 HFACTOROPERATOR
1233 EXPRESSION_SIMP
1234 { if($2==HMUL) mout(MMUL); else
1235 if($2==HDIV) mout(MDIV);
1236 else mout(MINTDIV);$$=NULL;}
1237 | EXPRESSION_SIMP
1238 HPRIMARYOPERATOR
1239 EXPRESSION_SIMP { mout(MPRIMARY);$$=NULL;}
1240 | HBEGPAR
1241 EXPRESSION HENDPAR { mout(MNOOP);$$=NULL;}
1242 | HTEXTKONST { mout(MTEXTKONST);
1243 moutTval($1);$$=NULL;}
1244 | HCHARACTERKONST { mout(MCHARACTERKONST);
1245 moutIval($1);$$=NULL;}
1246 | HREALKONST { mout(MREALKONST);
1247 moutRval($1);$$=NULL;}
1248 | HINTEGERKONST { mout(MINTEGERKONST);
1249 moutIval($1);$$=NULL;}
1250 | HBOOLEANKONST { mout(MBOOLEANKONST);
1251 moutIval($1);$$=NULL;}
1252 | HNONE { mout(MNONE);$$=NULL;}
1253 | HIDENTIFIER
1254 { $<ident>$=$1;}
1255 MBEE_ARG_R_PT
1256 | HTHIS HIDENTIFIER { mout(MTHIS);
1257 moutId($2);$$=NULL;}
1258 | HNEW
1259 HIDENTIFIER
1260 ARG_R_PT { mout(MNEWARG);
1261 moutId($2);$$=NULL;}
1262 | EXPRESSION_SIMP
1263 HDOT
1264 EXPRESSION_SIMP { mout(MDOT);$$=NULL;}
1265 | EXPRESSION_SIMP
1266 HQUA HIDENTIFIER { mout(MQUA);
1267 moutId($3);$$=NULL;}
1268 ;
1269 ARG_R_PT : /*EMPTY*/ { mout(MENDSEP);}
1270 | HBEGPAR
1271 ARGUMENT_LIST HENDPAR
1272 ;
1273 MBEE_ARG_R_PT : /*EMPTY*/ { mout(MIDENTIFIER);
1274 moutId($<ident>0);
1275 $$=$<ident>0;}
1276 | HBEGPAR
1277 ARGUMENT_LIST HENDPAR { mout(MARGUMENT);
1278 moutId($<ident>0);}
1279 ;
1280 ARGUMENT_LIST : EXPRESSION { mout(MENDSEP);
1281 mout(MARGUMENTSEP);}
1282 | EXPRESSION
1283 HPAREXPSEPARATOR
1284 ARGUMENT_LIST { mout(MARGUMENTSEP);}
1285 ;
1286 %%
1287 ]])
1288
1289 # Pass plenty of options, to exercise plenty of code, even if we
1290 # don't actually check the output. But SEGV is watching us, and
1291 # so might do dmalloc.
1292 AT_CHECK([[bison --verbose --defines input.y]], 0, [],
1293 [[input.y contains 78 shift/reduce conflicts and 10 reduce/reduce conflicts.
1294 ]])
1295
1296 AT_CHECK([[grep '^State.*contains' input.output]], 0,
1297 [[State 64 contains 14 shift/reduce conflicts.
1298 State 164 contains 1 shift/reduce conflict.
1299 State 201 contains 33 shift/reduce conflicts and 4 reduce/reduce conflicts.
1300 State 206 contains 1 shift/reduce conflict.
1301 State 240 contains 1 shift/reduce conflict.
1302 State 335 contains 9 shift/reduce conflicts and 2 reduce/reduce conflicts.
1303 State 356 contains 1 shift/reduce conflict.
1304 State 360 contains 9 shift/reduce conflicts and 2 reduce/reduce conflicts.
1305 State 427 contains 9 shift/reduce conflicts and 2 reduce/reduce conflicts.
1306 ]])
1307
1308 AT_CLEANUP