# This=That

This=That is an esoteric programming language by User:PuzzleHunter84, and is made up entirely of variables. Each line is just a case-sensitive variable name, followed by `=`, and then the variable's case-sensitive value.

The variable names can be anything including special names, and the values can be anything as well, and can also be special values:

 `print` prints the variable's value. `input` inputs a value for the variable to take. `plusminusdivided bytimes` do math. For example: ``` x=4 Jerome=x minus 2 ``` sets `x` as value `4` and `Jerome` as value `2` (4-2). Also: ``` fruit=fly printer=paper sticky=fruit plus printer ``` sets `fruit` as value `fly`, `printer` as value `paper`, and `sticky` as value `flypaper` (word math only works with `plus`). `if loop x=condition` starts an `if` loop named `x` with the given condition. `while loop x=condition` starts a `while` loop named `x` with the given condition. `if loop x=endwhile loop x=end` signifies the end of `if`/`while` loop `x`.

Conditions have three parts, two compared values referenced by their names and a comparison which can be:

 `>` is greater than `<` is less than `~` is not equal to `~>` is no greater than `~<` is no less than `~~` is equal to

Execution begins at the first line and proceeds line-by-line down the list of lines.

An if loop executes once if the condition is true, while a while loop executes as long as the condition is true when the loop ends.

When a variable is given a new value, that value is used in place of the old value in math, string concatenation, etc. to decide other values. In other words, when a variable is given `x minus 2`, it is actually given a formula, the value of which at any given time is the value of `x` at that time, minus 2.

When a variable (say `a`) is given a value which refers to itself, the old value of `a` is used to determine the new value. A variable is only set once for each time it appears as the variable name (except in the case of specials such as print, input, and loops).

## Example programs

### Hello, world! Program

```x=Hello, world!
x=print
```

### Cat Program (Until QUIT is inputted)

```x=input
while loop y=x~QUIT
x=print
x=input
while loop y=end
```

### Endless Bottles of Beer Program

```a=99
b= bottles of beer on the wall.
c=a plus b
d= bottles of beer.  You take one down and pass it around.
e=a plus d
f=c plus e
g= bottle of beer on the wall.
h=a plus g
i= bottle of beer.  You take it down and pass it around.
j=a plus i
k=h plus j
l= bottles of beer.  You go to the store and buy some more.
m=a plus l
n=c plus m
o=0
while loop x=o~~0
while loop y=a>2
f=print
a=a minus 1
c=print
while loop y=end
f=print
a=a minus 1
h=print
k=print
a=No
c=print
n=print
a=99
c=print
while loop x=end
```

```a=0
b=1
a=print
b=print
while loop x=b>0
a=a plus b
a=print
b=a plus b
b=print
while loop x=end
```

### Endless Square Numbers Program

```a=0
b=1
a=print
while loop x=b>0
a=a plus b
b=b plus 2
a=print
while loop x=end
```

or

```a=0
while loop x=a~<0
b=a times a
b=print
a=a plus 1
while loop x=end
```

```x=input
y=input
z=x plus y
z=print
```

### Digital Root Calculator

```a=input
while loop x=a>9
a=a minus 9
while loop x=end
a=print
```

### Counts down from inputed value to zero

```a=input
while loop x=a~<0
a=print
a=a minus 1
while loop x=end
```

### Counts from zero to infinity

```a=0
while loop x=a~<0
a=print
a=a plus 1
while loop x=end
```

## Computational Class

This=That is Turing-complete, because a version of brainfuck without I/O, with tape length 3 and in which all loops are balanced (i.e. the location of the tape pointer is constant for any given byte of the code) can be compiled into it. (This is in turn known to be Turing-complete as it can implement an iterated Collatz function.)

Use three variables (e.g. `a`, `b`, `c`) to represent the three tape elements. The brainfuck commands can be implemented as follows:

• `+`: `v=v plus 1` (where v is the variable representing the pointed-to tape element)
• `-`: `v=v minus 1`
• `<`, `>`: these don't directly produce any code (rather, they change which variable is used in `+-[]`)
• `[…]`: `while loop x=v~0 … while loop x=end` (where x is different for each such loop)