Andromeda

From Esolang
Jump to navigation Jump to search
Andromeda
Paradigm(s) imperative
Designed by User:ZM
Appeared in 2018
Memory system queue-based
Dimensions two-dimensional
Computational class Turing-complete
Reference implementation See #Implementation
Influenced by Befunge
File extension(s) .and

Andromeda is a two-dimensional, queue-based programming language in which, apart from the usual direction-changing arrows (which also serve additional purposes), there is only one additional command. The language was created and implemented in 2018 by User:ZM.

Syntax

Andromeda is a two-dimensional language. It uses a square grid whose top and bottom (but not left or right) are joined together. The language has five commands: the directional arrows ><^v, which are used for changing the direction of the instruction pointer and pushing items onto the queue, and the question mark ?, which pulls items from the queue and can be used for control flow. Any characters other than the five mentioned are ignored.

The instruction pointer starts at the top left edge of the grid, moving right. Program execution ends when the instruction pointer exits the left or right edge of the grid.

The directional arrows serve two purposes:

  • When the instruction pointer hits an arrow which points neither in the same direction or the opposite direction as the instruction pointer, it turns to face the same way as the arrow.
  • If, however, the arrow points the same direction as the instruction pointer, it pushes a 1 onto the queue.
  • If the arrow instead points in the opposite direction as the instruction pointer, a 0 is pushed onto the queue.

? pulls the oldest item from the queue. If it is a 1, the instruction pointer is rotated counterclockwise; if it is a 0, the instruction pointer is rotated clockwise.

Examples

coming soon

Computational class

Andromeda is Turing-complete; the easiest way is probably via cyclic tag, which can be easily translated into Andromeda using the following structure:

(initialization)v>(ones and zeroes translated into > and <)v>     v 
                >?                                         >? ... >v
                 >                                         ^>     ^ 
                ^                                                  <

Restrictions

Although Andromeda in its base state is already a rather minimal language, some commands can actually be removed from the language without affecting Turing-completeness. ? can obviously not be removed, lest the language loses its only control flow mechanism. Similarly, one arrow is required to allow for data storage. The author conjectures that this is enough for Turing-completeness, but no formal proof exists.

Implementation

An interpreter is available here; it doubles as a simple Andromeda program.

See also