Yaren

From Esolang
Jump to navigation Jump to search

Yaren is an esoteric programming language created by User:PythonshellDebugwindow.

Overview

Yaren was designed in an attempt to bring Befunge's < and > commands to brainfuck. In Yaren, control flow is done by changing the direction of the program counter. The language is named after the de facto capital of Nauru.

Memory

Yaren uses a left- and right-unbounded tape of one-bit cells, each of which is initially set to 0. A cell pointer points to the current cell.

By default, the program counter moves to the right; however, it can move either right or left.

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 roles of 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 instances of [ and ] must be properly matched. All unrecognised characters are ignored.

Examples

These examples use the optional I/O commands.

Hello, world!

--+----+----.--+--+----+---+-.--+--+---+--+---..--+--+---+--+--+--+-.---+---+--+---.---+------.--+--+--+---+--+--+-.--+--+---+--+--+--+-.--+--+--+----+--.--+--+---+--+---.--+--+----+---.---+------+-.-----+---+--.

Truth-machine

,[>.<].

Cat program

>+-[,.][+-]<

External resources