Bojan Rosko Bojan Rosko - 1 month ago 14
Brainfuck Question

What's wrong with brainfuck on ideone?

Clearly, there is something wrong with my understanding of brainfuck, or there's something wrong with bf interpreter on ideone.com.

By entering code as simple as

,.,.
(reads two characters and prints them), I get an error "bff: out of memory (871638280)" . Why do I get this ?

NOTE: The true problem is that I'm trying to solve a problem on SPOJ, and some code that works on brainfuck interpreters that I found across the internet, doesn't work on SPOJ and ideone.com.

Answer

It appears to work fine, my BF torture test runs properly.

ideone.com 9fQ2Ej

I am NOT going to try to fight this UI to make the BF look correct! It's here: https://github.com/rdebath/Brainfuck/blob/master/bitwidth.b

It does appear to have a large cells size though and isn't fast enough to offset this.

EDIT: (No newlines below Grrr)

Anyway Daniel Christofani's end test:

,>+++++++++,>+++++++++++[<++++++<++++++<+>>>-]<<.>.<<-.>.>.<<.

Gives 'LA' showing that the program accepts input successfully, gives the correct character for newline and gives '-1' for end of file. As it's a big cell interpreter this is perfectly acceptable.

HOWEVER; I do see your point, there's something weird going on I suggest you try one of the javaScript implementations. They run in your browser.

http://t-monster.com/apps/brainfuck_IDE

http://www.iwriteiam.nl/Ha_bf_online.html

http://brainfuck.devbar.de/