A brainfuck interpreter in bAdkOde

by vivin

A few days before I left India, I started writing a brainfuck interpreter in bAdkOde. I finished implemented all the instructions, excepting for looping. I actually finished the code (and fixed all bugs) while I was in the air, flying from Dubai to Los Angeles. Emirates Airlines has power-plugs for your laptop on the seat. It’s pretty sweet!

An interesting thing I noticed was that I couldn’t perfectly emulate the input instruction. I’m feeding the brainfuck code to the interpreter from STDIN and so that might be the problem. I’ve noticed that brainfuck interpreters written in brainfuck have the same problem. You have to specify program input before hand. This is what I’ve decided to do. You write brainfuck code, and then mark the end of program code by an exclamation mark. After the exclamation mark, you provide any input, and then mark the end of input by another exclamation mark. Programs that do not have any input end with two exclamation marks. After I finished writing the interpreter, I commented it. While I was doing this, I noticed a lack of labels in bAdkOde. So, I decided to update the interpreter to include them. Speaking of which, I really ought to rewrite the interpreter sometime…

Anyway, here is the code to the interpreter. I’m providing a link to it, because the commented version is rather large. But here’s the expanded (without labels or macros), unformatted version:


Also, this is additional proof for Turing Completeness. Yes, I’m a nerd! πŸ™‚