Truth

From Esolang
Jump to navigation Jump to search

(This is the first draft, sorry for the bad style)

Truth is an esoteric programming language created by Sam Savitz in 2006. Truth is a new paradigm in programming languages. Each cycle causes each cell (To be defined later) to execute it's value. Each cell can hold one bit A cell must be defined, a cell defenition prototype is below.

[<[Cell ]Number>:](optional, but useful) [(initial|i): (0|1)] [(0|1)(0|1)(0|1)(0|1)] [reference1] [reference2]

eg:

6: initial: 0 1110 -2 -1

All cells execute simultaneously when they are called. The cell above is the fifth cell in a program. before any executions have occured, it's value is zero. On each execution this cell takes the value of the cell number 4 and 5 (6-2, 6-1) and takes the nand of them (this is because of the 1110, this means that if both references are 0 then make you value 1; if the first it 0, and the second 1, then make your value 1, if the first is 1 and the second 0 then make the value 1; if they are both 1, then make the vaue 0. above, I explained what happens in each case in the order they are represented by the code.

Any part of the definition can be ommited or replaced with a question mark, but then that which it would would determine will have undefined behavoir.

IO

One can enable basic IO by making special cells. The current system is as follows:

cell 0: if this cell is 1, finish this execution and then halt. cell 1: if this cell is 1, then output the value in cell 2. cell 3: if this cell is 1, then take one bit of input and write it to cell 4.

Example program

This program takes one bit of input and outputs its opposite:

0: i: 0 0011 +5

1: i: 0 0011 +4

2: 1100 +2

3: i: 1 0000

4:

5: i: 1

This program will only last for two execution cycles these are the values it goes through:

cell | 0 | 1 | 2 | 3 | 4 | 5

init | 0 | 0 | ? | 1 | X | 1 (? means undefined and unimportant, X = input) (the 1 in cell 3 tells it to input X into 4)

next | 1 | 1 |~X | 0 | ? | ? (the 1 in cells 0 and 1 say to halt, but first output the ~X (opposite of X) in cell 2)


One may make an anti-wimpmode by self-restricting themselves to only two specially picked Turing complete operators.


It is believed that Truth is turing complete

There is no interpreter yet.