Skip to content

Instantly share code, notes, and snippets.

@jmolinski
Created June 2, 2016 01:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jmolinski/316acb7936b8f717b7d1d28824c44aeb to your computer and use it in GitHub Desktop.
Save jmolinski/316acb7936b8f717b7d1d28824c44aeb to your computer and use it in GitHub Desktop.
Python script which translates brainfuck code to c; 237 bytes
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