Created
June 2, 2016 01:05
-
-
Save jmolinski/316acb7936b8f717b7d1d28824c44aeb to your computer and use it in GitHub Desktop.
Python script which translates brainfuck code to c; 237 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]={0};char* 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