It's called Brainfuck because it's seemingly impossible to read by humans, which is an important job for real programming languages. From the perspective of the computer/interpreter, it's much easier to understand (and therefore write an interpreter for) as it only has eight operations. It's practically just assembler code without all the semi-English names given to the commands for readability.
Also, it's implementer-friendly: parsing and tokenisation are trivial, as is implementing the interpreter. I wrote a 260-byte-long one in ARM assembly language back in the '90s just for fun.
Coding anything in Brainfuck, well, that's another matter!
Make a language that compiles down to brainfuck. That way you can write in a more friendly language but compile down into a language that you can easily interpret.
Yeah, but Brainfuck is also a terrible target for a compiler. And compiling a more friendly language down to Brainfuck would miss the whole joke aspect of esolangs, whereas something like INTERCAL, Q-BAL, *W, LOLCODE, &c., preserve the joke aspect.
Usability rather misses the point of esolangs.
INTERCAL isn't really a difficult language to write an interpreter for, though. The only real difficulty is in the lexer, but once you have an AST, the rest is easy.
A friend of mine wrote a converter that converts Brainfuck to one line of Python code to prove Python one-liners are turing complete: http://www.ricbit.com/code/turing.py
It's actually probably one of the simpler ways to do so. Brainfuck's esoteric-ness comes from its being hard to read by human programmers, which is important in a programming language. But the structure of the language itself (eight commands gets you everywhere) is a testament to the fact that computers in this universe are made of complexity that can emerge entirely from simple rules.
Now you're making me want to try to write a Brainfuck interpreter for Python. I've never written anything even remotely like an interpreter before, but I'm thinking a BF one really can't be that hard.
71
u/meltingdiamond Nov 24 '16
Writing a brainfuck interpreter has to be the worst way to prove turning completeness.