Execute Brain****/JavaScript: Difference between revisions
m
Fixed syntax highlighting.
m (<code>) |
m (Fixed syntax highlighting.) |
||
(5 intermediate revisions by 4 users not shown) | |||
Line 1:
{{implementation|Brainf***}}{{collection|RCBF}}
Presented here is the core of a Brainf*** interpreter/debugger written in [[JavaScript]] that is designed to run within a web page. The full source can be found at http://www.quirkster.com/iano/js/bf.html by viewing the page source.
<syntaxhighlight lang="javascript">var code; // formatted code▼
▲var code; // formatted code
var ip = 0; // current instruction within code
var nest = 0; // current bracket nesting (for Out button)
Line 22 ⟶ 21:
']':function() { if ( data[dp]) ip = ahead[ip]; else --nest },
',':function() {
},
'.':function() {
Line 136 ⟶ 135:
body();
dump();
}</syntaxhighlight>
|