Home > brainfuck

brainfuck

Brainfuck is a project mainly written in C++, it's free.

tiny brainfuck interpreter

this directory contains a tiny brainfuck interpreter source (main.cc) and brainfuck code (from Wikipedia).

to compile: make brainfuck or make all

to execute: ./brainfuck helloworld.bf

to clean: make clean

this brainfuck interpreter recieves brainfuck source code as first argument. stdin and stdout redirected to brainfuck's input and output respectively.

further work ideas:

  • jump optimization current implementation searches matching ] and [ every time. it can be optimized memoise these position on first search, and then next time search could be replaced with fseek.
  • functionize [ and ] processing for readablity, [ and ] processing code should be extracted as a function.

-- Ryohji IKEBE