4 ms·
put the interpreter into a function placed in an array at the beginning. use an array constructor for this and your whole interpreter is now wrapped by a bf loo
by vrighter 3y ago
put the interpreter into a function placed in an array at the beginning. use an array constructor for this and your whole interpreter is now wrapped by a bf loop at the start of the program. Which bf will immediately skip tecause the initial cell will be 0. Then index into an array to get the first item. Another loop on the initial cell. Skipped. Then pass the bf source to the function. No brainfuck commands are needed for this.
<pre><code> [ function(src){
// interpreter goes here
} ][[]]("brainfuck source goes here");
</code></pre>So your interpreter could be anything you want and it won't conflict with any other bf code as long as you keep your square brackets matched up (this is easy to do in js).
The rest is, of course, an exercise left to the reader.