Execute Brain****/D: Difference between revisions
m
Fixed syntax highlighting.
(Better second D entry) |
m (Fixed syntax highlighting.) |
||
Line 1:
{{implementation|Brainf***}}{{collection|RCBF}}
===Version 1===
<
void brainfuckRun(in dstring code) nothrow {
Line 87:
+++.------.--------.>+.>.");
}
}</
===Version 2===
Much faster version, code generated at compile-time, run at run-time:
<
string r;
foreach (immutable c; code)
Line 261:
+[-[->>>>>>>>>+<<<<<<<<<]>>>>>>>>>]>>>>>->>>>>>>>>>>>>>>>>>>>>>>>>>>-<<<<<<[<<<<
<<<<<]]>>>]"));
}</
LDC2 compiles this with full optimizations in 2.3 seconds, and the BF runs in less than 1.1 seconds.
|