Pain

From Esolang
Jump to navigation Jump to search

(note: the queue is called the stack for no true reason) Pain is an Esolang created by user:RetroPain and it's a pain to use. It was inspired by Element. Some programs can ether end in | or |@. The only reason that |@ exists is due to an early prototype of the interpreter that user:RetroPain was trying to make before asking someone else to make an interpreter. Due to its limitations |@ had to exist otherwise a program could never end. It both uses a stack and a "variable tape." Basically, the same thing as the tape in BF but you can add cells at anytime the programmer wants a cell to be made. The switch between Unknown computational class to Turing Complete was made when user:RetroPain converted a brainfuck self interpreter and successfully interpreted +[.+]

List of Instuctions

Instruction Description
@ Ends the program
| Seperates the instuctions
"String" Pushes a string to the bottom of the stack
C> or T> Outputs what is at the top of the stack
C< or T< Asks the user for an input then puts it at the bottom of the stack
CLR Clears the screen
#comment# It's a comment
vN Creates a new variable
v+ adds the current variable with the one below
v- Subtracts the current variable with the one below
v* Multiplies the current variable with the one below
v/ divides the current variable with the one below. Rounds Up or Down when necessary.
vU Moves the variable pointer up
vD Moves the variable pointer down
vS Sets the current variable to the highest point in the stack that is a number
vP Prints the contents of the variable as a number
sV Adds the number in the variable into the stack while keeping the variable the same
sR Removes the top of the stack
[ Starts a while loop that will end if the variable being pointed to is 0
] Jumps to [ if it the variable being pointed to if not equal to 0
iF( it will run the code in the if statement if the variable being pointed to is equal to the variable below
) Ends the if statement
gT Goes to the line number that is equal to the variable
1+ Adds 1 to the variable
1- subtracts 1 to the variable
A> Prints the contents of the variables as an ASCII character
A< Takes the first letter of the top of the stack and saves it to the variable as a number
{ Creates a loop that lasts forever
} Goes back to the {
NLT Toggles if there will be a new line if C> or T> is used

Note:

Due to the limitations of the variables, gT cannot goto lines that are beyond 255 leaving the user to only use gT to goto 254 lines

Example programs

While it's not good at being human-readable it certainly good for making nonpractical programs!

Hello, world!

You can use ASCII(the same method that BF uses to output text) but the example shown here will be using the stack. A Hello, world! program is a program that outputs the text Hello, world!.

"Hello, world!"|  Moves "Hello, world!" to the bottom of the stack.
C>|@             Removes the top of the stack(Hello, world!) and displays it then ends the program.

Truth-machine

A Truth-machine program is a program that takes 1 or 0 as an input. If 1 is the user input then it will repeatedly display 1. otherwise it will only print one 0(This is a basic simplification of the truth machine. A whole page can be found by clicking this entire sentence).

vN|vN|vN|                 Creates 3 variables
C<|A<|                    Takes input from the user and store it in variable 1  

vD|1+|1+|1+|1+|1+|vD|
1+|1+|1+|1+|1+|1+|1+|1+|  Sets Variable 2 to 49
1+|vU|v*|1+|1+|1+|1+|vU|

A>|iF(|{|A>|}|)|@         Prints the number then starts the loop if the user input is equal to 1

Cat program

{|         Starts a loop
C<|C>|}|@  Asks for input then outputs it

Proto Pain

Proto Pain was a language with more verbose syntax. While Pain was inspired by Element, Proto Pain was inspired by Uyjhmn_n.

There was only 1 instruction that was created. It was Scream the character (character here). If anyone wants to reconstruct what Pain was supposed to be, then go right ahead

Simple Pain

What? Did you think there weren't more versions of Pain? At least this version is easier to read. It was styled after Python if Python didn't use indenting.

It's not an esolang, but more of a Wimpmode

Simple Pain Instuctions

Instruction Description
"String" Pushes a string to the bottom of the stack
Print Outputs what is at the top of the stack
Input Asks the user for an input then puts it at the bottom of the stack
Clear Clears the screen
#comment It's a comment
int Creates a new variable
VAR add adds the current variable with the one below
VAR sub Subtracts the current variable with the one below
VAR mult Multiplies the current variable with the one below
VAR div divides the current variable with the one below. Rounds Up or Down when necessary.
VAR u Moves the variable pointer up
VAR d Moves the variable pointer down
Variable Print Prints the contents of the variable as a number
Raw sV(substitute) Adds the number in the variable into the stack while keeping the variable the same
Stack Remove Removes the top of the stack
While[ Starts a while loop that will end if the variable being pointed to is 0
] Jumps to [ if it the variable being pointed to if not equal to 0
If( it will run the code in the if statement if the variable being pointed to is equal to the variable below
) Ends the if statement
Goto Goes to the line number that is equal to the variable
Var add 1 Adds 1 to the variable
Var sub 1 subtracts 1 to the variable
VAR ascii out Prints the contents of the variables as an ASCII character
VAR ascii in< Takes the first letter of the top of the stack and saves it to the variable as a number
Forever{ Creates a loop that lasts forever
} Goes back to the Forever{
New Line Toggle Toggles if there will be a new line if Print is used
Raw Will allow raw Pain code to be used
Delpri "String" Removes everything on the stack then adds the string to the stack then prints the top of the stack

As you can see, it's mostly just a more verbose version of Pain. It also has extra instructions making up for the lesser amount of instructions.

Some other facts

  • Simple Pain compiles to Pain.
  • Simple Pain was made for making games easier(but it's just as stupid as Pain itself).
  • Simple Pain was inspired by STBF.
  • The Truth-Machine example was created using Simple Pain.
  • The creator dislikes this, as it's basically brainfuck with extra steps.

Implementations

Yes. Here is a link to go to Simple Pain. Just click this

Interpreters/Debuggers

  1. The first interpreter - The link explains it all
  2. The first debugger - The link explains it all. Also includes BF to Pain translator

Interpreter variations

  1. PPIDEFP"BA!!"BIAAI - An interpreter that allowed Greyscale images to be shown. Using "Graphical mode," the interpreter takes the current Text output and displays it as an image, "Bad Apple!!" is the built in to the interpreter