Smaller

From Esolang
Jump to navigation Jump to search
This article is not detailed enough and needs to be expanded. Please help us by adding some more information.

Smaller is an OISC by User:ChuckEsoteric08.

Command

a;b;

Add value b to variable a and if result was zero back to the start of the program. To increment variable by other variable, you need to put it inside two "%"s. It is also possible to have multiple operations like that:

a;2-1;

Increment a by 1

Examples

Jump unconditionaly one time

a;-%a%;

See Also

Computational class

When variables are allowed to take on arbitrarily large values, Smaller is Turing complete because Brainpocalypse II (in its numerical view) can be compiled into it.

The main subtleties in the construction:

  • Smaller variables are 1 higher than their Brainpocalypse II counterparts. This prevents the program being accidentally sent back to the start when doing a no-op on a variable by increasing and decreasing it again.
  • To compensate for this, a decrement is implemented by subtracting 2 from the variable, and then adding 1. (Additions are implemented directly.)
  • Each variable has an "auxiliary variable" that remembers whether the code reset during the decrement of that variable. Auxiliary variables are 1 while the variable is not being decremented, and 3 while it is (you add 2 to the auxiliary variable immediately before a decrement, and subtract 2 again afterwards).
  • At the start of the program, each variable has its auxiliary variable minus 2 added to it (this implements the way that Brainpocalypse II variables increment rather than decrement when being decremented from zero). Then all the auxiliary variables are set back to 1 (by subtracting 1 minus themself).

All other aspects of Brainpocalpyse II can be compiled directly.

External resources

Compiler to Batch