BF+BF

From Esolang
Jump to: navigation, search

BF+BF is a esoteric programming language that is a combination of Befunge and Brainfuck Extended Type I. I (User:IAM) don't have the time to write this fancily, so I'll just include my badly written specification.

#### BF+BF Specification ####
### Terminology ###
* Code/Data Array: A 2D array where code and data is stored. Top left is (0, 0). It is infinite to the right and bottom. It initial contents is the code of the program. Spaces and uninitialized cells have a value of zero.
* Instruction Pointer: A pointer pointing at an item of the code/data array and having a direction.
* Data Pointer: A pointer pointing at an item of the code/data array, used to indicate which cell is being used currently.
### Execution ###
Execution of a BF+BF program begins with the instruction pointer in the top left and moving right. Each tick, the instruction pointer executes the instruction below it and moves one space in the direction it is moving. If the data or instruction pointer trys to move out of the code/data array, an error is signaled.
### Commands ###
An invalid command is an error.
* >: Move the data pointer one cell to the right.
* <: Move the data pointer one cell to the left.
* ^: Move the data pointer one cell up.
* V or v: Move the data pointer one cell down.
* +: Increment the cell under the data pointer.
* -: Decrement the cell under the data pointer.
* 0 to 9: Set the cell under the data pointer to a constant value.
* .: Output the contents of the cell under the data pointer.
* ,: Input a byte and store it in the cell under the data pointer.
* [: Scan for a ] in the direction that the instruction pointer is moving. [s and ]s can be nested. If it is not found, there is an error. Then jump to the command after the ] if the contents of the current cell is zero.
* ]: Jumps to th command after the matching [ if the curremt cell is nonzero.
* @: Ends the program.
* $: Sets the value in the storage (like BF Extended Type I) to the value under the data pointer.
* !: Sets the value under the data pointer to the value in storage.
* And }, {, ~, ^, &, | are like BF Extended Type I.
* U to go up, D to go down, L to go left, and R to go right (instruction pointer).