Axios

From Esolang
Jump to navigation Jump to search

Axios is an esoteric programming language created in 2022 with only two core operations, as well as two I/O operators. Despite its extreme minimalism, Axios is Turing complete, as is shown by an implementation of Rule 110.

Language overview

Axios operates on a list of cells, each of which can have the value 0 or 1. The list starts with only one cell whose value is zero, but it can grow over time.

Like a Turing machine, Axios also switches between various states. Each state changes and reads the value of the cell at the pointer (only user input may prevent the cell from changing). The languages two core operators are 1 and 0 (not to be confused with the cell values).

The 1 operator divides code into states. A different state can be found to the right and left of each 1 operator. There is also a termination state, which is not written but lies after all other states.

The 0 operator performs the following functions:

  • The presence of a 0 operator in a state indicates the pointer remains where it is. The absence of a 0 operator indicates the pointer moves forward down the list of cells. If the pointer has to move when it is already at the end of the list, a new cell is added to the end (value set to zero), and the pointer returns to the beginning.
  • The number of 0 operators indicate the next state. By default (i.e. no 0 operators), the next state is the next one written in code. Otherwise:
    • If the current cell is one (after changing it), each 0 operator indicates that the next state moves back one. So one 0 repeats the current state, two 0s goes to the state immediately before the current state as written in code, etc. This process loops around, so it is possible to return right where you started.
    • If the current cell is zero (after changing it), continues as normal to the next state written in code.

In addition, the two I/O operators are 2 and 3.

2: Outputs the value of the current cell as a bit (after changing the value of the cell, before moving the pointer, and before changing states, if applicable). Each time 21 bits are output, the program prints a character so long as the output forms a valid UTF-32 encoding (in little-endian order). Attempting to output 21 ones also resets the list used for the 3 operator. (This is safe, since there is no valid character that can be output by 21 ones.)

3: Changes cells according to the individual bits contained in UTF-32 characters input by the user, which are stored in a list in little-endian order. The 3 operator only asks for user input when it uses all the bits in the list (21 bits per UTF-32 character; other bits stored in UTF-32 characters must always be zeroes and are therefore ignored). It is also possible to empty the contents of this list by attempting to output 21 ones. This operation occurs at the beginning of a state, and its presence within a state means the current cell will not be changed except according to user input.

While they are notated here with ASCII numerals, a great variety of numbering systems can be used to type Axios, including Devanagari and Eastern Arabic numerals.

For more information, check out the Guide to Axios.

Example programs

Print "Hello, world!"

Every twenty-one two operators output a character. Since the current cell alternates between zero and one, the current state
moves in a back-and-forth pattern, generally traveling upwards until the termination state. The character(s) each line prints
are noted on the left.

       00001
  !    22222222222222201   00001       222201   200001
d & !  2222222222222201    200001      2201     2200001    22
l & d  2222222222222201    200001      201      2200001    22
r & l  2222222222222201    2200001     2201     22200001   2
o & r  2222222222222201    200001      201      2200001
w & o  2222222222222201    222200001   201      22200001
  & w  22222222222222201   22200001    22222
, &    22222222222222201   200001      201      200001     22
o & ,  2222222222222201    2200001     201      2200001
l & o  2222222222222201    222200001   201      2200001    22
l & l  2222222222222201    2200001     201      2200001    22
e & l  2222222222222201    2200001     2201     2200001    201     200001
H & e  2222222222222201    200001      2201     200001     22201   20000

External resources

GitHub page for Axios