From Esolang
Jump to navigation Jump to search

Emblia is a minimal esolanguage by User:Keymaker, designed in 2018 but not published until 2020. The language is a type of infinitely branching counter machine, and is an OISC.

Program and execution

A program is a finite array of non-negative integers. A program can access a finite number of unbounded registers, all initially 0. There is a pointer that is initially at the first cell of array.

The program that is read encodes the program array in a simple way. Initially there is one 0-cell. _ appends a new 0-cell at the end of the array, 1 increases the current last cell of the array by one, and all other characters are ignored. The program 1__1_11 would define the program array (1, 0, 1, 2). This example program consists of four cells and uses registers R0, R1, and R2.

The language uses a certain sequence of numbers in its computations. In the context of Emblia these numbers are called insignia-numbers, but it is the same set of numbers that in Natyre are called event-numbers. The first ten insignia-numbers are 1, 3, 6, 10, 15, 21, 28, 36, 45, and 55. They can be generated easily: Take integers s and n, both initially 0. Increase n by 1, add n to s. Now s is the first insignia-number. Repeat (n=n+1, s=s+n). This sequence can be found in OEIS: [1].

As the language is an OISC, there is only one instruction, a process that first increases a register, then moves the pointer, and then checks the pointer location for a halting condition. This process is repeated infinitely unless the program halts.

  • First, increase the register that is referred to by the current cell's value. If, for example, the cell under the pointer has value 10, then R10 is increased.
  • Then, the new value of the register is inspected. If the value is an insignia-number, the pointer is moved left by the current cell's value (10 in this example). If the value is an ordinary number instead, as it ever-increasingly will be, then the pointer is moved right by the current cell's value (10, here). If the pointer moves out of the array boundary it wraps.
  • Last, the new location of the pointer is compared to what it was before it moved. If the pointer's new location is the very same it originally left, the program halts (successfully).

Computational class

The language is Turing-complete. It is proven via four-register (or less) Natyre to Emblia translation. Natyre is Turing-complete with four registers. The translation tool was designed so that it can readily use the Minsky Machine to Natyre translator's output (for MM programs using only registers A and B). See the Emblia page (link below) for more details.

Translating into Natyre

There is a simple process to translate Emblia programs into Natyre. The process does not work the other way around this easily because in Natyre the 'next state' is not bound and defined by the program geography unlike in Emblia; in Natyre the control may be transferred to any state, in Emblia it is bound either x steps left or right depending on the current cell and the value of the associated register.

In this example let us use the program (1 2 3 1). Go through every cell; print instA RB instC instD, where A is replaced with the current cell's position, B with the cell's value, C with the location where the pointer is moved in ordinary number case, D with the location where the pointer is moved in insignia-number case. This yields:

inst0 R1 inst1 inst3
inst1 R2 inst3 inst3
inst2 R3 inst1 inst3
inst3 R1 inst0 inst2

(The halting behaviour of an Emblia program does not translate into Natyre; Natyre has no halting, so a halting Emblia program would simply get into an infinite loop and keep increasing a register.)

External resources

  • Emblia page (detailed explanation of the language and translation, Natyre-to-Emblia translator, interpreter in Python)