esolang

Aubergine

Four instructions, four variables and one constant. The program is its own memory.

Boily, 2008 · Turing complete: yes · ●●○ moderate · esolangs.org

Tested with 4 known programs · Hello World on Try It Online: identical except the line end · Test method

Run it

Expected: abc

The idea

Boily made Aubergine in 2008. A program is read as a list of integers, one per character, and that list is all the memory there is. Instructions and data share the same space, so a program reads and rewrites its own text.

Read the story

An instruction is three characters, an operator and two parameters. =aA means "set a to the value of the cell a points at". There are no literals except 1, so every other number has to be found in the program or built from it.

The machine

CodeDoes
=xySet x to y
+xyAdd y to x
-xySubtract y from x
:xyIf y is not 0, set the instruction pointer to x
ParameterIs
a bTwo variables, 0 at first
A BThe program cell that a or b points at
iThe instruction pointer, 0 at first
oOutput when written, a character of input when read
1The number one, only as the second parameter

After every instruction i grows by 3, also after a jump. When i leaves the program, it stops. Values are integers of any size, negative ones too.

Example

The first program copies three characters of input.
Expected: 0

The first program copies three characters of input. The second is the truth machine from esolangs.org. It stores the input character over its own first cell, prints it, and then loops back for as long as that character was 1.

Hello World by Quintopia keeps the greeting backwards at the end of the program and walks a down over it.

Expected: Hello, World!

=aA reads the program's first character, =, which is 61; minus one gives 60, the last cell. Each round prints the cell at a, steps a back and rewrites the loop so it ends at the right moment. The newline in the middle is printed too, so the length of the text matters.

Patterns it teaches

Further

Self-modifying

Write your own in Run Convert a program from Aubergine

Implementation

JavaScript interpreter, source and command line

A JavaScript interpreter, used in the browser and on the command line. Id: aubergine.

Command line

shib run aubergine -e '=oo=oo=oo' --input 'abc'
shib manual aubergine

Source

Module
langs/tio/ports.js
Interpreter
langs/tio/aubergine.js

Docs: Kernel instructions · The .shib format · Command line · Adding a language

Source esolangs.org (CC0) · Edit on esolangs.org