Autopsy

From Esolang
Jump to navigation Jump to search

Autopsy is a minimal esolanguage designed in 2018 by User:Keymaker.

Program and execution

An Autopsy program consists of two kinds of instructions, . and ;. When reading the program, all other characters are ignored. The program must be at least one instruction long.

There are four registers/counters (a, b, c, d) which are all initially 0, which is also their minimum value. They have no upper bound. Initially the first register (a) is chosen.

When the program begins the instruction pointer is pointing at the first instruction. After executing an instruction, the instruction pointer moves forward two or three times (see below). If stepping past the last instruction, the instruction pointer returns to the first instruction.

Executing an instruction:

if instruction is "."
  increase value of current register by one
  move forward two times
else if instruction is ";"
  if value of current register is 0
    move forward three times
  else if value of current register is larger than 0
    decrease value of current register by one
    move forward two times
  whether decreasing happened or not, switch register focus to next register (if presently in last, switch to first)

The program never halts.

Computational class

The language has been proven Turing-complete via Minsky Machine translation. Detailed explanation can be found on the language's page (see link below).

Example MM translation

Here is a simple 7-instruction test program in Minsky Machine.

The numbers on the left indicate the number of each instruction. The letters after "inc" or "dec" indicate the affected register. The numbers on the right correspond to the ones on the left and indicate the next instruction to go to. The "inc" commands only have one number to go to, and they increase the register value. The "dec" commands go to the second number if the register is zero. Otherwise, they decrement the register and go to the first number.

The test program is similar to the Minsky Machine test program provided on the language's page, but here, the registers are renamed to "B" and "C" because those are the Autopsy registers corresponding to the registers of the Minsky machine. When the A register (of Autopsy) hits zero, the next Minsky Machine command is initiated.

The test program sets B to 3, then decreases it until zero while simultaneously increasing C, then settles into an endless loop decreasing B (which is already 0 at that point).

1 inc B 4
2 inc B 5
3 inc C 3
4 inc B 2
5 dec B 6 7
6 inc C 5
7 dec B 7 7

The resulting Autopsy program (1842 instructions):

;...;;..;;..;;..;...;;..;..;...;.;;...;...;...;.;...;;..;;..;;.;;...;...;...;.;...;;..;;..;;.;;...;.
..;...;.;...;;..;;..;;.;;.;...;;..;;..;;..;...;;..;..;...;.;;...;...;...;.;...;;..;;..;;.;;...;...;.
..;.;...;;..;;..;;.;;...;...;...;.;...;;..;;..;;.;;.;...;;..;;..;;..;...;...;....;...;.....;.;;...;.
..;...;.;...;;..;;..;;.;;...;...;...;.;...;;..;;..;;.;;...;...;...;.;...;;..;;..;;.;;...;...;...;.;.
..;;..;;..;;.;;...;...;...;.;...;;..;;..;;.;;...;...;...;.;...;;..;;..;;.;;...;...;...;.;...;;..;;..
;;.;;.;...;;..;;..;;..;...;...;;.....;...;.;;...;...;...;.;...;;..;;..;;.;;...;...;...;.;...;;..;;..
;;.;;...;...;...;.;...;;..;;..;;.;;...;...;...;.;...;;..;;..;;.;;...;...;...;.;...;;..;;..;;.;;.;...
;;..;;...;;...;;.;;..;;..;...............;...;...;.;;...;...;...;.;...;;..;;..;;.;;...;...;...;.;...
;;..;;..;;.;;...;...;...;.;...;;..;;..;;.;;...;...;...;.;...;;..;;..;;.;;...;...;...;.;...;;..;;..;;
.;;...;...;...;.;...;;..;;..;;.;;...;...;...;.;...;;..;;..;;.;;...;...;...;.;...;;..;;..;;.;;...;...
;...;.;...;;..;;..;;.;;...;...;...;.;...;;..;;..;;.;;...;...;...;.;...;;..;;..;;.;;...;...;...;.;...
;;..;;..;;.;;...;...;...;.;...;;..;;..;;.;;...;...;...;.;...;;..;;..;;.;;.;...;;..;;..;;..;...;...;.
.;...;.....;.;;...;...;...;.;...;;..;;..;;.;;...;...;...;.;...;;..;;..;;.;;...;...;...;.;...;;..;;..
;;.;;...;...;...;.;...;;..;;..;;.;;...;...;...;.;...;;..;;..;;.;;...;...;...;.;...;;..;;..;;.;;.;...
;;..;;...;..........;...;;.;;..;;..;...;...;...;.;;...;...;...;.;...;;..;;..;;.;;...;...;...;.;...;;
..;;..;;.;;...;...;...;.;...;;..;;..;;.;;...;...;...;.;...;;..;;..;;.;;...;...;...;.;...;;..;;..;;.;
;...;...;...;.;...;;..;;..;;.;;...;...;...;.;...;;..;;..;;.;;...;...;...;.;...;;..;;..;;.;;...;...;.
..;.;...;;..;;..;;.;;...;...;...;.;...;;..;;..;;.;;...;...;...;.;...;;..;;..;;.;;...;...;...;.;...;;
..;;..;;.;;...;...;...;.;...;;..;;..;;.;;.

External resources

  • Autopsy page (exhaustive explanation of the language and the MM translation, MM-to-Autopsy translator, Autopsy interpreter in Python)