05AB1E (also typed as 05ab1e) is a stack-based programming language invented by PPCG user Adnan (also known as Adriandmen). Even though its syntax is quite simple and easy to understand, 05AB1E programs can contain over 250 unique and valid character-commands which perform 400+ different functions, making it popular for making golfed programs.
The name 05AB1E can be pronounced in multiple ways, such as 'osabie', 'osable' or even 'usable'.
The syntax of 05AB1E is entirely based on individual single-letter commands. However, unlike most other stack-based languages (Where the stack is primarily composed of integers or floats), the 05AB1E stack can be thought as a stack of strings.
There are three main data types in 05AB1E:
- Numbers. (Technically a string. They are implicitly converted to numbers when performing math. Can be integers or floats.)
- Strings. (Technically a list of ASCII characters. Single-characters can be interpreted as size-1 strings)
- Lists. (A superset of strings which convert to lists when performing list functions. Can contain strings, numbers or other lists)
When no printing command is called during runtime and execution is about to end, the top of the stack is automatically printed (If the stack is not empty), introducing a giant golfing advantage.
Lists are printed with enclosing square brackets (
). If a list contains a string, the string is enclosed by single-quotation marks (
'). All of the elements are printed with commas where necessary.
Another advantage of 05AB1E is that when the stack is empty, input is implicitly pushed to the stack.
There are over 250 character-commands in 05AB1E. Documenting all of them and their various functions is in this page is slightly impossible (and can make this page wierd). This page is the official documentation of them all.
Note: Some of these examples do not terminate. In 05AB1E, the infinite loops produce errors, which may make some programs faulty.
Prints the popular programming phrase "Hello, World!" onto STDOUT (output).
This pushes the string "Hello, World!" onto the stack. Since there is no more special commands to call, string parsing can continue. The top of the stack gets printed at the end.
A slightly golfed version:
This uses compressed strings which gets words from the 05AB1E dictionary.
Implicit input, implicit output.
Quines are extremely easy in 05AB1E.
1 pushes 1 to the stack. It gets automatically printed at the end.
Any program that only contains a number is a quine (Yey!)
Prints a list of all Fibonacci numbers which are less than the input.
The command pair
ÅF is designed to push a list of all fibonacci numbers less than the current top of the stack.
This program prints every Fibonacci number with a succeeding line feed infinitely.
Similar to the above Fibonacci sequence, but with factorials.
Input is implicitly pushed onto the stack.
[ starts an infinite loop (loop end is implicit in 05AB1E).
? outputs the number (without popping it),
_ is logical not, and
# breaks if the stack top is 1.