TISolang

From Esolang
Jump to navigation Jump to search

TISolang (or simply, "TIS-o-lang") is a esoteric programming language that created by User:McDude73 in 2021 that was implemented based on the game TIS-100 by Zachtronics.

Basic idea

The main idea behind this language is that there are 12 accumulators, each having a backup accumulator alongside them.

Values, which are between -999 and 999 inclusive, that are usually taken from an input are moved into these accumulators and modified in a way where you are able to send the output based on what instructions you are giving the program.

One could say that this is a modified version of a TIS-100 program.

Architecture

Basic commands

TIS-100 and TISolang have their many commands. TISolang is to extend the amount of commands that TIS-100 has in order to make it an esoteric language. The table below will mention which commands are related and how they work.

TIS-100 Command TISolang Command Description TISolang Difference
MOV A B MOV A B Moves value A to location B. Moves value A to accumulator B.
ADD A ADD A B Adds value A to the accumulator. Adds A to accumulator B.
SUB A SUB A B Subtracts value A from the accumulator. Subtracts A from accumulator B.
NEG NEG A Negates the value in the accumulator. Negates the value in accumulator A.
SAV SAV A Saves the value in the accumulator into the backup accumulator. Saves the value from accumulator A to the backup.
SWP SWP A Swaps the backup and accumulator values. Swaps the values from the accumulator and backup at accumulator A.
# # While not an actual command, it allows the user to add comments in the program.

Conditional commands

Here is where changes in code start to appear significantly. The following codes act as 'if' statements.

TIS-100 Command TISolang Command Description TISolang Difference
JEZ A AEZ A Goes to label A if the accumulator's value is 0. If the accumulator at A == 0, run code until END is reached.
JNZ A ANZ A Goes to label A if the accumulator's value is not 0. If the accumulator at A != 0, run code until END is reached.
JGZ A AGZ A Goes to label A if the accumulator's value is greater than 0. If the accumulator at A > 0, run code until END is reached.
JLZ A ALZ A Goes to label A if the accumulator's value is less than 0. If the accumulator at A < 0, run code until END is reached.

TISolang exclusive commands

While TISolang is related to TIS-100, there are special commands, such as END as mentioned earlier. The following are TISolang specific commands that you can run.

TISolang Command Description
INP A Lets the user input any value, then send it to accumulator A.

Any existing input at accumulator A will be overwritten.

OUT A Outputs the value from accumulator A.
SND A B Send value A to accumulator B without requiring user input.
MUL A B Multiply accumulator B's value by A.
DIV A B Divide accumulator B's value by A using integer division.
WHL A Creates a loop running the code based on condition A.
CTA A Converts the integer at accumulator A to an ASCII character.
CTI A Converts the ASCII character at accumulator A to an integer.
END Declares the end of an if statement or a loop.
NLN Creates a new line in the console for printing.

Positives, negatives, and other notes

Positives

  • Values can be moved wherever they want.
  • You can input anything you want and send the value to any accumulator.
  • You can print values from any accumulators at any time.
  • Using SAV can allow you to keep any values in the backup for any future use later on.

Negatives

  • The only way to access 'if' statements are using AEZ, ANZ, AGZ, and ALZ.
  • The only way to access the backup data in an accumulator requires you to use SWP.

Notes

  • When only one character is entered, except for numbers, it is treated as an ASCII character.
  • Spaces must be used accordingly based on the given commands above.
  • You can not write values to the backup accumulator.

Example programs

Hello, world!

SND Hello, 1
SND 0 2
SND World! 3
CTA 2
OUT 1
OUT 2
OUT 3

Truth-machine

INP 1
AEZ 1
OUT 1
END
WHL ANZ 1
OUT 1
END

Interpreters

Currently none