TPPL

:Not to be confused with TP, another language also based on toilet paper.
The Toilet Paper Programming Language, or TPPL for short, is an esoteric language created by User:Saka. It is based on toilet paper but is not truly toilet paper.
The language is still somewhat work in progress.
== Data Types ==
There are 2 main data types in this language: Integers and Sequences.
Sequences are just what they sound like, sequences of integers. A sequence can be represented in the form of a string of numbers separated by commas (,) such as 1,0,2,2.
An integer is an ordinary number, such as 6.
== Basics ==
A TPPL program starts with "ENTER RESTROOM" or "ENTER BATHROOM", otherwise it will throw an error.
A TPPL program starts with a roll of toilet paper with length 1. Imagine this as a stack with 1 item which has value 0.
Each sheet of toilet paper (An item in a stack) can have a value from 0 to 2 (Inclusive), this is because the toilet paper being used is 2-ply.
In TPPL, only 1 sheet of the toilet paper (1 item of the stack) may be read at a time. The PULL instruction changes what sheet is being read.
There are 3 places data can be stored, the main toilet paper roll (Main stack), the trash bin (A stack of sequences), and the HOLD slot, where toilet paper that has been ripped off awaits further
processing.
== Instructions ==
Instruction 	Description
PULL 	Change the current index of the sheet currently visible by +1. Equivalent to going 1 item up in a stack. It will go back to index 0 (Bottom of the stack) if the program tries to pull more than the length of the toilet paper.
ADD 	Add 1 more sheet of toilet paper to the back with value 0 (Add an item to the top of the stack with value 0).
WIPE 	Increment the value of the current visible sheet by 1.
CLEAN 	Decrease the value of the current visible sheet by 1.
RIP 	Rip off the visible sheet along with the ones below it and hold it (Pop off values from index n (Current item) to index 0 and turn the values into a sequence and move the sequence to HOLD).
TRASH 	Throw the toilet paper in HOLD to the trash (Take the sequence in HOLD, push it to the "TRASH" stack).
DISCARD 	Throw the toilet paper in HOLD to the corner where you will never get it back (Clear HOLD. Will not return error if HOLD is empty.).
TAKE n 	Take the sequence with index n from the trash (Pop item n from TRASH and put it in HOLD).
COPY n 	Take sequence n from the trash and photocopy it (Copy item n from TRASH into HOLD).
APPEND 	Stitch the toilet paper in HOLD to back to the main roll (Convert the sequences into individual values and put those values on the bottom of the roll stack). The visible roll is moved by +1 except if the roll has length 0 before APPEND.
EXIT 	Exit the restroom (Terminate the program).
CHECK s YES? n	Check if the toilet paper in HOLD is equal to the sequence s, if so, go to line n, otherwise, go to the next line like nothing happened. If s is more than 2, check if the sequence in HOLD is the same as the sequence in TRASH with index s-3.
JUMP n 	Go to line n.
SPIN n 	Like JUMP but relative to the command, so n = 2 will go 2 lines down and n = -2 will go 2 lines up.
SET 	Set the current sheet's value to a user input.
GET 	Get a 1-character ASCII input, convert it to ternary, and then add the values to the end of the toilet paper (Top of stack).
FLUSH 	Throw the toilet paper in HOLD down the toilet (Convert the sequence in HOLD to an integer (e.g. 1,2,0 -> 120) and output it as ASCII)
More may be added.
Comments are any line starting with "#".
Any error that occurs terminates the program
== Examples ==
=== Truth Machine ===
Input 0 or 1
ENTER BATHROOM
SET
RIP
ADD
ADD
ADD
ADD
CHECK 1 YES? 19
TRASH
PULL
WIPE
PULL
WIPE
WIPE
PULL
WIPE
RIP
FLUSH
EXIT
TRASH
WIPE
PULL
WIPE
PULL
WIPE
WIPE
PULL
WIPE
RIP
FLUSH
ADD
ADD
ADD
ADD
JUMP 20
=== Hello, World! ===
No newline.
ENTER BATHROOM
#Hello, World!
ADD
ADD
ADD
PULL
PULL
WIPE
WIPE
PULL
WIPE
WIPE
RIP
FLUSH
ADD
ADD
ADD
ADD
ADD
WIPE
WIPE
PULL
PULL
WIPE
WIPE
PULL
PULL
WIPE
RIP
FLUSH
ADD
ADD
ADD
ADD
ADD
PULL
PULL
PULL
WIPE
PULL
WIPE
RIP
FLUSH
ADD
ADD
ADD
ADD
ADD
PULL
PULL
PULL
WIPE
PULL
WIPE
RIP
FLUSH
ADD
ADD
ADD
ADD
ADD
PULL
WIPE
PULL
PULL
WIPE
PULL
WIPE
RIP
FLUSH
ADD
ADD
ADD
ADD
WIPE
WIPE
PULL
WIPE
WIPE
PULL
WIPE
PULL
WIPE
RIP
FLUSH
ADD
ADD
ADD
ADD
WIPE
WIPE
PULL
WIPE
PULL
PULL
WIPE
RIP
FLUSH
ADD
ADD
ADD
ADD
ADD
PULL
WIPE
WIPE
PULL
PULL
PULL
WIPE
RIP
FLUSH
ADD
ADD
ADD
ADD
ADD
PULL
WIPE
PULL
PULL
WIPE
PULL
WIPE
RIP
FLUSH
ADD
ADD
ADD
ADD
ADD
PULL
WIPE
WIPE
PULL
PULL
WIPE
PULL
WIPE
RIP
FLUSH
ADD
ADD
ADD
ADD
ADD
PULL
PULL
PULL
WIPE
PULL
WIPE
RIP
FLUSH
ADD
ADD
ADD
ADD
ADD
WIPE
PULL
PULL
WIPE
WIPE
PULL
PULL
WIPE
RIP
FLUSH
ADD
ADD
ADD
ADD
PULL
WIPE
WIPE
PULL
PULL
WIPE
RIP
FLUSH
EXIT
=== CAT Program ===
Input 1 character.
ENTER BATHROOM
RIP
DISCARD
GET
RIP
FLUSH
EXIT
== Interpreters ==
=== Python ===
Available on GitHub
Category:Languages
Category:Stack-based
Category:2018
Category:Implemented