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 794b514..cea2733 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 db2c757..ad4e727 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 1270358..e3464fc 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.046797 seconds and 4 git commands to generate.