Artemis

From Esolang
Jump to navigation Jump to search

Artemis is a simple translation of reversible &brainfuck with support for procedure definitions. Artemis is concatenative and reversible. It was discovered by User:Orby in May of 2020.

Definition

Artemis operates on a right unbounded tape of unbounded cells. In addition to a data pointer, Artemis has an indirection count.

Command Action
i Increment the current cell, then increment the indirection count.
d Decrement the current cell.
{ Decrement indirection count, then jump after matching } if the cell pointed to by the current cell is zero.
} Jump after matching { if the cell pointed to by the current cell is zero.
: Begin/end procedure definition. The next token is the name of the procedure.

Invoking d when the current cell is zero, and invoking { when the indirection count is zero have undefined effects.

Definition of current cell

The value of the current cell is defined as the value of the data pointer if the indirection count is zero. If the indirection count is one, then the value of the current cell is defined as the value of the cell pointed to by the data pointer. If the indirection count is two, then the value of the current cell is defined as the value of the cell pointed to by the cell pointed to by the data pointer, and so on.

Relationship to &brainfuck

All Artemis commands must be separated by white-space. Artemis exhibits the following simple translation to reversible &brainfuck

Artemis &brainfuck
i >*
d <
{ &[
} ]
&brainfuck Artemis
> i { }
< d
* d i
& { }
[ d i {
] }

Defining procedures

The following example defines procedures for something similar to Reversible Brainfuck operations. The : defines the beginning of a procedure, followed by the name of the procedure, followed by the definition, and finally it is terminated with :. For example

 : > i { } :
 : < d :
 : + d i > { } :
 : - d i < { } :
 : [ d i { :
 : ] } :

See also