Skip to content

Instantly share code, notes, and snippets.

@phimuemue
Created August 4, 2011 20:30
Show Gist options
  • Save phimuemue/1126171 to your computer and use it in GitHub Desktop.
Save phimuemue/1126171 to your computer and use it in GitHub Desktop.
brainf*** interpreter
main(int a,char*s[]){int b[atoi(s[2])],*z=b,p;char*c=s[1],v,w;while(p=1,
*c){q('>',++z)q('<',--z)q('+',++*z)q('-',--*z)q('.',putchar(*z))q(',',*z
=getchar())if(*c=='['||*c==']'){v=*c,w=184-v;if(v<w?*z==0:*z!=0)while(p)
v<w?c++:c--,p+=*c==v?1:*c==w?-1:0;}c++;}}//gcc -D"q(a,b)"="*c-a||(b);"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment