BARREN

From Esolang
Jump to navigation Jump to search

BARREN is a small output-only imperative language. Most of its specifications came from a hypnopompic state.

Language overview

BARREN's memory consists of 64 cells, numbered 0-63. Each cell can be in one of 6 states: VOID, REVEALED, COVERED, STATIC, DYNAMIC, RECKONING. A single pointer is used to manipulate memory.

A BARREN program halts only if instructed. If a program runs out of instructions, it wraps around and starts executing from the first instruction again.

All instructions must be written in all-caps, separated by any amount of spaces or newlines.

Below is the list of available instructions supported by BARREN.

Instruction Description
(address) Moves the pointer to a specified cell. The address should be written in binary, with all 6 bits. For example, 000110 will move the pointer to cell 6.
"(address) Moves the pointer to a specified cell. If the cell is VOID, skips past a matching " instruction.
" Jumps back to the matching "(address) instruction.
(state) Beginning of an if-statement. Checks if the current cell is in a specified state.
RENDER Else-statement. Optional.
ALTER
VEIL Marks the end of an if-statement.
HINDRANCE
MERGE (address) Output a character using the current cell and the specified cell. See MERGE table below.
MERGE Output a character using the current cell and itself. See MERGE table below.
PATIENCE No-op.
AWAIT
AGAIN Output the same character that was output last.
REPEAT
SHIFT SHIFTs the current cell. See conversion table below.
MORPH MORPHs the current cell. See conversion table below.
TRANSMUTE TRANSMUTEs the current cell. See conversion table below.
EMERGE Halts the program.
SUBMERGE

MERGE table

current cell
VOID REVEALED COVERED STATIC DYNAMIC RECKONING
specified cell VOID   M Z K / X
REVEALED P H G V . L
COVERED E I D > Q U
STATIC J T < 0 O F
DYNAMIC R S " A 1 W
RECKONING C Y ? B N :

Conversion table

current cell
VOID REVEALED COVERED STATIC DYNAMIC RECKONING
SHIFT RECKONING COVERED VOID REVEALED REVEALED DYNAMIC
MORPH DYNAMIC RECKONING STATIC DYNAMIC COVERED COVERED
TRANSMUTE COVERED STATIC RECKONING VOID STATIC DYNAMIC

Error handling

If a program encounters an illegal instruction, it will print out UNINTELLIGIBLE MUTTERING "(instruction)" AT LINE (line number) and then crash. The line number will be written in binary.

Sample programs

Hello world

MORPH SHIFT MERGE AWAIT 100011 TRANSMUTE 
011010 MERGE 100011 SHIFT MERGE 000000 
AGAIN TRANSMUTE 100011 MORPH 011010 
MERGE 100011 000011 MERGE SHIFT 
MERGE 011010 011010 MERGE 100011 000100 
MERGE 011010 000011 MERGE 000000 MORPH 
MERGE PATIENCE 000100 MORPH MERGE 000000 
EMERGE

Prints HELLO WORLD.

Truth machine

MORPH TRANSMUTE
STATIC
MERGE SUBMERGE
ALTER
DYNAMIC
MERGE "000000 REPEAT "
VEIL HINDRANCE

Set to 0. TRANSMUTE can be erased to set it to 1.