Skip to content

Instantly share code, notes, and snippets.

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