We are currently working on new rules for what content should and shouldn't be allowed on this website, and are looking for feedback! See Esolang:2026 topicality proposal to view and give feedback on the current draft.
5++
(this page is a work in progress, be patient, and please don't kill me for not following all the proper esolangs wiki standards and procedures)
5++ is an esolang created by user:RetroPain
It has a single variable, called 8, and an infinite tape.
8 MUST be referred to as 8, "Eight" is an acceptable alternative in circumstances where it is absolutely impossible to refer to 8 as 8, 8 MUST also be thought of as a variable specifically, and must be referred to as a variable when mentioning what 8 is, not following these rules properly will result in dire consequences.
Execution
- All the instructions of a program are cycled through in order endlessly until the interpreter executes
xorX. - The sole purpose of 8 as a variable is to serve as an index for the tape.
- The only method of writing to the tape is to taint the cell at the position dictated by 8 using
6, this action cannot be reversed and will prevent code within a block from executing if the cell at index 8 is tainted. - At the start of the program, the tape is completely untainted.
- Interpreter MUST throw a deliberately cryptic and misleading error with absolute zero meaning and halt execution immediately if the user inputs anything other than 5 or 0 for
i
Instructions
| Instruction | Description |
|---|---|
| 5 | Puts "5" into the output buffer |
| 0 | Puts "0" into the output buffer |
| 5++ | Increment 8 |
| 5-- | Decrement 8 |
| ( Block ) | Executes code contained within block only if the cell at the position dictated by 8 is untainted, else it is skipped. |
| 6 | Taint cell at the position dictated by 8 |
| p | Prints contents of output buffer |
| P | Reinterprets contents of output buffer as a binary string and prints the bytes (0 = 0, 5 = 1). |
| i | Request input from user or read buffer and taints cell located at the position dictated by 8 if input is 5 |
| I | Request single byte input from user, stores into read buffer to be read from using i
|
| x | End program. |
| X | Print contents of the output buffer, prints "X", and ends the program. |
| ^[ | Starts comment |
| ]~ | Ends comment |
Computational class
5++ is Turing-complete as it can simulate Turing-machine with right-infinite tape and without erase (setting marked cells into unmarked). Turing machine's cell B will be this, assuming it has three states:
[B] [1][0][1][1][1][1][1] [1][1][0][1][1][1][1] [1][1][1][0][1][1][1] [1][1][1][1][0][1][1] [1][1][1][1][1][0][1] [1][1][1][1][1][1][0]
Basically each cell for the Turing-machines with states would be represented as 5++ cells (here it is 36+6+1=43). Tape pointer at each iteration is put at the start of a block for the current state.
Code starts with a single (...) statement which executes if the first cell at the block is untainted, which means tape isn't initialized and it is initialised inside the statement and tape pointer is moved to the start of a current cell's state block which represents initial state. Then it checks each cell in the block until 0 is met, which indicates what current state is.
Each state is represented as two, one if cell is tainted and other if untainted, so no check is needed. Then state transition is easily made, after it ends it checks whether current cell is untainted, if it is then it moves tape pointer to the right (or to the left, if state for unmarked cell is before marked) (where is amount of the states in the original Turing machine) more times than needed if it is tainted. It also needs to check if cell at the start of a block is untainted, if so it would initialize it in the same way as said before with value being 0. State transition when moving to the next state block would after that move it s more times (where s was previous state) to the right.
Examples
Quine
The simplest quine in 5++ makes use of the X instruction. X alone can be used as a quine, but any combination of 0 and 5 preceding X can also be a valid quine
05X
Hello, World!
A simple program, it stores "Hello, World!" in the output buffer and prints it.
05005000 ^[ H ]~ 05500505 ^[ e ]~ 05505500 ^[ l ]~ 05505500 ^[ l ]~ 05505555 ^[ o ]~ 00505500 ^[ , ]~ 00500000 ^[ ]~ 05050555 ^[ W ]~ 05505555 ^[ o ]~ 05550050 ^[ r ]~ 05505500 ^[ l ]~ 05500500 ^[ d ]~ 00500005 ^[ ! ]~ 00005050 ^[ \n ]~ Px ^[ Print byte string and end program ]~
Simple Conditional Program
Given a user input, it will either print "Hello!" or "Bye!"
It only accepts 0 or 5.
0055000000500000055055550555005000500000005505050055555500005050P ^[ Prints "0 or 5?" ]~
i
(
^[ If input is 0, then execute ]~
^[ Puts "Hello!" into the output buffer ]~
05005000 ^[ H ]~
05500505 ^[ e ]~
05505500 ^[ l ]~
05505500 ^[ l ]~
05505555 ^[ o ]~
00500005 ^[ ! ]~
00005050 ^[ \n ]~
)
^[ If this cell is untainted, the program will taint the neighboring cell ]~
(
5++65-- ^[ Increment 8, Taint cell, Decrement 8 ]~
)
5++ ^[ Increment 8 ]~
(
^[ If input is 5, then execute ]~
05000050 ^[ B ]~
05555005 ^[ y ]~
05500505 ^[ e ]~
00500005 ^[ ! ]~
00005050 ^[ \n ]~
)
Px ^[ Print contents of output buffer and Ends program]~
Truth-machine
The operation of a truth-machine is very simple, the implementation of one in 5++ is not.
It takes in a single ASCII character
- If the input is 0, then it prints 0 and ends execution.
- If the input is 1, then it prints 1 in a loop.
^[ Input Logic ]~
(
6 ^[ Taint cell ]~
I ^[ Read byte to input buffer ]~
5--5--i5--5--i5--5--i5--5--i5--5--i5--5--i5--5--i5--5--i ^[ Read byte from input buffer to tape ]~
5++5++5++5++5++5++5++5++5++5++5++5++5++5++5++5++ ^[ Return 8 to 0 ]~
^[ Creates inverted copy of input byte, useful for checking value equality. ]~
5--5--(5++65--) ^[ Bit 7 ]~
5--5--(5++65--) ^[ Bit 6 ]~
5--5--(5++65--) ^[ Bit 5 ]~
5--5--(5++65--) ^[ Bit 4 ]~
5--5--(5++65--) ^[ Bit 3 ]~
5--5--(5++65--) ^[ Bit 2 ]~
5--5--(5++65--) ^[ Bit 1 ]~
5--5--(5++65--) ^[ Bit 0 ]~
5++5++5++5++5++5++5++5++5++5++5++5++5++5++5++5++ ^[ Return 8 to 0 ]~
^[ Check if input is ASCII 0 or 1. Makes use of inverted copy ]~
5--5--( ^[ Bit 7 == 0 ]~
5--5--( ^[ Bit 6 == 0 ]~
5--( ^[ Bit 5 == 1 ]~
5--5--( ^[ Bit 4 == 1 ]~
5--5--5--( ^[ Bit 3 == 0 ]~
5--5--( ^[ Bit 2 == 0 ]~
5--5--( ^[ Bit 1 == 0 ]~
5++5++5++5++5++5++5++5++5++5++5++5++5++5++5++ ^[ Move 8 to 1 ]~
6 ^[ Taint cell if check passed ]~
5--5--5--5--5--5--5--5--5--5--5--5--5--5--5-- ^[ Return 8 to -14 ]~
)5++5++
)5++5++
)5++5++5++
)5++5++
)5++
)5++5++
)5++5++ ^[ Chain 5++ instructions to return 8 to 0 ]~
)
5++ ^[ Move 8 to 1 ]~
(x) ^[ End program if check did not pass ]~
5-- ^[ Return 8 to 0 ]~
5--5--5--5--5--5--5--5--5--5--5--5--5--5--5--5-- ^[ Move 8 to read Bit 0 ]~
( ^[ Bit 0 == 0 ]~
0055000000005050 Px ^[ Print "0\n" and End program ]~
)
5++
( ^[ Bit 0 == 1 ]~
00550005P ^[ Print "1" and continue ]~
)
5++5++5++5++5++5++5++5++5++5++5++5++5++5++5++ ^[ Return 8 to 0 ]~