Execute Brain****/C++: Difference between revisions
m
Fixed syntax highlighting.
m (RCBF moved to RCBF (C++): Language-specific page title) |
m (Fixed syntax highlighting.) |
||
(18 intermediate revisions by 9 users not shown) | |||
Line 1:
{{implementation|Brainf***}}{{collection|RCBF}}
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}}
<
▲<pre>// 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 ⟶ 244:
int input(memptr_t &ptr)
{
return SUCCESS;
}
Line 345:
codeptr_t tmppos = code.end();
rec.open = --tmppos;
rec.close = rec.open;
// Because we always encounter forward jumps before back jumps,
Line 394 ⟶ 395:
// We never found a close branch
return BRANCH_NOT_FOUND;
}</
|