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.
executed
This esolang is probably turing complete, but I don't have that much time to actually figure that out.
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 |
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 ]~