Readable Brainfuck

From Esolang
Jump to navigation Jump to search

Readable Brainfuck (RBF) is a remake of Brainfuck that is intended to be more readable than traditional brainfuck

Readable Brainfuck isn't exactly Brainfuck that has 8 commands. It works the same way Brainfuck does, but readable.

Note: RBF doesn't raise any exceptions like Brainfuck has (like underrun error), but give you warnings instead (like recursive loops)

Features

It has commands that can manipulate data in the array, some new features are:

1. Wrap around - meaning if you try to move left on the first index, it just goes on the last index instead

2. More than 30,000 cells - so you have more to work with

3. Brainfuck compatible - You can write Brainfuck code in a RBF code as well (and vise versa)

4. Case-insensitive - "movl", "MOVL", "Movl" are same

Commands

Here are some explanation for each command Note: commands are case-insensitive, so it will work even on lowercase, uppercase, or any other case

Readable Brainfuck brainfuck Equivalent
movl <
movr >
add +
sub -
prnt .
input ,
while [
end ]

Note: There's no addition, subtraction of values in RBF (like +, and - in Brainfuck) maybe if I change my mind I will add those as well Update: I did add it because while and end will basically not work well

Commands:

- set {value} {value: int} - writes {value} into the current cell

- movr - moves the pointer to the right of the current cell

- movl - moves the pointer to the left of the current cell

- cls {index} {index: pmark:int optional} - clears/resets the current or the {index} to 0

- prnt {index} {index: pmark:int optional} - prints the ASCII value of the current or {index} cell

- prntn {index} {index: pmark:int optional} - prints the numerical value of the current or {index} cell

- goto {index} {index: int} - go to a specific {index}

- input {index} {index: pmark:int optional} - Retrieves one char of data from the user and save it on the current or {index} cell

- add {index} {index: pmark:int optional} - adds value to the current or {index} cell

- sub {index} {index: pmark:int optional} - subtracts value to the current or {index} cell

- while - if current cell is zero, jump to the corresponding end part

- end - if current cell is not zero, jump to the corresponding while part

- mod {index} {index: pmark: int optional} - convert the current or {index} cell to modulo of 256

- unsign - disables signed values

- sign - enables signed values

- exit - Closes the interpreter

RBF supports both implicit and explicit comments, anything that isn't listed up there are ignored, to make a reserved keyword usable as a comment, use the explicit comment with a # at the beginning and # at the end # like this # Commands can be separated by a space, semicolon or a newline

Examples

Hello World:

SET 72;PRNT;SET 101;PRNT;MOVR;MOVR;SET 108;PRNT;PRNT;MOVL;SET 111;PRNT;MOVL;SET 44;PRNT;SET 32;PRNT;SET 87;PRNT;MOVR;PRNT;MOVL;SET 114;PRNT;MOVR;MOVR;PRNT;MOVL;MOVL;SET 100;PRNT;SET 33;PRNT;SET 10;PRNT;EXIT

Source code

Here is the official release of Readable Brainfuck GitHub

Turing completeness

RBF is a turing complete language because Brainfuck.