Execute Brain****/Java: Difference between revisions

m
Fixed syntax highlighting.
mNo edit summary
m (Fixed syntax highlighting.)
 
(2 intermediate revisions by 2 users not shown)
Line 1:
{{implementation|Brainf***}}{{collection|RCBF}}[[Category:Java]]
In this implementation of [[Brainf***]] in [[Java]], the code is read in all at once and checked for uneven brackets (unequal amounts of [ and ] commands). If that error occurs, the code will obviously not be run.
 
Under the hood, the program memory is an <tt>ArrayList</tt> of Integers which expands "infinitely" (limited by your system's memory) to the right (still [http://en.wikipedia.org/wiki/Turing_completeness Turing complete]). So, if the pointer moves past zero to the left, the program will exit and a "Pointer out of range" error message will be displayed.
Line 10:
More detailed information about the rest of the code can be found in the comments throughout it.<br clear=all>
{{works with|Java|1.5+}}
<langsyntaxhighlight lang="java5">import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
Line 160:
mem.set(pointer, new Integer(val));
}
}</langsyntaxhighlight>
9,476

edits