Skip to content

Instantly share code, notes, and snippets.

@yshl

yshl/bfi-0.c

Created Jul 27, 2013
Embed
What would you like to do?
Brainfuck Interpreter. bfi-0.c : ',' doesn't change memory cells at EOF. bfi-1.c : ',' returns -1 at EOF.
c['~~'];d['~~'];*p=d;n;main(i,a,q)char**a,*q;{for(read(open(a[1],0),q=c,-1);*q;n<0?q--:q++)i=*q-44,i-49?i-47?n?0:i-2?p+=i-16?i?*p-=~i?i==1:i:read(0,p,1),i==18:-1:putchar(*p):(n+=!!n)|*p||n++:n--;}
c['~~'];d['~~'];*p=d;n;main(i,a,q)char**a,*q;{for(read(open(a[1],0),q=c,-1);*q;n<0?q--:q++)i=*q-44,i-49?i-47?n?0:i-2?p+=i-16?*p-=i?~i?i==1:i:*p-getchar(),i==18:-1:putchar(*p):(n+=!!n)|*p||n++:n--;}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment