++Brainfuck
Jump to navigation
Jump to search
Commands
Command | Description |
---|---|
>
|
Move the pointer to the right. |
<
|
Move the pointer to the left. |
+
|
Increment the memory cell under the pointer. |
-
|
Decrement the memory cell under the pointer. |
.
|
Output the character signified by the cell at the pointer. |
,
|
Input a character and store it in the cell at the pointer. |
:
|
If the cell under the pointer is 0, read the next command. |
;
|
If the cell under the pointer is not 0, read the next command. |
)
|
Jump forward to the next ( .
|
(
|
Jump backward to the previous ) .
|
0
|
If the last ; is not true, read the next command.
|
1
|
If the last : is not true, read the next command.
|
}
|
If the current byte is 0, jump over the next command. |
{
|
If the current byte is not 0, jump over the next command. |
Examples
Cat program
This cat program repeats infinitely.
;),.(
Truth-machine
The following is a commented version of a truth-machine implementation.
INPUT , SET THE TEST CELL TO MINUS 48 TO LATER INCREMENT IT TO GREATER OR EQUAL ZERO >> ------------------------------------------------ BACK TO INPUT << SKIP ON FIRST ENTRANCE : ) TO COPY CELL > BUILD COPY CELL + REPLACE THIS TEXT WITH A DOT TO TRACE THE COPY CELL INCREMENTATION > COMPUTE TEST CELL + BACK TO INPUT CELL << - REPEAT UNTIL THE INPUT CELL IS ZERO THE COPY CELL WILL THE EQUAL THE ORIGINAL USER INPUT THE TEST CELL WILL CONTAIN A NUMBER EQUAL TO OR GREATER THAN ZERO FOR SIMULATING A CONDITIONAL ; ( TO TEST CELL >> IF THE TEST CELL IS ZERO THE FOLLOWING LOOP WILL BE SKIPPED : SKIPPING IS REALIZED IF THE TEST CELL EQUALS ZERO ) TO COPY CELL < PRINT COPY CELL . TO TEST CELL > ( THIS SECTION IS ONLY REACHED IF INPUT IS ZERO AND PRINTS THE COPY CELL ONCE < .
A rendition with comments culled is reduced to the following:
,>>------------------------------------------------<<:)>+>+<<-;(>>:)<.>(<.
Interpreter
- Common Lisp implementation of the ++Brainfuck programming language.