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:
>3a>1b{!b?b>b[a)b-91b{=b+1[b>1b}+91b-93b{=b-1[b>1b}+93b(b+1a-33b}>0[a+1a>2b>a[b>1b{!b?b>b[a+1a-33b}>1b>a[b>0a>[aa>ab{=a>1a>[ab>3a{![a)a>[aa-62a{=a+1b-30000b)a>ba{+b>1b>[bb)b>0b-1b>0a}{-a+30000b)b>0a}(b(a+62a}+62a-60a{=a-1b)a>1a>[aa-ab>ba{-b>1a>[aa+30000a>ab)b>0b>0a-1a}{+a>1a>[aa+ab)b>0a-1a}(b(a+60a}+60a-43a{=a+1[b+43a}+43a-45a{=a-1[b+45a}+45a-46a{=a"[b+46a}+46a-44a{=a)a>2a>[aa>[a[b>2a+1[a(a+44a}+44a-91a{=a(a)b)a>[bb{=b>0b>1[b{![b(a+1a)a>[aa)a-91a{=a+1[a>1a}+91a-93a{=a-1[a>1a}+93a(a}(a-1a)a>1b}(a(b)a+91a}+91a-93a{=a(a)b)a>[bb{!b>0b>0[b-1[b{![b(a-1a)a>[aa)a-91a{=a+1[a>1a}+91a-93a{=a-1[a>1a}+93a(a}>0b}(a(b)a+93a}+93a(a+1a}>1a>0b}{!b"85"110"109"97"116"99"104"101"100"32"98"114"97"99"107"101"116"115>0b}
Also, this is additional proof for Turing Completeness. Yes, I'm a nerd! 🙂
unable to leave a comment… testing…
@Lobo
I wasn’t able to comment on this post, so I just tried on the very first post of your blog… it worked here!
I just wanted to say, ‘Posted with your help… Thanks!’
@Lobo
Ah, it’s just that I require first-time posters to be approved. Once you’ve been approved, you can post 🙂 I’m glad I was able to help with your post!