suicide
- The title of this page is incorrect because of technical limitations. The correct title is suicide.
suicide is a language create by User:fr34k in 2008.
suicide is Turing complete. It has a limit of 676 variables, but if these are unbounded it can emulate a Minsky machine.
Language overview
Commands
Relational and equality operators
:: Is equal to .: Is not equal to <. Is smaller than >. Is greater than <: Is smaller than or equal to >: Is greater than or equal to
Arithmetic and shorthand arithmetic operators
Addition + Normal +: Shorthand Subtraction - Normal -: Shorthand Multiplication * Normal *: Shorthand Division / Normal /: Shorthand
Built-in functions
For loop /(condition)>statement While loop %(condition)>statement If statement !(condition)>statement If, else statement !(condition)>statement|else statement
Function and variable defining
Define a function *fxx(variables)>statement Define an integer *vxx:1 Define a string *vxx:"Hello, world!"
Rules
When programming in suicide each new statement must appear on a new line. Variable and function identifiers may only be of two characters length and must be capitalized. Each identifier has a preceding letter, defining what kind of identifier it is. v is used for variables and f is used for functions. In suicide there is no such thing as "stand-alone integers". In pseudo-code it would look something like this, in a typical language:
for(a=0; a < 20; a++){ statements };
This is illegal in suicide and would instead be written like this
for(a=0; a < b=20; a++){ statements };
Programming
Basics
Variables
When defining a new variable in suicide, each new variable identifier must have a preceding star (*)
*vAA:1
This code would assign 1 to the variable AA
*vAA:"Hello, world!"
This code would assign the string "Hello, world!" to the variable AA
When fetching variables one just use the identifier for the variable as in the example below
*vAA:1 *vAB:vAA
Here we store 1 in AA and put it in AB
Functions
Just as when defining variables, each new function must have a preceding star.
*fAA(variables)>statements
Notice that in suicide you can have both a function called AA and at the same time a variable called AA. Meaning that the following program is legal
*fAA(*vAA)><*vAA fAA(*vAB:"Hello, world!")
While this is illegal
*fAA(*vAA)><*vAA fAA("Hello, world!")
The above legal program would output "Hello, world!", but without a new line. Printing out a line with a line break, one would instead use the << command.
Examples
Hello, world!
<*vAA:"Hello, world!"
99 bottles of beer
*vAA:99 *vAB:" bottles of beer on the wall," *vAC:" bottles of beer on the wall." *vAD:" bottles of beer." *vAE:"Take one down, pass it around." *vAF:" bottle of beer on the wall," *vAG:" bottle of beer on the wall." *vAH:" bottle of beer." *vAI:"No bottles of beer on the wall." %(vAA>:*vAJ:1)>!(vAA>.1)><vAA<<vAB<vAA<<vAD<<vAEvAA-:1<vAA<<AC|<vAA<<AF<vAA<<AH<<vAE<<vAIvAA-:1
Note: the above code is not tested and might be illegal or faulty
Simple addition
*vAA:4 *vAB:6 <*vAC:vAA+vAB
Turing completeness
The language with unbounded variables is Turing-complete by reduction from 3-cell Brainfuck. Assign the three cells the names a, b, and c, d is the data pointer, and e is for literals.
- + and - become a sequence of 3 if statements testing d and applying +e=1 or -e=1 to the appropriate choice of a, b, or c
- > and < update the value of d accordingly
- [statements] compiles to a sequence of 3 if statements testing d, each containing a while loop on the value of the appropriate variable with the condition >e=0 with the copy of whatever statements compiles to.