You can edit almost every page by Creating an account. Otherwise, see the FAQ.

11l

From EverybodyWiki Bios & Wiki





Script error: No such module "Draft topics". Script error: No such module "AfC topic".

11l
Designed byAlexander Tretyak
First appeared2018
Typing disciplineStatic, strong, inferred
LicenseMIT License
Filename extensions.11l
Websitehttps://11l-lang.org
Influenced by
Python, C++

Search 11l on Amazon.

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.:[1] (11l is currently in 25th place by number of tasks solved on Rosetta Code.)

Operators[edit]

Most 11l operators are chosen on a rational basis.[2] 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.[3]]

For the 'integer division' operation, the letter I and the character / (slash) were chosen. The I 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, [1, 2, 3]). And since this operation is quite expensive, a separate operator is allocated to it.

Lexical analysis[edit]

According[4] 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 begin and end keywords) to indicate code blocks, parentheses around conditions or expressions (for statements such as if, while, 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):

C/C++/C# 11l
while (true) {
    switch (instr[i]) {
    case '[':
        nesting_level++;
        break;
    case ']':
        if (--nesting_level == 0)
            goto break_;
        break;
    }
    i++;
    ...
}
break_:
loop
   switch instr[i]
      "["
         nesting_level++
      "]"
         if --nesting_level == 0
            loop.break
   i++

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[edit]

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[5]

  1. The random.randrange(a, b) function, which returns a random number n in the range a <= n < b, and the random.randint(a, b) function, which returns a number in the range a <= n <= b, have been combined into a single function which takes one argument of type "range" (in 11l the range for a <= n <= b is written as a..b, while the range for a <= n < b is written as a.<b).
  2. The match() regular expression object method has been replaced by fullmatch() (in other words, fullmatch() in Python corresponds to match() in 11l).
  3. The re.split and re.sub functions have been moved from the re module into the overloaded string methods split and replace respectively.
  4. The gettempdir() function from the tempfile module and some functions from the os module (listdir, walk, mkdir, makedirs, remove, rename, etc.) have been moved to a separate fs module; the functions from the os.path have been moved to fs:path.
  5. 11l has two modules instead of the heapq module: minheap (equivalent to heapq) and maxheap, which has no direct equivalent in Python.
  6. The bin and hex functions return a string without the 0b or 0x prefix, because the unprefixed string is more often what is wanted.[6][7][8][9][10][11][12][13][14]
  7. "\n".join(arr) in Python corresponds to arr.join("\n") in 11l (and in 11l the elements of arr can be not just strings, as in Python, but any objects for which conversion into a string is defined).
  8. map(lambda x: x * 2, filter(lambda x: x % 2 == 0, [1, 2, 3, 4])) in Python corresponds to [1, 2, 3, 4].filter(x -> x % 2 == 0).map(x -> x * 2) in 11l.

Design principles[edit]

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[edit]

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

References[edit]

External links[edit]


This article "11l" is from Wikipedia. The list of its authors can be seen in its historical and/or the page Edithistory:11l. Articles copied from Draft Namespace on Wikipedia could be seen on the Draft Namespace of Wikipedia and not main one.