Anonymous user
Execute Brain****/C++: Difference between revisions
Fix code; Input is -1 on EOF but that'll do for now.
m (moved RCBF/C++ to Execute Brain****/C++) |
(Fix code; Input is -1 on EOF but that'll do for now.) |
||
Line 1:
This is an implementation of [[Brainf***]] originally written in [[C++]] by [[User:Short Circuit|Mike Mol]] and [[User:Mwn3d|Mike Neurohr]], for Rosetta Code. It is licensed under the same license as Rosetta Code itself.
It may be fed BF instructions either through standard input (i.e. terminal keyboard input), or through a file named as the first command-line argument.
RCBF is intended for educational purposes only; There is no guarantee it won't lock up your computer. (Though Mike M thinks he's got that bug ironed out...) (We'll no it wasn't, but it should be now -- RdB)
{{works with|g++|4.1.3}}
Line 10 ⟶ 9:
<lang cpp>// RCBF -- A free Brainfuck interpreter written for Rosetta Code (http://rosettacode.org)
// Created by Mike Mol and Mike Neurohr, and under the same license as Rosetta Code.
// Repaired by Robert de Bath -- but Ghods is it slow!
// Test with this Hello World, it breaks BF interpreters
// >++++++++[<+++++++++>-]<.>>+>+>++>[-]+<[>[->+<<++++>]<<]>.+++++++..+++.>
// >+++++++.<<<[[-]<[-]>]<+++++++++++++++.>>.+++.------.--------.>>+.>++++.
#include <list>
Line 239 ⟶ 243:
int input(memptr_t &ptr)
{
return SUCCESS;
}
Line 345 ⟶ 344:
codeptr_t tmppos = code.end();
rec.open = --tmppos;
rec.close = rec.open;
// Because we always encounter forward jumps before back jumps,
|