- The title of this article is incorrect because of technical limitations. The correct title is !@#$%^&*()_+.
!@#$%^&*()_+ is another fun stack-based language (in the broader sense) invented by User:Conor O'Brien where character literals have no delimiter with programs that resemble grawlixes (random symbols, typically on the top row of the keyboard, which replace vulgarism). Notably, it is the first language in the language list of Try It Online.
!@#$%^&*()_+ operates on a "stack" that allows random access and rotation, which is usually still regarded as a stack in esolangs. Initially, the stack contains a single zero.
The 12 documented instructions are described as follows:
||Pop and print as Unicode character.|
||Pop and print as integer.|
||Rotate stack 1 right.|
||Indexing. Pop a and push the ath number in the stack (zero-indexed from the bottom)|
||Input a character and add it to the number on the stack top.|
||If top is 0, go to corresponding ')' (similar to the '[' in brainfuck)|
||If top is not 0, go to corresponding '(' (similar to the ']' in brainfuck)|
Popping from an empty stack gives 0.
Characters that are not instructions, including unprintables, are character literals.
There is one undocumented debugging instruction,
?, which outputs the stack from the bottom to the top 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.
Infinite fibonacci sequence
!#!^! @#(!%+! @#)
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.
99 bottles of beer
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.
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.
- https://tio.run/#ecndpcaalrlp - an online interpreter.
- https://github.com/ConorOBrien-Foxx/ecndpcaalrlp - source code of the above interpreter written in D.
- https://paste.ubuntu.com/p/2cPT8NR5x8/ - a reimplementation.