Afterstar
Afterstar is a minimal esolang based on deterministic division and program-defined multiplication of a single unbounded memory value, designed by User:Keymaker in early 2024 but published near the end of the year.
Program and execution
The language operates on an array of integers, which is given as the program. There must be at least one integer and there is no limit to their amount or their size (other than that they be non-negative). Each integer has an index number that grows by one for each successive integer, the first being at index 1. The index pointer points to one of the integers, initially to the first. The memory is an unbounded non-negative integer, initially the smallest prime, 2. If the memory ever becomes 0, the program halts.
One step of execution consists of first checking if the memory is 0, and halting if so. The instruction pointer attempts to divide the memory value with its current value (not the value it is pointing to in the array, but its own value), and if the memory is dividable (and remainder is zero), then it is divided by the index pointer's value. Right after, if dividing succeeded, the memory is multiplied by the integer in the array that the index pointer is pointing to. Then (whether dividing and multiplying happened or not), the index pointer is increased by one, unless it is already pointing to the last integer, in which case it is set to 1 (the first integer in the array).
Program formats
A program encodes the list of integers in a simple unary format. The character (
is repeated n times, followed by the character *
. A sample program:
(* (((((* (((* ((((* *
Because the size of the programs will easily become uncontainable on any hardware, there is an alternative format that allows for describing the array index (left) and the actual integer to store there (right). The integers at indexes that are not specified are set to match their index numbers. This would be the above program in the practical format:
2:*:5 5:*:0
A simple interpreter
Here is a simple no-IO interpreter in Python to showcase the simplicity of the language. A shorter one could no doubt be made, and in some golfing language it may be possible to squeeze this interpreter or something like it into a few characters.
a = [1,5,3,4,0] # array of integers m = 2 # memory p = 0 # index pointer while m > 0: if m % (p + 1) == 0: m = (m // (p + 1)) * a[p] p = (p + 1) % len(a)
Computational class
The language is Turing-complete, as is shown via Minsky Machine translation. See external resources.
External resources
- Afterstar information (detailed explanations of the language and the MM translation, translator program, interpreter in Python)