]> iEval git - gruntmaster-daemon.git/commitdiff
Add Brainfuck
authorSergiu <srg.pscs@gmail.com>
Thu, 21 Jan 2016 03:57:05 +0000 (05:57 +0200)
committerMarius Gavrilescu <marius@ieval.ro>
Sat, 23 Jan 2016 16:08:45 +0000 (16:08 +0000)
gruntmaster-compile
lib/Gruntmaster/Daemon.pm
t/01-jobs.t
t/problems/hello/tests/brainkfuck/meta.yml [new file with mode: 0644]
t/problems/hello/tests/brainkfuck/prog.bf [new file with mode: 0644]

index 794b514b63edb71c5cb5c13f1c52980bb21c67d5..cea2733e7a6c10c8ebe128e0bdaca18616e50be5 100755 (executable)
@@ -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
index db2c757ac7bcef45f243eee0ed2ea5a4ad410d40..ad4e727e774d5e704cb6431e73952f7efef256fa 100644 (file)
@@ -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',
index 1270358fbebe1d60fc0b1ce5024b51b524fa710c..e3464fc43e882cdb350dc01ab789efb2abf4ced9 100644 (file)
@@ -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 (file)
index 0000000..6019963
--- /dev/null
@@ -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 (file)
index 0000000..81cb6c4
--- /dev/null
@@ -0,0 +1 @@
+-[------->+<]>-.-[->+++++<]>++.+++++++..+++.[--->+<]>-----.---[->+++<]>.-[--->+<]>---.+++.------.--------.-[--->+<]>.[--->+<]>-.
This page took 0.027594 seconds and 4 git commands to generate.