Yaren

From Esolang
Jump to navigation Jump to search

Yaren is an esoteric programming language by User:PythonshellDebugwindow.

Synopsis

Yaren was designed when I realized that the < and > symbols in brainfuck look like they should alter the program pointer's direction (don't worry, this isn't another brainfuck derivative). In this language, control flow is done by changing the direction of the program counter, sometimes conditionally. It is named after the de facto capital of Nauru.

Memory

Yaren uses a doubly-unbounded (left and right) tape of cells, which are each one bit in size. A cell pointer points to the current cell, and starts at the 0th cell.

By default, the program counter moves to the right; however, it can move either right or left. Programs are not two-dimensional.

Syntax

In Yaren, each character is its own command. The language has few commands:

  • + toggles the current cell, and then increments the cell pointer
  • - decrements the cell pointer
  • [ jumps to its matching ] if the current cell is 0
  • ] does nothing, and simply serves as a partner for [
  • < causes the program counter to start moving to the left
  • > causes the program counter to start moving to the right

When the program counter is moving to the left, the [ and ] commands are reversed.

Additionally, the following I/O commands can be implemented, although this is not required:

  • , reads a byte from STDIN and writes it to the current cell and the 7 cells to its direct right, with the current cell getting the LSB
  • . takes the byte signified by the current cell, the cell to its right, the cell to that cell's right, and so on, and writes it to STDOUT (the bit at the current cell is the LSB)

All unknown characters are ignored and treated as comments.

Examples

Truth-machine

Uses the optional I/O commands.

,[>.<].

Cat program

The following constitutes an infinitely repeating cat program which does not cease its operation even if consuming a zero byte:

,.[+-]+-[,.[+-]+-]

Interpreter

  • Common Lisp implementation of the Yaren programming language.