- The title of this article is incorrect because of technical limitations. The correct title is !@#$%^&*()_+.
!@#$%^&*()_+ is another fun esoteric programming language invented by PPCG user Conor O'Brien (User:Conor O'Brien). It is a stack-based language. Its most highlighted characteristic might be that all characters are considered valid commands in the language (there are no nop commands). The title consists of all of its special commands which are used for manipulating the stack. !@#$%^&*()_+ programs resemble grawlixes (random symbols which replace vulgarism).
The syntax in !@#$%^&*()_+ entirely consists of one-letter ASCII characters.
There are 12 special characters. These are usually found on the top of a QWERTY keyboard. The characters are as follows:
N = Top of the stack
M = Number below N
|Character||Result||Print this character in !@#$%^&*()_+|
||Pushes N to the stack (duplicate N)||(space)|
||Outputs the ASCII character associated with N and pops N (Print string)|
||Outputs N and pops N (Print integer)|
||Swaps N and M (Swap top two values)|
||Puts N to the bottom of the stack (Rotate stack)|
||Adds one to N (Increments N)|
||Replaces N with the Nth number in the 0-based stack (Get Nth number)|
||Takes one character from STDIN and adds its ASCII value to N, if EOF reached return -1 (Input)||(newline)(space)|
||If N is 0, go to corresponding ')' (similar to the '[' in brainfuck)|
||If N is not 0, go to corresponding '(' (similar to the ']' in brainfuck)|
||Multiplies N by -1 (Negate N)|
||Pops N and adds it to M (add N and M)||(newline)(space)|
Any other character, including spaces and newlines, will have their ASCII value pushed on to the stack. Comments can be put at the end of every program (or at least after the last
Note: When the stack is empty, popping from it results in 0. There's a 0 in the stack initially.
There is one undocumented instruction,
?, which outputs the stack along with their index.
Spoiler alert: you may want to program these programs by yourself before going in-depth.
Note: the space at the beginning of the program is mandatory.
This program prints the overused coding clichè "Hello, world!".
The space at the starts pushes its ASCII value (32). The
^ increments 32, making it the ASCII value of the exclamation mark (33). The rest of the alphabet push their respective values until it comes into a loop where all of the pushed numbers get printed.
An alternative version that does not use any letters at all:
^22+2:+99+78+;<+ ,78+66+!23+' ^+(@)
Again, the leading space, as well as the two spaces in the middle, is mandatory.
!#!^! @#(!%+! @#)
The program starts with 1 on top of zero and prints them. After that, the program infinitely puts a copy of N on the bottom of the stack and prints the sum of N and M.
This program uses a variable which is incremented twice every iteration and is added to the last square number.
This code prints a single 0 when the input is zero, otherwise, it repeatedly prints the input.
c(!#$ ,llaw eht no reeb fo selttob (@)$!#$ ,dnuora ti ssap ,nwod eno ekaT .reeb fo selttob (@)$_^_!#$ .llaw eht no reeb fo selttob (@)+)
This program prints the entire nursery rhyme '99 bottles of beer' (with an extra space/newline in the end).
Also, the grammatical mistake of "1 bottles of beer" is present.
*(_^_$_^$)$(O@d@d@ _+)+_^(E@v@e@n@ _+)
This program reads a character and determines whether its ASCII value is even or odd...
*^(% _+*^)%(0_+%)% _+^$($_^_$_^_$+!!!!!!!!!+++++++++^$)+_^_ _+$(_^^^^^^^^^^_$^$)+ _+$(_^_$_^$)+#
...and this program determines the remainder of the input number when divided by 2.
It is now your time to figure out what this does!
This program pushes LO onto the stack and prints them alternately, so the program outputs "LOLOLOL..." indefinitely.