-
Notifications
You must be signed in to change notification settings - Fork 0
Brainfuck Interpreter
Brainfuck Interpreter is a Java program that directly executes Brainfuck source code; parse the source code and perform its behavior directly.
java -jar BrainJuck.jar interpreter [-debug] source_file
source_file - Full path to Brainfuck source code file.
For example:
java -jar BrainJuck.jar interpreter /examples/Copyright.bf
-debug - Enables debug command # (hash / number sign), and also prints out executing stats at the end of the program.
For example:
java -jar BrainJuck.jar interpreter -debug /examples/Copyright.bf
It outputs
BrainJuck - Rapid Application Development with only 3 bits!
Copyright (c) 2016 Anar Software LLC. < http://anars.com >
Brainfuck Interpreter Statistics
=================================
Source Code File : /examples/Copyright.bf
Source Code File Size : 1963 bytes.
Number of Brainfuck Commands : 1963
Number of Commands Executed : 6193
Total Executing Time : 31 milliseconds.
Source Code Load Time : 4 milliseconds.
Command Execution Time : 27 milliseconds.
Number of Memory Cells Used : 2
End of Execution Memory Dump :
{010} 000 000 000 000 000 000 000 {.} . . . . . . .
It uses 8-bit unsigned char memory cell, which are initially set to 0 (zero)
For example:
+.
It outputs ASCII 1 (one) to the console.
Interpreter wraps the cell value to back 0 (zero) when larger than 8-bit (28 − 1 = 255) and wraps back to 255 (two hundred fifty five) when the cell value is less than 0 (zero) For example:
--.
It outputs ASCII 254 (two hundred fifty four) "■" (black square) to the console.
It allocates memory dynamically when the cell value is increased or decreased.
For example:
The Interpreter doesn't allocate memory, when you run this code below.
>>>
However, it expands the memory size to 4 bytes, when you run this code below;
>>>+
Each memory cell 8-bit unsigned char, and initially set to 0 (zero).
BrainJuck - Rapid Application Development with only 3 bits!
Copyright (c) 2016-2021 Anar Software LLC. <http://anars.com>
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>
Brainfuck Language
BrainJuck Tools
- What is BrainJuck?
- Brainfuck Interpreter
- Brainfuck Optimizer
- Brainfuck Generator
- Brainfuck Formatter
Examples
ASCII Characters