Created
June 2, 2016 01:39
-
-
Save jmolinski/a3029b10d591ee3e92ccf69bb81d80df to your computer and use it in GitHub Desktop.
Python script which translates brainfuck code to c; 228 bytes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys;print('#include<stdio.h>\nmain(){char a[30000],*p=&a;%s}'%''.join([{'>':'++p;','<':'--p;','+':'++*p;','-':'--*p;','.':'putchar(*p);',',':'*p=getchar();','[':'while(*p){',']':'}'}.get(x,'') for x in sys.stdin.read()])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment