Convert Brainfuck to a Non-Golfing Language

6

1

Input:

Any Brainfuck program. This includes brainfuck programs with comments such as +++COMMENT[>+++<-]..

Output:

A program in one of the below languages that produces the same output as the Brainfuck program on all inputs. It should produce the same output exactly as the interepreter on this website There are no or performance restrictions on the output program; the outputted program doesn't need to be optimized in any way. In other words, the quality of the outputted program does not affect score, only the translation program. To clarify: you may write your answer in any language that is normally valid for answers on PCG. The restriction on output languages is only for the outputted program.

The outputted program only receives the same input that would be received by the Brainfuck program. The outputted program does not receive the Brainfuck program as input.

Valid Output Languages

  • C#
  • C++
  • C
  • Java 8
  • Javascript ES6 (it is both okay to receive all of stdin in a single prompt, or multiple prompts per character)
  • Perl
  • Python 2.7
  • Python 3.4.2
  • Ruby

Fine Print

You may write a program or function which takes the Brainfuck program as a String argument or on STDIN or closest alternative, and which returns the output as a String or printing it to STDOUT (or closest alternative). You may optionally include a single trailing newline in the output.

Additionally, standard loopholes which are no longer funny are banned. You may not use external libraries or external data files, the code must be self contained.

This is , shortest program wins.

durron597

Posted 2015-05-12T19:50:34.050

Reputation: 4 692

possible duplicate of Interpret Brainfuck

– mbomb007 – 2015-05-12T21:24:43.313

3It's not a dup, as a compiler is not an interpreter – edc65 – 2015-05-12T21:39:47.857

It might not be a dup, but the question is whether there is a shorter solution than copy&pasting a golfed interpreter in one of the allowed languages; and copying the brainfuck to the output program. – blutorange – 2015-05-12T22:18:50.770

3Can you clarify the behavior of the linked interpreter? What is the max number of memory cells? How is overflow of cell values handled? – nderscore – 2015-05-12T22:27:26.613

2@nderscore The linked interpreter uses signed integers that wrap around from -128 to +127. However, the values are effectively cast to 2-byte unsigned ints before being output as characters; so -1 => chr(65535) (). Personally, I would prefer output in the form of 1-byte (ASCII) characters (in part because that's what my solution uses). The tape is circular, with 32768 cells. durron597, are these specs what you intended? – DLosc – 2015-05-13T06:25:50.493

Any reason not to open this up to all output languages? – Adám – 2019-07-02T13:34:51.893

Answers

5

K, 143 129 113 bytes

1!"}int a[99];int*p=a;main(){",,/{("p++;";"p--;";"*p++;";"*p--;";"*p=getchar();if(*p<0)*p=0;";"putchar(*p);";"while(*p){";"}";"")"><+-,.[]"?x}'

This is an extremely straightforward approach which generates C source code by emitting a preamble, a C snippet for each BF command and then a postscript. Non-BF characters are translated into empty strings in the concatenated output.

The translation into C is as follows:

  • preamble: int a[99];int*p=a;main(){
  • >: p++;
  • <: p--;
  • +: *p++;
  • -: *p--;
  • ,: *p=getchar();if(*p<0)*p=0;
  • .: putchar(*p);
  • [: while(*p){
  • ]: }
  • postscript: }

I suspect that there is room for improvement here by using more mangled abuses of C or compressing the C fragments.

The K part of the program by itself would look like the following, where c is the C translations of each BF instruction and p is the preamble/postscript:

1!p,,/{c"><+-,.[]"?x}'

Using the venerable BF string reverser program >,[>,]<[.<] as my test case I generate code which looks like the following after a bit of whitespace for readability:

int a[99];
int*p=a;

main(){
    p++;
    *p=getchar();if(*p<0)*p=0;
    while(*p){
        p++;
        *p=getchar();if(*p<0)*p=0;
    }
    p--;
    while(*p){
        putchar(*p);
        p--;
    }
}

edit:

A few tweaks. Firstly, more compliant tape declaration as suggested by alexander-brett. The int part can be left off:

int a[99]; -> a[1<<15]; (-1 byte)

Also, it seems that EOF behavior in BF can return 0, -1 or cause no change as a result of ,. EOF=-1 seems to be what other solutions are going with, so for the sake of uniformity I will do the same:

*p=getchar();if(*p<0)*p=0; -> *p=getchar(); (-13 bytes)

Note that this means my string reverser program will choke if you simply cat it a file ending in EOF(!), but as above it seems to be fair.

The new complete 129 byte solution:

1!"}a[1<<15];int*p=a;main(){",,/{("p++;";"p--;";"*p++;";"*p--;";"*p=getchar();";"putchar(*p);";"while(*p){";"}";"")"><+-,.[]"?x}'

edit 2, much, much later:

I randomly stumbled upon this old answer and, being older and wiser, realized there are several ways to make this shorter:

  • exploit the fact that it's completely syntactically valid C to include semicolons after every fragment instead of just those who need them, and thus remove them from the lookup table entries.
  • use the k5/k6 or oK dialects, which have overloads for \ and / which split a string apart on a character or join a list of strings with a character, respectively, to use a more compact representation of the lookup table and accomplish the above.
  • take advantage of the fact that find (dyadic ?) in the above dialects naturally conforms to a listy right argument, and thus does not need an explicit lambda + each

The one downside is that in these dialects there is no "rotate" primitive, so we have to add the "}" suffix in a less elegant manner. The overall structure of our solution:

1!     p, ,/{c"><+-,.[]"?x}'   / old
,[;"}"]p,";"/c"><+-,.[]"?      / new

The complete (and now totally points-free!) solution:

,[;"}"]"a[1<<15];int*p=a;main(){",";"/("|"\"p++|p--|*p++|*p--|*p=getchar()|putchar(*p)|while(*p){|}|")"><+-,.[]"?

Which shaves us down to 113 bytes.

JohnE

Posted 2015-05-12T19:50:34.050

Reputation: 4 632

Shouldn't that be a[30000]? – alexander-brett – 2015-05-13T06:51:43.627

That would be more compliant. a[1<<15] is closer to the interpreter above, and I can leave off "int" as C variables are implicitly ints. It also looks like my "EOF=0" handling is more than is strictly necessary, even if it's a common assumption. – JohnE – 2015-05-13T14:02:40.320

1DARN! You beat me to K. :) – kirbyfan64sos – 2015-05-29T19:19:58.370

4

Javascript (ES7 Draft), 170 bytes

Function which compiles BF source code into Javascript. The resulting code accepts input via prompt() and outputs via alert(), both one character at a time.

f=x=>'x=[i=0];'+[for(y of x)'z=x[i]|=0,x[i]'+'0++0--0,i++0,i--0,alert(String.fromCharCode(z))0=prompt().charCodeAt()0;for(;x[i];){x0}x'.split(0)['+-><.,[]'.indexOf(y)+1]]

The result is composed of:

Preamble: x=[i=0]; - Initializes x as an object to store memory cells and i as 0 for the initial index.

Each command is prefixed with: z=x[i]|=0,x[i] - Forces undefined memory cells to 0, starts all commands with x[i] to reduce repetition in the translation map. Stores value at current index in z.

Each command is also seperated by , commas due to implicit casting of the array to a string.

Command translation map:

  • (unknown) => empty string
  • + => ++ - increment value at x[i]
  • - => -- - decrement value at x[i]
  • > => ,i++ - increment index pointer i
  • < => ,i-- - decrement index pointer i
  • . => ,alert(String.fromCharCode(z)) - alert character from value at x[i]
  • , => =prompt().charCodeAt() - store converted character code from prompt at x[i]
  • [ => ;for(;x[i];){x - Loop while value at x[i] is truthy (non-zero).
  • ] => }x - End loop. Unused x appended to prevent errors from commas.

nderscore

Posted 2015-05-12T19:50:34.050

Reputation: 4 912

4

Python 2, 250 244 bytes

def B(b):
 I=0;print"from ctypes import*;R,p,c=[0]*9999,0,CDLL('libc.so.6')"
 for c in b:
     try:print' '*I+'p+=1|p-=1|R[p]+=1|R[p]-=1|c.putchar(R[p])|R[p]=c.getchar()|while R[p]!=0:|'.split('|')['><+-.,[]'.index(c)];I+=']&['.index(c)-1
     except:0

#first indentation level=space, 2nd indentation level=tab

(thks to @undergroundmonorail for helping me save 4 extra bytes)

The B function takes bf code as parameter and generates... a Python script.

Brainfuck's "tape" is seen a an array called R, which owns 32768 9999 items, and the pointer is stored in a variable called p.

The lack of a native equivalent to C's getchar function in python forced me to load it using ctypes at runtime, which makes the generated script unusable on Windows (untested, I guess that a Windows version should load mscvrt.dll instead of libc.so.6)

Example

The infamous 'hello world':

B('++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>.')

Generates the following script:

from ctypes import*;R,p,c=[0]*9999,0,CDLL('libc.so.6')
R[p]+=1
R[p]+=1
R[p]+=1
R[p]+=1
R[p]+=1
R[p]+=1
R[p]+=1
R[p]+=1
R[p]+=1
R[p]+=1
while R[p]!=0:
 p+=1
 R[p]+=1
 R[p]+=1
 R[p]+=1
 R[p]+=1
 R[p]+=1
 R[p]+=1
 R[p]+=1
 p+=1
 R[p]+=1
 R[p]+=1
 R[p]+=1
 R[p]+=1
 R[p]+=1
 R[p]+=1
 R[p]+=1
 R[p]+=1
 R[p]+=1
 R[p]+=1
 p+=1
 R[p]+=1
 R[p]+=1
 R[p]+=1
 p+=1
 R[p]+=1
 p-=1
 p-=1
 p-=1
 p-=1
 R[p]-=1

p+=1
R[p]+=1
R[p]+=1
c.putchar(R[p])
p+=1
R[p]+=1
c.putchar(R[p])
R[p]+=1
R[p]+=1
R[p]+=1
R[p]+=1
R[p]+=1
R[p]+=1
R[p]+=1
c.putchar(R[p])
c.putchar(R[p])
R[p]+=1
R[p]+=1
R[p]+=1
c.putchar(R[p])
p+=1
R[p]+=1
R[p]+=1
c.putchar(R[p])
p-=1
p-=1
R[p]+=1
R[p]+=1
R[p]+=1
R[p]+=1
R[p]+=1
R[p]+=1
R[p]+=1
R[p]+=1
R[p]+=1
R[p]+=1
R[p]+=1
R[p]+=1
R[p]+=1
R[p]+=1
R[p]+=1
c.putchar(R[p])
p+=1
c.putchar(R[p])
R[p]+=1
R[p]+=1
R[p]+=1
c.putchar(R[p])
R[p]-=1
R[p]-=1
R[p]-=1
R[p]-=1
R[p]-=1
R[p]-=1
c.putchar(R[p])
R[p]-=1
R[p]-=1
R[p]-=1
R[p]-=1
R[p]-=1
R[p]-=1
R[p]-=1
R[p]-=1
c.putchar(R[p])
p+=1
R[p]+=1
c.putchar(R[p])
p+=1
c.putchar(R[p])

dieter

Posted 2015-05-12T19:50:34.050

Reputation: 2 010

Unless I'm mistaken, the length of R is 0xfff=4095, not 32768. Also you can save some bytes by changing the last line to except:0. 0 is a no-op and 3 bytes shorter than pass. – undergroundmonorail – 2015-05-28T14:11:48.777

@undergroundmonorail http://en.wikipedia.org/wiki/Brainfuck#Array_size

– Kade – 2015-05-29T01:49:50.150

You can save a few bytes by replacing from ctypes import* with from msvcrt import* and using just putchar instead of c.putchar. – pppery – 2017-07-16T16:19:23.870

2

QuadR, 106 100 bytes

Edit: finally 100 bytes!

Creates C code.

^
>
<
[+-]
\.
,
\[
]|$
a[1<<15];*p=a;main(){
p++;
p--;
*p&&;
putchar(*p);
*p=getchar();
while(*p){
}

Try it online!

The first nine lines are PCRE regexes. Matches throughout the input are replaced with the corresponding string from the last 9 lines. The only noteworthy "hacks" are transpiling [+-] to *p&&; where & means the matched plus/minus symbol, and combining end-of-loop with end-of-main through mapping ]|$ to }

Adám

Posted 2015-05-12T19:50:34.050

Reputation: 37 779

2

Perl, 127 120B + 2

%h=qw#> ++p;
< --p;
+ ++*p;
- --*p;
. putchar(*p);
, *p=getchar();
[ while(*p){
] }#;say"a[1<<15],*p=a;main(){@h{/./g}}"

The magic happens in @h{/./g}: /./g splits the input into characters, @h{} is a hash slice, and the "" interpolation joins hash elements using a space (by default). The target is C using exactly the spec on the Brainfuck website. 2 point penalty for -0n: run with

perl -M5.10.0 -0n scratch.pl > test.c < input.bf && gcc -ansi test.c && ./a.out

7B saving thanks to CL- and the prevailing opinion on variable declarations.

alexander-brett

Posted 2015-05-12T19:50:34.050

Reputation: 1 485

It looks like you can shorten the C preamble from main(){int a[1<<15];int*p=a; to a[1<<15],*p=a;main(){ for a 7 byte saving. This also guarantees that each element of a will be initialised to 0. – CL- – 2015-05-14T16:58:43.337

@CL- how do I compile that? gcc on OSX errors if I don't put a type in – alexander-brett – 2015-05-14T17:11:19.923

You'll see a warning, but it should still compile fine. – JohnE – 2015-05-15T13:48:28.090

2

Common Lisp & JavaScript - 425 bytes

N.B. I am using the Parenscript library, so this is just for the fun.

(defun b(i &aux(s(coerce i'list)))(labels((c()(do(r x)((or x(not s))(reverse r))(push(case(pop s)(#\>`(incf p))(#\<`(decf p))(#\+`(setf(aref a p)(1+#1=(or(aref a p)0))))(#\-`(setf(aref a p)(1- #1#)))(#\.`((ps:@ console log)((ps:@ *String from-char-code)#1#)))(#\,`(setf(aref a p)((ps:@(prompt)char-code-at)0)))(#\[`(loop until(= 0 #1#)do ,@(c))))(#\](setf x t)(go /))(t(go /)))r)/)))(ps:ps*`(let((a(make-array))(p 0)),@(c)))))

Ungolfed

(defun bf(i)
  (let ((s (coerce i'list)))
    (labels((lbf ()
              (do(r x)((or x(not s))(reverse r))
                      (push (case (pop s)
                              (#\> `(incf p))
                              (#\< `(decf p))
                              (#\+ `(setf(aref a p)(1+(or (aref a p)0))))
                              (#\- `(setf(aref a p)(1-(or (aref a p)0))))
                              (#\. `((ps:@ console log)((ps:@ *String from-char-code) (or(aref a p)0))))
                              (#\, `(setf(aref a p) ((ps:@ (prompt) char-code-at) 0)))
                              (#\[ `(loop until(= 0(or(aref a p)0))do ,@(lbf)))
                              (#\] (setf x t) (go /))
                              (t (go /)))
                            r)/)))
      `(let ((a (make-array))
             (p 0))
         ,@(lbf)))))

Explanations

  • Convert input string as list of characters s
  • The recursive function lbf pop elements from s and build a local list of expressions r
  • Whenever we encounter a [ character, the function recurse in order to create a nested block of instructions
  • Whenever we encounter a ] character, the function exits, returning to one higher level of invocation. Note that when returning from the function, the variable s has been modified to hold the rest of the characters to be processed, thanks to pop.
  • The whole S-expr being built is expressed in a sub-language of Common Lisp that can be converted to Javascript thanks to Parenscript.

Optimized version

I made a slightly optimized version that is too long to post here, with the following changes:

  • Parsing only produces an AST containing the following symbols: print, read, left, right, inc, dec, bracketed (nested tree) and brainfuck (root tree).

  • The AST is analyzed to group all increment and decrement operations, as well as move operations, in order to build (add x) and (move y) terms.

  • Finally, the AST is converted into Parenscript code.

  • That code is emitted as a Javascript string

The resulting Javascript for Hello World is:

(function () {
   var a = new Array();
   var p = 0;
   a[p] = (a[p] || 0) + 10;
   while (0 !== (a[p] || 0)) {
       ++p;
       a[p] = (a[p] || 0) + 7;
       ++p;
       a[p] = (a[p] || 0) + 10;
       ++p;
       a[p] = (a[p] || 0) + 3;
       ++p;
       a[p] = (a[p] || 0) + 1;
       p += -4;
       a[p] = (a[p] || 0) + -1;
   };
   ++p;
   a[p] = (a[p] || 0) + 2;
   console.log(String.fromCharCode(a[p] || 0));
   ++p;
   a[p] = (a[p] || 0) + 1;
   console.log(String.fromCharCode(a[p] || 0));
   a[p] = (a[p] || 0) + 7;
   console.log(String.fromCharCode(a[p] || 0));
   console.log(String.fromCharCode(a[p] || 0));
   a[p] = (a[p] || 0) + 3;
   console.log(String.fromCharCode(a[p] || 0));
   ++p;
   a[p] = (a[p] || 0) + 2;
   console.log(String.fromCharCode(a[p] || 0));
   p += -2;
   a[p] = (a[p] || 0) + 15;
   console.log(String.fromCharCode(a[p] || 0));
   ++p;
   console.log(String.fromCharCode(a[p] || 0));
   a[p] = (a[p] || 0) + 3;
   console.log(String.fromCharCode(a[p] || 0));
   a[p] = (a[p] || 0) + -6;
   console.log(String.fromCharCode(a[p] || 0));
   a[p] = (a[p] || 0) + -8;
   console.log(String.fromCharCode(a[p] || 0));
   ++p;
   a[p] = (a[p] || 0) + 1;
   console.log(String.fromCharCode(a[p] || 0));
   ++p;
   return console.log(String.fromCharCode(a[p] || 0));
})();

coredump

Posted 2015-05-12T19:50:34.050

Reputation: 6 292

1

rs, 214 bytes

Outputs Ruby 1.9 code.

[^+\-[\]<>.,]/
\[/while tape[i
\]/end;
\[i/[i] != 0 do 
\./print tape[i].chr;
if !defined?tape then require "io\x2Fconsole";tape=[0]*9999;i=0;end;
\+/tape[i]+=1;
-/tape[i]-=1;
</i+=1;
>/i-=1;
,/tape[i]=STDIN.getch;

Try it here!

Sample runs

Hello, world!

Input:

++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.

Output:

if !defined?tape then require "io\x2Fconsole";tape=[0]*9999;i=0;end;tape[i]+=1;tape[i]+=1;tape[i]+=1;tape[i]+=1;tape[i]+=1;tape[i]+=1;tape[i]+=1;tape[i]+=1;while tape[i] != 0 do i-=1;tape[i]+=1;tape[i]+=1;tape[i]+=1;tape[i]+=1;while tape[i] != 0 do i-=1;tape[i]+=1;tape[i]+=1;i-=1;tape[i]+=1;tape[i]+=1;tape[i]+=1;i-=1;tape[i]+=1;tape[i]+=1;tape[i]+=1;i-=1;tape[i]+=1;i+=1;i+=1;i+=1;i+=1;tape[i]-=1;end;i-=1;tape[i]+=1;i-=1;tape[i]+=1;i-=1;tape[i]-=1;i-=1;i-=1;tape[i]+=1;while tape[i] != 0 do i+=1;end;i+=1;tape[i]-=1;end;i-=1;i-=1;print tape[i].chr;i-=1;tape[i]-=1;tape[i]-=1;tape[i]-=1;print tape[i].chr;tape[i]+=1;tape[i]+=1;tape[i]+=1;tape[i]+=1;tape[i]+=1;tape[i]+=1;tape[i]+=1;print tape[i].chr;print tape[i].chr;tape[i]+=1;tape[i]+=1;tape[i]+=1;print tape[i].chr;i-=1;i-=1;print tape[i].chr;i+=1;tape[i]-=1;print tape[i].chr;i+=1;print tape[i].chr;tape[i]+=1;tape[i]+=1;tape[i]+=1;print tape[i].chr;tape[i]-=1;tape[i]-=1;tape[i]-=1;tape[i]-=1;tape[i]-=1;tape[i]-=1;print tape[i].chr;tape[i]-=1;tape[i]-=1;tape[i]-=1;tape[i]-=1;tape[i]-=1;tape[i]-=1;tape[i]-=1;tape[i]-=1;print tape[i].chr;i-=1;i-=1;tape[i]+=1;print tape[i].chr;i-=1;tape[i]+=1;tape[i]+=1;print tape[i].chr;

Mandelbrot

Input:

      A mandelbrot set fractal viewer in brainf*** written by Erik Bosman
+++++++++++++[->++>>>+++++>++>+<<<<<<]>>>>>++++++>--->>>>>>>>>>+++++++++++++++[[
>>>>>>>>>]+[<<<<<<<<<]>>>>>>>>>-]+[>>>>>>>>[-]>]<<<<<<<<<[<<<<<<<<<]>>>>>>>>[-]+
<<<<<<<+++++[-[->>>>>>>>>+<<<<<<<<<]>>>>>>>>>]>>>>>>>+>>>>>>>>>>>>>>>>>>>>>>>>>>
>+<<<<<<<<<<<<<<<<<[<<<<<<<<<]>>>[-]+[>>>>>>[>>>>>>>[-]>>]<<<<<<<<<[<<<<<<<<<]>>
>>>>>[-]+<<<<<<++++[-[->>>>>>>>>+<<<<<<<<<]>>>>>>>>>]>>>>>>+<<<<<<+++++++[-[->>>
>>>>>>+<<<<<<<<<]>>>>>>>>>]>>>>>>+<<<<<<<<<<<<<<<<[<<<<<<<<<]>>>[[-]>>>>>>[>>>>>
>>[-<<<<<<+>>>>>>]<<<<<<[->>>>>>+<<+<<<+<]>>>>>>>>]<<<<<<<<<[<<<<<<<<<]>>>>>>>>>
[>>>>>>>>[-<<<<<<<+>>>>>>>]<<<<<<<[->>>>>>>+<<+<<<+<<]>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<<<<<<+>>>>>>>>]<<<<<<<<[->>>>>>>>+<<<<<<<<<<<<<<<<<[<<<<<<<
<<]>>>>[-]+>>>>>[>>>>>>>>>]>+<]]+>>>>>>>>[-<<<<<<<<->>>>>>>>]+<<<<<<<<[->>>>>>>>
-<<[-<<<<<<+>>>>>>]<<<<<<[->>>>>>+<<<<<<<<<<<<<<<[<<<<<<<<<]>>>[-]+>>>>>>[>>>>>>
>>>]>[-]+<]]+>[-<[>>>>>>>>>]<<<<<<<<]>>>>>>>>]<<<<<<<<<[<<<<<<<<<]>>>>[-]<<<++++
+[-[->>>>>>>>>+<<<<<<<<<]>>>>>>>>>]>>>>>->>>>>>>>>>>>>>>>>>>>>>>>>>>-<<<<<<[<<<<
<<<<<]]>>>]

Output (I'm glad it isn't scored!) is available on Pastebin because it was too long to put here!

kirbyfan64sos

Posted 2015-05-12T19:50:34.050

Reputation: 8 730