Aubergine

From Esolang

Jump to: navigation, search

Aubergine is a minimalist language with 4 instructions, 4 variables, and a single constant.

Contents

[edit] General syntax

An Aubergine program mixes instructions and data in the same space, as a list of integers. Before execution by an interpreter, the script is split character-wise, then their ASCII integer value is taken.

Each cell can hold any integer value, even negative ones.

Instructions consist of three consecutive integers, where the first indicates which kind of instruction is to be executed, and the rest tells what is to be manipulated.

[edit] Variables

[edit] a and b

"a" and "b" are two multi-purpose variables. They initially are set to zero.

These variables can be used as pointers. When written "A" and "B", they point to cells in the program space. For example: if a equals 3, then A equals the integer at the program's fourth space.

[edit] Instruction pointer

The letter "i" represents the instruction pointer. It is automatically incremented by 3 after every instruction execution. Initially, "i" equals zero, which is also the first program cell.

You can use "i" in the same manner as "a" and "b". Note that there is no indirection with "i", i.e. "I" is not valid.

[edit] Outside world

"o" -- short for Outside -- is only valid with the assignment instruction. When used as first parameter, it outputs an integer converted to a character to the screen. As a second parameter, it inputs a single character converted to an integer.

[edit] One

The "1" constant returns the integer 1. It cannot be used as an instruction's first parameter!

[edit] Instructions

[edit] Assignment

Equal (=) puts the second parameter's value into the first paramater.

Putting either a negative value, or one which is greater than the program's length, into "i" halts the program.

[edit] Increment

Plus (+) increments the first parameter by the second parameter's value.

[edit] Decrement

Minus (-) acts as plus, but decrements the first parameter.

[edit] Conditional jump

Colon (:) is a conditional jump. If the second parameter's value is different from zero, then the instruction pointer is set to the value of the first parameter. Otherwise, it does nothing.

Even if the jump was successful, "i" is still incremented by 3 after the instruction.

[edit] Computational Class

Aubergine is Turing complete if we allow that it is being run on an infinite memory computer. This is because all memory that is going to be used when the program is executed must be included in the length of the program itself. Thus, any program that uses infinite memory must be infinitely long. If implemented on a finite memory computer, it is equivalent to a Linear-Bounded Automaton.

[edit] Examples

[edit] Hello, world!

=iA$IHello, world!
$                                            +a1+b1+b1+b1+b1+b1=Ab=a1=bA=oB+b1=Ab+a1=AB=b1+b1+b1-AB+b1:BA

[edit] Quine

=oA-AA-bb=aB+a1=oA=Ba=b1+bb+bb+bb+b1-bA=a1+a1+a1:ab+ia	

[edit] External links

  • Ruby interpreter (This reference implementation is buggy. The "or" on line 15 should be an "and," and against all logic, the "<" on line 44 should be a "<=.")
Personal tools