Transformations of brainfuck programs

May 04, 2012 10:48

A brainfuck program is any string of characters in which the square brackets match. That is, you could walk the string, pushing addresses of left brackets to a stack, popping when you encounter right brackets, never encounter a stack underflow, and end with an empty stack ( Read more... )

Leave a comment

Comments 3

ext_1193603 May 5 2012, 00:23:56 UTC
Any ',', '+', or '-' that immediately precedes a ',' can be removed.

Reply

ciphergoth May 5 2012, 07:29:51 UTC
Agree with +, -> , and -, -> , but not sure about ,, -> ,

we're reading from a stream, right? So ,, means reading a byte, discarding it, and reading another.

Reply

ext_1193603 May 6 2012, 05:08:37 UTC
Good catch, ',,' and ',' are not equivalent.

Reply


Leave a comment

Up