bfi is a simple brainfuck interpreter, created as an experiment in interpreter and compiler design.
bfi is intended not as a stand-alone application, but as a building block for an eventual compiler. It parses the entire source and creates an Intermediate Representation before interpreting said IR, as a compiler would.
It implements simple peephole optimizations (truncating repeated + and - operations) and "brief format" error messages (the same format used in gcc and other compilers, for compatibility with Emacs' compilation-mode.
bfi is written as a single file of pure C, and depends only on libc. Thus, all you need to build it is a C compiler and make.
For a regular build, simply run:
makeFor a build that logs the Intermediate Representation array to a file for debugging, run:
make debug_irThe debug log file will be automatically created as "ir.log" if it doesn't already exist. By default, it will be created in the working directory. To change that, alter LOGPATH in main.c to your directory of choice.
Simply run:
bfi -f file.bfwhere file.bf is your Brainfuck source file. For an example Hello World program, use the provided hello.bf file.
For verbose output, add the -v argument.