05AB1E

From Esolang
(Redirected from 05ab1e)
Jump to navigation Jump to search

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'.

Basic syntax

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)

IO

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.

Commands

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.

Examples

Note: Some of these examples do not terminate. In 05AB1E, the infinite loops produce errors, which may make some programs faulty.

Hello World

"Hello, World!

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 (Hence, the missing end-quotes). 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.

Cat program


Implicit input, implicit output.

Quine

1

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!)

Fibonacci numbers

ÅF

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.

∞vNÅf,

This program prints every Fibonacci number with a succeeding line feed infinitely.

Factorial sequence

∞vN!,

Similar to the above Fibonacci sequence, but with factorials.

Truth-machine

[?_#

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.

2sable

2sable is an expiremental dialect of 05AB1E created by the same author. The goal of the language was of not requiring to enter multiple inputs. Instead, only one input is required, allowing shorter programs. The project is abandoned.

2sable contains lots of conflicts and bugs. [citation needed]

External links