Portable Brainfuck

The detailed description of the language given in the page above is only strictly accurate for the original Brainfuck compiler. Brainfuck has many implementations, and some implementors have chosen to extend the original Müller limits, sometimes in ways that make it difficult for a Brainfuck programmer to write portable code.

In the absence of a more formal regulating standards body, I offer up my own guidelines to programmers desiring to create either portable Brainfuck programs or compatible Brainfuck implementations. These guidelines are based on my observations of the range of existing Brainfuck implementations, and should include just about every sane implementation created as of this writing.

For the reader who is unfamiliar with standard standardese, I offer some prefatory definitions. When something is said to be implementation-defined, such as an environmental limitation or how a program construct behaves in a certain situation, that means that a given implementation can do pretty much anything (subject to any other applicable constraints, of course), but that the implementation must document its choice. (In the case of Brainfuck, however, many implementors consider the source code to be documentation enough.) When something is said to be undefined, however, that means that an implementation in that situation can do pretty much anything at all without violating any restrictions of this standard. (In other words, a portable Brainfuck program should eschew all undefined behavior.)

Finally, note that comments in parentheses are informal; they are offered merely as helpful clarifications, and do not impose any requirements.

The Unofficial Constraints on Portable Brainfuck Implementations

Since I am not an actual formal standards body, I don't have a nice pronounceable acronym that one could prepend to "-compliant" to form an adjective to describe a conforming implementation. In lieu of this, then, I hereby suggest that a Brainfuck implementation that is compliant with all of the constraints listed here should be described as "nice".

Brian Raiter