mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-21 18:23:03 +00:00
bench: minor improvements
* etc/bench.pl.in: Don't force parse.error=detailed Use a simpler way to display the pseudo %bison directive. (&bench_with_gbenchmark): Give details about the compiler.
This commit is contained in:
@@ -252,7 +252,6 @@ sub generate_grammar_triangular ($$@)
|
|||||||
my $out = new IO::File ">$base.y"
|
my $out = new IO::File ">$base.y"
|
||||||
or die;
|
or die;
|
||||||
print $out <<EOF;
|
print $out <<EOF;
|
||||||
%define parse.error detailed
|
|
||||||
%{
|
%{
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@@ -388,7 +387,6 @@ sub generate_grammar_calc ($$@)
|
|||||||
%}
|
%}
|
||||||
|
|
||||||
%define api.value.type union
|
%define api.value.type union
|
||||||
%define parse.error detailed
|
|
||||||
$directives
|
$directives
|
||||||
|
|
||||||
%{
|
%{
|
||||||
@@ -812,7 +810,8 @@ sub compile ($)
|
|||||||
my ($base) = @_;
|
my ($base) = @_;
|
||||||
my $compiler = compiler ($base);
|
my $compiler = compiler ($base);
|
||||||
|
|
||||||
my $my_bison = `sed -ne '/%bison "\\(.*\\)"/{s//\\1/;p;q;}' $base.y`;
|
my $my_bison = `sed -ne '/[/][/] %bison "\\(.*\\)"/{s//\\1/;p;q;}' $base.y`;
|
||||||
|
chop $my_bison;
|
||||||
run ((length $my_bison ? $my_bison : $bison) . " $base.y -o $base.c");
|
run ((length $my_bison ? $my_bison : $bison) . " $base.y -o $base.c");
|
||||||
if ($gbench)
|
if ($gbench)
|
||||||
{
|
{
|
||||||
@@ -902,8 +901,13 @@ directive list.
|
|||||||
sub bench_with_gbenchmark ($@)
|
sub bench_with_gbenchmark ($@)
|
||||||
{
|
{
|
||||||
my ($grammar, @directive) = @_;
|
my ($grammar, @directive) = @_;
|
||||||
|
my $compiler = compiler ("y0");
|
||||||
|
|
||||||
my $readme = new IO::File ">README.md";
|
my $readme = new IO::File ">README.md";
|
||||||
|
print $readme <<EOF;
|
||||||
|
compiler: $compiler $cflags
|
||||||
|
EOF
|
||||||
|
|
||||||
my @obj = ();
|
my @obj = ();
|
||||||
for my $i (0 .. $#directive)
|
for my $i (0 .. $#directive)
|
||||||
{
|
{
|
||||||
@@ -923,7 +927,6 @@ sub bench_with_gbenchmark ($@)
|
|||||||
BENCHMARK_MAIN();
|
BENCHMARK_MAIN();
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
my $compiler = compiler ("y0");
|
|
||||||
run "$compiler -o main $cflags main.c @obj -lbenchmark";
|
run "$compiler -o main $cflags main.c @obj -lbenchmark";
|
||||||
run "./main | tee -a README.md";
|
run "./main | tee -a README.md";
|
||||||
}
|
}
|
||||||
@@ -1121,7 +1124,7 @@ sub parse_dir ()
|
|||||||
elsif ($token[0] eq '%b')
|
elsif ($token[0] eq '%b')
|
||||||
{
|
{
|
||||||
shift @token;
|
shift @token;
|
||||||
@res = ("/*\n%bison \"$token[0]\"\\\n*/");
|
@res = ("// %bison \"$token[0]\"");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user