Electricmonk

Ferry Boender

Programmer, DevOpper, Open Source enthusiast.

Blog

pyBrainfuck v0.2 released

Monday, July 7th, 2008

I just released v0.2 of pyBrainfuck.

PyBrainfuck is a speed-optimized Brainfuck interpreter written in Python.

Some other Python interpreters already exists for Brainfuck, but they are either obfuscated or awfully slow. PyBrainfuck has been optimized for speed by doing various preprocessing on the code such as pre-caching loop instructions, removing non-instructions, etc. PyBrainfuck also has configurable memory size, infinite loop protection and a somewhat spartan debugger.

PyBrainfuck can be used both as a stand-alone Brainfuck interpreter or as a python library. It can read from standard input or from a string (in library mode) and write to standard out or to a string buffer (in library mode).

Changes in this release:

  • Improved exception throwing. Exceptions now include an error number.
  • A bug was fixed in the jump instruction pre-processor where it would sometimes scan beyond the end-of-line of the code.
  • A bug was fixed where a brainfuck program could increase the memory value beyond the byte boundary. It now wraps to 0 at 256 and to 255 at -1.

Update: Direct link to the interpreter code for those who are interested.

The text of all posts on this blog, unless specificly mentioned otherwise, are licensed under this license.