BrainfuckX

From Esolang
Jump to: navigation, search

BrainfuckX is an extension of brainfuck that is backwards compatible with all uncommented brainfuck programs.

Cells are unsigned bytes. Cell pointer starts in the leftmost cell.

Instructions:

+  - Add 1 to the current cell.

-  - Subtract one from the current cell.

>  - Move the cell pointer right.

<  - Move the cell pointer left.

[  - If current cell is 0 jump to corresponding ]

]  - Jump to corresponding [
 
.  - Send character in current cell to the current interface.

,  - Receive a character of input from the current interface and store it in the current cell.

@  - Cycle through interfaces. See Interfaces.

!  - Move the cell pointer to the leftmost cell.

^  - Move the instruction pointer to the instruction in position N where N is the value in the current cell. (Starting at 0)

;  - Move the instruction pointer to the last ^ ran.

*  - Move the cell pointer to the value in the current cell.

%  - Set the current cell and the next three cells to Unix time.

?  - Randomize the value in the current cell.


Interfaces:

The initial interface is console io. (STDIN / STDOUT)

Interfaces rotate through the following:

(STDIN / STDOUT)

(STDIN / STDERR)

URL - No input. Output writes to the end of the URL string. Use character 127 to delete the last character of the URL string.

FILEIO - read and write to the file at the URL string.

INTERNET - read the web page at the URL string.

SERIAL IO

TERMINAL - write a command until character 0. Then run the command in the system terminal. Then read the return code.