Braille

From Esolang
Jump to: navigation, search

Braille is a novelty language created by Brian McPherson in 2014. Braille programs are written using only symbols which appear in the Unicode Braille Patterns block (U+2800 to U+28FF).

Overview

Each Braille symbol is treated as a two-digit hexadecimal number, with the sequence of dots and absences of dots in each column of the symbol representing a binary string which determines the value of the hexadecimal digit.

The program occupies the same storage space used for memory, allowing non-instructional data to be incorporated into the program for use during execution of the program.

Braille is loosely based on the "Little Man Computer", created by Dr. Stuart Madnick in 1965 as an instructional aid.

Details

The program is loaded onto a tape of indefinite length, with the Unicode symbol U+2800 being the default symbol that initially occupies all positions on the tape which have not yet been defined.

Before the program is executed, an instruction pointer is placed at the position of the first symbol of the program, and a data pointer is placed at the cell immediately following the end of the program.

Some operations will need to access a shared storage cell located immediately prior to the first symbol of the program.

Each time an instruction is completed, the instruction pointer is advanced one place regardless of whether or not the instruction pointer was moved.

Each instruction consists of two parts, corresponding to the hexadecimal digits represented by the symbol. The first part indicates the type of action to be taken, and the second part indicates a value V which, provides information on how the action is to be carried out.

Commands

V = 0 1 2 3 4 5 6 7 8 9 A B C D E F Description
Action 0 Ends program, returning message number V.
Action 1 Adds the symbol in the cell located V places after the data pointer to the symbol in the shared storage cell.
Action 2 Subtracts the symbol in the cell located V places after the data pointer from the symbol in the shared storage cell.
Action 3 Replaces the symbol in the cell located V places after the data pointer with a copy of the symbol in the shared storage cell.
Action 4 Replaces the symbol in the shared storage cell with a copy of the symbol stored in the cell located V places after the data pointer.
Action 5 Moves the data pointer 2^V places forward.
Action 6 Moves the data pointer 2^V places back.
Action 7 Moves the instruction pointer V+1 places forward.
Action 8 Moves the instruction pointer V+2 places back.
Action 9 If the symbol in the shared storage cell has a value of zero, move the instruction pointer V+1 places forward.
Action A If the symbol in the shared storage cell has a value of zero, move the instruction pointer V+2 places back.
Action B If the symbol in the shared storage cell has a value above zero, move the instruction pointer V+1 places forward.
Action C If the symbol in the shared storage cell has a value above zero, move the instruction pointer V+2 places back.
Action D Replace symbol in the cell located V places after the data pointer with new symbol provided by the user.
Action E Send a copy of the symbol stored in the cell located V places after the data pointer to the user.
Action F Replaces the symbol stored in the cell located V places after the data pointer with a random symbol.

Examples

A "Hello, world!" program with output in ASCII

 ⠆⠄⡒⡆⡘⠀⢐⠊⠦⢦⠗⢾⠿⠂⢢⢾⢦⢦⠮⢄

A "Hello, world!" program with output in braille

 ⠆⡆⢤⡔⠈⠖⠙⠇⠗⠕⠺⠀⠂⠕⠇⠇⠑⠓

A Quine program

 ⠞⡆⠅⠄⡚⠈⠈⠈

A cat program

 ⡅⡆⡈

External resources