/[bison]/bison/tests/torture.at
ViewVC logotype

Diff of /bison/tests/torture.at

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.12 by akim, Mon Apr 8 11:46:05 2002 UTC revision 1.13 by akim, Mon Apr 8 11:46:26 2002 UTC
# Line 140  AT_CLEANUP Line 140  AT_CLEANUP
140    
141    
142    
143    # AT_DATA_HORIZONTAL_GRAMMAR(FILE-NAME, SIZE)
144    # -------------------------------------------
145    # Create FILE-NAME, containing a self checking parser for a huge
146    # horizontal grammar.
147    # FIXME: The `10 *' below are there to avoid clashes with predefined
148    # tokens.  These clashes should be exercised, I'm afraid something
149    # is broken wrt previous Bisons.
150    m4_define([AT_DATA_HORIZONTAL_GRAMMAR],
151    [AT_DATA([[gengram.pl]],
152    [[#! /usr/bin/perl -w
153    
154    use strict;
155    my $max = $ARGV[0] || 10;
156    
157    print <<EOF;
158    %{
159    #include <stdio.h>
160    #include <stdlib.h>
161    #include <assert.h>
162    
163    #define YYERROR_VERBOSE 1
164    #define YYDEBUG 1
165    
166    static int yylex (void);
167    static void yyerror (const char *msg);
168    %}
169    EOF
170    
171    for my $size (1 .. $max)
172      {
173        print "%token \"$size\" ", $size * 10, "\n";
174      };
175    
176    print <<EOF;
177    %%
178    EOF
179    
180    use Text::Wrap;
181    print
182      wrap ("exp: ", "  ",
183            (map { "\"$_\"" } (1 .. $max)), ";"),
184      "\n";
185    
186    print <<EOF;
187    %%
188    static int
189    yylex (void)
190    {
191      static int counter = 1;
192      if (counter > $max)
193        return 0;
194      else
195      return counter++ * 10;
196    }
197    
198    static void
199    yyerror (const char *msg)
200    {
201      fprintf (stderr, "%s\\n", msg);
202    }
203    
204    int
205    main (void)
206    {
207      yydebug = !!getenv ("YYDEBUG");
208      return yyparse ();
209    }
210    EOF
211    ]])
212    
213    AT_CHECK([perl -w ./gengram.pl $2 || exit 77], 0, [stdout])
214    mv stdout $1
215    ])
216    
217    
218    ## ---------------- ##
219    ## Big horizontal.  ##
220    ## ---------------- ##
221    
222    AT_SETUP([Big horizontal])
223    
224    # I have been able to go up to 10000 on my machine, but I had to
225    # increase the maximum stack size (* 100).  It gave:
226    #
227    # input.y      263k
228    # input.tab.c  1.3M
229    # input        453k
230    #
231    # gengram.pl 10000                 0.70s user 0.01s sys  99% cpu    0.711 total
232    # bison input.y                  730.56s user 0.53s sys  99% cpu 12:12.34 total
233    # gcc -Wall input.tab.c -o input   5.81s user 0.20s sys 100% cpu     6.01 total
234    # ./input                          0.00s user 0.01s sys 108% cpu     0.01 total
235    #
236    AT_DATA_HORIZONTAL_GRAMMAR([input.y], [1000])
237    AT_CHECK([bison input.y -v -o input.c])
238    AT_CHECK([$CC $CFLAGS $CPPFLAGS input.c -o input], 0, [], [ignore])
239    AT_CHECK([./input])
240    
241    AT_CLEANUP
242    
243    
244    
245  # AT_DATA_STACK_TORTURE(C-PROLOGUE)  # AT_DATA_STACK_TORTURE(C-PROLOGUE)
246  # ---------------------------------  # ---------------------------------
247  # A parser specialized in torturing the stack size.  # A parser specialized in torturing the stack size.

Legend:
Removed from v.1.12  
changed lines
  Added in v.1.13

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26