'Intermezzo: A brainf***-interpreter'

Posted on August 4, 2011 by phimuemue

Here's a 290-characters interpreter for the brainf*** programming language I wrote.

main(int a,char*s[]){int b[atoi(s[2])],*z=b,p;char*c=s[1],v,w;while(p=1,
v<w?c++:c--,p+=*c==v?1:*c==w?-1:0;}c++;}}//gcc -D"q(a,b)"="*c-a||(b);"

It has to be compiled specifying some specialties:

gcc -D"q(a,b)"="*c-a||b;" -o pmmbf pmmbf.c

and can be invoked as follows:

./pmmbf ",[-.]" 1000

The first argument specifies the brainf***-program to be run, the second argument determines the size of the tape.