From: Sergiu Date: Thu, 21 Jan 2016 03:57:05 +0000 (+0200) Subject: Add Brainfuck X-Git-Url: http://git.ieval.ro/?a=commitdiff_plain;h=fb85e61f17db54c31c74fbafea6258e5c582efec;p=gruntmaster-daemon.git Add Brainfuck --- diff --git a/gruntmaster-compile b/gruntmaster-compile index 794b514..cea2733 100755 --- a/gruntmaster-compile +++ b/gruntmaster-compile @@ -11,6 +11,7 @@ my $basename = fileparse $name, qr/\..*/; given ($format){ exec 'gcc', qw/-DONLINE_JUDGE -std=gnu11 -Wall -Wextra -lm -O2 -o/, $basename, $name when 'C'; exec 'g++', qw/-DONLINE_JUDGE -std=gnu++11 -Wall -Wextra -lm -O2 -o/, $basename, $name when 'CPP'; + when ('MONO') { system 'gmcs', '-d:ONLINE_JUDGE', $name and die "gmcs failed: errno=$! return=$?"; rename "$basename.exe", $basename; @@ -30,6 +31,13 @@ given ($format){ exec 'ghc', qw/-DONLINE_JUDGE -Wall -O2 -o/, $basename, $name when 'HASKELL'; exec 'rustc', qw/-O -o/, $basename, $name when 'RUST'; + when ('BRAINFUCK') { + system 'bfc', $name and die "bfc failed: errno=$! return=$?"; + rename "a.out", $basename; + chmod 0755, $basename; + exit + } + when ([qw/GOLFSCRIPT JULIA PERL PYTHON RUBY SBCL/]){ open IN, '<', $name; open OUT, '>', $basename; @@ -69,6 +77,10 @@ Compile commands for each format: =over +=item BRAINFUCK + + bfc $input + =item C gcc -DONLINE_JUDGE -std=gnu11 -Wall -Wextra -O2 -o $output $input diff --git a/lib/Gruntmaster/Daemon.pm b/lib/Gruntmaster/Daemon.pm index db2c757..ad4e727 100644 --- a/lib/Gruntmaster/Daemon.pm +++ b/lib/Gruntmaster/Daemon.pm @@ -18,6 +18,7 @@ use Try::Tiny; use Log::Log4perl qw/get_logger/; use constant FORMAT_EXTENSION => { + BRAINFUCK => 'bf', C => 'c', CPP => 'cpp', GCCGO => 'go', diff --git a/t/01-jobs.t b/t/01-jobs.t index 1270358..e3464fc 100644 --- a/t/01-jobs.t +++ b/t/01-jobs.t @@ -19,7 +19,8 @@ use YAML::Tiny qw/LoadFile/; ################################################## use constant COMPILER => { - qw/C gcc + qw/BRAINFUCK bfc + C gcc CPP g++ GOLFSCRIPT golfscript MONO gmcs diff --git a/t/problems/hello/tests/brainkfuck/meta.yml b/t/problems/hello/tests/brainkfuck/meta.yml new file mode 100644 index 0000000..6019963 --- /dev/null +++ b/t/problems/hello/tests/brainkfuck/meta.yml @@ -0,0 +1,7 @@ +test_name: Brainfuck +test_description: Hello world in Brainfuck +problem: hello +files: + prog: + format: BRAINFUCK + name: prog.bf diff --git a/t/problems/hello/tests/brainkfuck/prog.bf b/t/problems/hello/tests/brainkfuck/prog.bf new file mode 100644 index 0000000..81cb6c4 --- /dev/null +++ b/t/problems/hello/tests/brainkfuck/prog.bf @@ -0,0 +1 @@ +-[------->+<]>-.-[->+++++<]>++.+++++++..+++.[--->+<]>-----.---[->+++<]>.-[--->+<]>---.+++.------.--------.-[--->+<]>.[--->+<]>-.