Created
June 2, 2016 03:23
-
-
Save jmolinski/adbe899a63253ac4a5e8eb3b2694560f to your computer and use it in GitHub Desktop.
Python script which translates brainfuck code to c; 224 bytes
This file contains hidden or 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