User:Alextretyak/11l

11l (elevenel) is an imperative, statically typed, compiled, general-purpose programming language with a design oriented towards combining readable and expressive code (as in Python) with the performance of C++.

In contrast to other programming languages, keywords in 11l are structured hierarchically. At the top of the hierarchy are 11 base or root keywords. This feature underlies the language's name, in which the ‘l’ may be read as standing for Latin ‘litterae’, Greek ‘logos’ (meaning ‘word’), or English ‘letters’ (because each root keyword in 11l can be abbreviated to a single letter).

Although the language is still at an early stage of development, the core language and the standard library contain sufficient functionality to solve most tasks on Rosetta Code. (11l is currently in 25th place by number of tasks solved on Rosetta Code.)

Operators
Most 11l operators are chosen on a rational basis. For example, the ‘bitwise exclusive or’ operation uses the three characters  (opening parenthesis),   (plus), and   (closing parenthesis), since they resemble the ⊕ character used to denote exclusive or in Boolean algebra. Although ⊕ is more commonly used for one-digit values, it is also found on Wikipedia used for pointers (see XOR linked list) and for arrays of bytes (see HMAC).

For the exponentiation operation the character  (caret) was chosen, since it is often used when writing formulas and mathematical expressions not only in programming languages and computer systems, but also in ordinary text. [The use of  for the ‘bitwise exclusive or’ operation (as in C and most other programming languages) may be regarded as an unfortunate idea, since it confuses newcomers to programming .]

For the ‘integer division’ operation, the letter  and the character   (slash) were chosen. The  is short for Integer.

Array concatenation is expressed with the three characters  (opening square bracket),   (plus) and   (closing square bracket), since arrays in 11l (as in JavaScript, Python, Ruby, Swift and many other languages) are written using square brackets (for example,  ). And since this operation is quite expensive, a separate operator is allocated to it.

Lexical analysis
According to the developer of the language, 11l implements the most advanced lexical analyzer among all the existing programming languages. This lexical analyzer, in particular, makes it possible to almost completely get rid of all visual noise such as mandatory semicolons at the end of statements, curly braces (or  and   keywords) to indicate code blocks, parentheses around conditions or expressions (for statements such as ,  , etc.), as well as colon  and backslash  characters at the end of lines. Here is an example of code in C and the corresponding 11l code (this is a translation of this Python code, rather than being a synthetic example): It is proposed to use dashed lines (less distracting than characters or keywords) to indicate blocks of code at the integrated development environment level, rather than language resources:



Standard library
The 11l standard library is based on the Python library, but many functions have been revised and certain shortcomings or deficiencies have been fixed. For example :
 * 1) The   function, which returns a random number   in the range , and the   function, which returns a number in the range  , have been combined into a single function which takes one argument of type "range" (in 11l the range for   is written as  , while the range for   is written as  ).
 * 2) The   regular expression object method has been replaced by   (in other words,   in Python corresponds to   in 11l).
 * 3) The   and   functions have been moved from the   module into the overloaded string methods   and   respectively.
 * 4) The   function from the   module and some functions from the   module (,  ,  ,  ,  ,  , etc.) have been moved to a separate   module; the functions from the   have been moved to.
 * 5) 11l has two modules instead of the   module:   (equivalent to  ) and , which has no direct equivalent in Python.
 * 6) The   and   functions return a string without the   or   prefix, because the unprefixed string is more often what is wanted.
 * 7)   in Python corresponds to   in 11l (and in 11l the elements of   can be not just strings, as in Python, but any objects for which conversion into a string is defined).
 * 8)   in Python corresponds to   in 11l.

Design principles
11l is designed so that files generated on different systems using the same source code will always be binary identical. For example, in Python, the default encoding when a text file is opened depends on the platform. 11l, by contrast, uses UTF-8 by default. The line ending character or characters when writing text files in Python are also platform-dependent, whereas 11l uses Unix-style line endings (i.e. the single character LF) when writing text files (the CR character is simply ignored in reading text files).

11l's minimalistic design makes it relatively easy to learn the entire language (including the standard library).

Implementation notes
The reference implementation of 11l takes the form of a Python → 11l → C++ transpiler, and thus can be used not only to compile 11l code but also to compile Python code [which results in significantly faster execution (often by more than an order of magnitude)]. It should be noted that this transpiler generates human-readable 11l code (which can help those who already know Python in learning 11l) and human-readable C++ code (which makes it easier to debug a program).