trueclone

From Esolang
Jump to navigation Jump to search

trueclone is an esoteric language designed to make Spaghetti code.

trueclone

  • uses goto statements.
  • doesn't have comments.
  • uses a tape, in which every cell is signed and is 16-bit long.
  • doesn't support spaces.
  • the only symbols trueclone supports are: 0, 1

Syntax

A line will look something like this:

<instruction><parameter>

Example:

sub00000001

The parameter is optional and depends on the instruction. The value of a parameter should always be a binary number.

Also, you can put multiple instructions in a line, like this:

leftleftleftleftadd0000000000000001sub0000000000000001

Oh and instructions should always be in upper-case

LEFTLEFTLEFTLEFTADD0000000000000001SUB0000000000000001

Instructions

Instruction Parameter use Description
ADD yes Adds to the current cell the value of the parameter
SUB yes Substracts from the current cell the value of the parameter
SET yes Sets the value of the current cell to the value of the parameter
LEFT no Moves the pointer to the right cell
RIGHT no Moves the pointer to the left cell
IN no Gets an input character and stores in the current cell its ASCII code
OUT no Outputs the ASCII character associated with the current cell value
JUMP yes Jumps to the character specified by the parameter
JINZ yes Jumps to the character specified by the parameter if the current cell value is not zero
JITS yes Jumps to the character specified by the parameter if the current cell value is zero
JINN yes Jumps to the character specified by the parameter if the current cell value is below zero
JITN yes Jumps to the character specified by the parameter if the current cell value is above zero

Turing complete proof

Turing complete means that this program can calculate everything that a Turing machine can calculate.

The proof is that the following characters are the equivalent of the brainfuck instructions (which are Turing complete).

ADD0000000000000001 equivalent of '+'
SUB0000000000000001 equivalent of '-'
JNZ can be used as '[ ]'
LEFT equivalent of '>'
RIGHT equivalent of '<'

Examples

Cat program

The following implements an infinitely repeating cat program:

INOUTJINZ0

Truth-machine

A truth-machine is implemented in this program:

INOUTSUB110000JITS0000000001000010ADD110000OUTJUMP0000000000101011

Interpreter

  • Common Lisp implementation of the trueclone programming language.