Seribund

Seribund is a one-instruction esolang based on the instruction being executed the number of times its predecessor modified the memory to. The language was designed by Keymaker in 2014.

Description

For memory, Seribund uses registers (all initially zero). When an instruction is executed, a register is affected. Registers may hold any integer, although it is only ever possible to use zero and positive values.

An instruction is repeated a number of times. This number is defined by the previous instruction's result. Initially, when the very first instruction of the program is executed for the first time, this number is 1.

After executing an instruction, the program flow moves on to the next instruction. If the current instruction is the last one, the flow moves to the very first. A program must have at least one instruction.

If, for example, a register is modified to value 30, the next instruction will be executed thirty times. In case of 0, the next instruction will not be executed, and the flow will move on to the next instruction, and execute it once. In case of 1, the next instruction will be executed once. In case a register is set to a negative value, the next instruction will not be executed, and the program will terminate successfully.

An instruction, one per line, consists of a single pair of parentheses inside which there are three parts. The first part is always a name (any string of characters a-z 0-9, at least one character long, always beginning with an alphabet) of a register. The second part is '+' or '-', for addition and subtraction respectively. The third part is a register or a constant (non-negative) integer. The first register in instruction is set to the result of the instruction's operation. For instance, (abc+5) would take abc-register's value, add 5 to it, and then store the result to abc-register. (ee-ff) would take ee-register's value, subtract ff-register's value from it, and store the result in ee-register. (n+n) would take n-register's value, add n-register's value to it, and store the value in n-register.

Programming

Below is an example that might shed some light on how to program in Seribund. One approach to it, anyway. (Note that the language itself does not allow comments, they need to be removed.) This example shows how to make a program that initializes variables on its very first cycle and on next cycles never does it again.

(a+1) ; on first cycle, x=1, execute this once, make a=1
(a+0) ; yields 1 if a is 1, otherwise 0
(rega+300) ; if previous line yielded 1, set rega
(a+0) ; yields 1 if a is 1...
(regb+55) ; if previous line yielded 1, set regb
(a+0) ; yields 1 on first cycle
(one+1) ; create a constant
...the rest of the program goes here...
(a-a) ; set a to zero; the initial code never happens after this

The program without comments and an additional line that just increases a register can be found here.

Below is an example of a program that multiplies two numbers, stored in registers a1 and a2. The result will be stored in res.

(one+1) ; create constant 1
(a1+234) ; store 234 to a1
(one+0) ; yields 1
(a2+565) ; store 565 to a2
(a1+0) ; get a1's value (234) for next instruction
(res+a2) ; add 565 to res 234 times
(q-1) ; decrease q (0) by one; negative value for next instruction, so quit

Computational class

Seribund is Turing-complete. One way to show this is Minsky Machine to Seribund translation, for which there is a tool available here. An example MM program here, its Seribund translation here.

Interpreter

An interpreter written in Python can be found here. Since the language has no input/output the interpreter constantly shows the state of memory and what was executed and how many times the next instruction will happen.

-- Keymaker, 20.9.2014