XENBLN

From Esolang
Jump to navigation Jump to search

XENBLN is a code-golfing language created by User:PythonshellDebugwindow.

Etymology

The name "XENBLN" is the capitalized Latin-alphabet lookalikes (kind of) of the Cyrillic letters of the Russian transliteration (kind of) of "Jelly" (which is "Желлый"), another code-golfing language.

Program structure

Like @, a program in XENBLN is made of trees of function calls. Each character (with some exceptions) represents a function that may take as many or few arguments as it likes. Arguments are then read from directly after it in the code.

For example, if command A takes 1 argument, B takes 2, C takes 3, and D and E both take none, then the code

  BADCDBEDEDAE

in XENBLN be written in many languages like

  B(A(D()), C(D(), B(E(), D()), E())));
  D();
  A(E());

Command arguments are evaluated RTL, but commands are executed LTR, except for in special cases like loops and if/else statements.

Datatypes

Datatype Regex Example
Integer ([0-9]+) 123
Float/Double [0-9]*\.[0-9]* 123.45
Boolean [tf] t
String ("([^"]*«)*[^"]*)" ﹡﹡ "Hello, World!"
Array \[(anything)*\] [123t"Hello, World!"456f0.5] (in many languages, this would be [123, true, "Hello, World!", 456, false, 0.5])
Undefined û û
NaN ñ ñ
Invalid type ÿ ÿ

﹡ If no digits are provided on one or both side(s) of the decimal point, that number is assumed to be 0, e.g. 0.0 = 0. = .0 = ..
﹡﹡ Escape characters in strings are as follows: \\ for a backslash, \" for double quotes, \n for newline, \t for tab, \f for form feed, \« (« = string separator) for the character «, and anything else after a backslash means that backslash will be replaced by \\ (escaped backslash). Also, if EOF is reached before a string is terminated, then it will be terminated automatically, meaning that the EOF string regex is (("[^"]*)|("([^"]*«)*[^"]*).

Number separation

Use the , character to separate two numbers in XENBLN, e.g. [123,456,7.89"str"] (code-golfed: [123,456,7.89"str) would in many languages be [123, 456, 7.89, "str"].

Number non-literals

õ, z, o, etc. represent numbers — these three represent -1, 0, and 1 respectively.

I/O Capabilities

Input

There are multiple ways to get input in XENBLN, with different purposes. The I command (0 args) returns user input as an arbitrary-length string (or empty string if no input is given); the N command (0 args) returns user input as an arbitrary-size integer (or 0 if no input is given or if an invalid int/float/double is given); the M command (0 args) returns user input as a float/double or 0.0 if no input or invalid int/float/double; the Ì command (1 arg) returns user input as an integer or 0 if no input or invalid int/float/double, but its argument is first printed out without a newline like a prompt; the ì command (1 arg) returns user input as a string or empty string if no input, but its argument is first printed out without a newline like a prompt; and the í command (1 arg) returns user input as a float/double or 0.0 if no input or invalid int/float/double, but its argument is first printed out without a newline like a prompt.

Output

Like with input, there are multiple commands for output in XENBLN. The O command (1 arg), which outputs its argument and a newline, but has been rendered obsolete (see Automatic output, below), is perhaps the simplest of these; the Œ command (1 arg) outputs its argument without a newline; the Ø command (1 arg) outputs its argument with a newline and then returns it; and the ø command (1 arg) outputs its argument without a newline and then returns it.

Automatic output

If a non-undefined value is computed and is not an argument to a function, it is output with a newline, meaning the O command (1 arg) is only needed for outputting undefined (or possibly so) values.

Examples

Hello, World! (1 byte)

š

Quine (2 bytes)

Š1

Infinite loop of nops (2 bytes)

ŹÜ

Cat (1 byte)

I

Infinite cat (2 bytes)

ŹI

Reverse cat (2 bytes)

VI

Truth-machine (3 bytes)

ČÎx

Loop until the user says "stop" (case-insensitive) (9 bytes)

w≠BI"stop

Mean of array (stored in variable a) (12 bytes)

:zŻa:+\x÷\Ga