5-minute guide to esoteric programming languages: try to classify them

    Esoteric programming languages ​​(or esolang - short for esoteric language) are languages ​​created not only to write code. In one of our materials, we casually raised this topic - the BANCStar language was described there (strictly speaking, you cannot call it 100% “esoteric”, although you want to).

    In this article, we will dwell on how esoteric PLs can be classified: what distinguishes “comic” esoteric languages ​​from “serious” languages, what goals their creators can pursue, and what inspires the latter. Photo Markus Spiske PD



    A few words about esoteric YP


    A work of art or a joke, a puzzle or a secret code - all these definitions refer to esoteric programming languages. Such languages ​​are created for different purposes, however, “the development of a convenient tool for solving the programmer’s work tasks” is usually not included in their list.

    According to software architect Federico Tomassetti, an esoteric programming language is being developed with the goal of challenging the “norms” of designing a nuclear program. This challenge can be expressed in different ways: from a simple striving for something unusual to creating a full-fledged “work of art”. Let’s try to figure out what these challenges might be and how, in this connection, one can divide the whole variety of esoteric languages ​​into groups.

    An important point: the authors of many esoteric languages ​​strive to lay down as many differences as possible in their syntax and structure (from everything that was created in this area earlier). Therefore, any classification of esoteric PLs is, rather, an opportunity to understand how, why, and for what purposes languages ​​were created, rather than an attempt to create a rigorous and orderly system.

    What are the classification options?


    Turing completeness


    The most obvious approach to dividing esoteric languages ​​into groups is according to whether they are Turing-complete : is it possible (at least in theory) to implement any computable function using the language or not. One of the Turing-complete languages ​​is, for example, INTERCAL . On the website of the American programmer, hacker and co-founder of Open Source Initiative Eric Raymond (Eric S. Raymond, ESR), INTERCAL described as "developed to achieve Turing completeness and maximum dissimilarity to existing programming languages."

    Thanks to these features, INTERCAL, according to ESR, is able to “cause tears (laughter) in strong men” and is “the center of the international community of techno-masochists”.

    Despite its comic nature, INTERCAL was not only “viable” (if this concept is applicable to esoteric languages), but also became the basis for the creation of many other esoteric PLs.

    On the other hand, among esoteric languages ​​(due to their features) there are also Turing incomplete languages . Such, for example, as HQ9 +, which has only 4 teams (of which the name of the language is composed). This comic language allows you to easily solve all the "standard" tasks of a novice programmer: from "Hello, world!" (Command H) to the output of quine (command Q).

    However, even Turing completeness does not mean that esoteric language can be easily used in work. Among esoteric languages ​​quite often there are “ Turing bogs"- languages ​​that have Turing completeness, but at the same time have limited (and even poor) syntax and semantics.

    In theory, they have the same capabilities as any Turing-complete languages ​​(both esoteric and working), but due to limitations it is extremely difficult to implement some types of programs with their help. INTERCAL, by the way, is often referred to as “quagmire”. Another example is another no less popular esoteric YP Brainfuck. To imagine how complicated simple operations using such languages ​​can be, here is an example of the classic “Hello, world!” On Brainfuck (there are other implementation options, including shorter ones):

    +++++++++++++++++++++++++++++++++++++++++++++
     +++++++++++++++++++++++++++.+++++++++++++++++
     ++++++++++++.+++++++..+++.-------------------
     ---------------------------------------------
     ---------------.+++++++++++++++++++++++++++++
     ++++++++++++++++++++++++++.++++++++++++++++++
     ++++++.+++.------.--------.------------------
     ---------------------------------------------
     ----.-----------------------.

    Language creation goals


    Federico Tomassetti identifies several “target groups” of esoteric languages. Among them, for example:

    1. Languages ​​designed to solve a specific problem.

    Not always this task is universally recognized, but for the creator of the language and his community of like-minded people, it has value - and therefore, the language that helps to solve it is also valuable. These include Thue (named after the Norwegian mathematician Axel Thue ) - a language created as a demonstration of the zero type in the Chomsky hierarchy (by the way, it also refers to the “Turing bogs”).

    2. “Confusing languages” or black box languages

    They are designed to make the code as unreadable as possible for the uninitiated and make it difficult to write code. The most striking feature of the "black boxes" is obfuscation, that is, the deliberate concealment of the true value of a particular piece of code. These include, for example, Malbolge (named after the eighth circle of hell Dante, which includes, among other things, all kinds of deceivers). Evidence of its complexity can be illustrated by the fact that the working quine on Malbolge was written 14 years after the creation of the language, the second version - after another 3 years.

    On the other hand, there are more “humane” examples of such languages. In particular - all the same BANCStar , which can be attributed to the working programming languages ​​with a big stretch. As he saysdeveloper Joe Loughry, by 1997, no more than a dozen people wrote programs in this language around the world, and in total about 1350 programs were written on BANCStar - an almost esoteric language, which, nevertheless, was developed for commercial purposes. One of these goals was precisely that sensitive banking information was under reliable protection (developers were strictly forbidden to comment on the code).

    3. Languages ​​created to confirm the viability of a particular concept

    These languages ​​themselves may be inconvenient and non-functional, but nevertheless, they are irrefutable evidence that the concept has a right to exist. Such languages ​​include, for example, the Funges language familyusing multidimensional representations of programs.

    sources of inspiration


    Esoteric programming languages ​​can be classified including “according to the interests of their authors”: many of these interests and hobbies are reflected in the syntax and characteristics of languages.

    1. Cinema

    One of the most popular examples of esoteric languages ​​inspired by cinema in general (and science fiction in particular) is var'aq . It was created by Brian Connors, a fan of the Star Trek universe, and is a "language based on the hacker culture of the Klingon race."

    According to the author, the name var'aq in Klingon does not mean anything, but the language could be named after some popular Klingon mathematician (something like Pascal). The syntax and features of the language, according to the author, reflect the specific type of thinking and mentality of Klingons.

    Among the esoteric programming languages, other movie examples are also popular. In particular, a language that uses Arnold Schwarzenegger or Groot phrases as syntax , named after the character “Guardians of the Galaxy” (the syntax of this language is quite predictable).

    2. Literature

    Another source of inspiration for the creators of esoteric programming languages ​​is books. Probably one of the most revealing examples of “literary” syntax in programming is the languageShakespeare . The authors of the language - Karl Hasselström (Karl Hasselström) and John Aslund (Jon Åslund), write that they decided to create it as part of the work on the course of parsing. A few weeks before, they got acquainted with other esoteric programming languages ​​and came up with a combination of a course assignment, knowledge of esoteric languages, as well as a peculiar Shakespeare style.

    As a result, a language appeared that made it possible to turn any program into a dramatic work, whose characters go on stage and (mostly) inflict a variety of insults on each other. Each program contains a title and acts, which, in turn, are divided into scenes (all as in a real play). Here, for example, is an excerpt from the drama “Hello world”, act one, scene one (only two acts in “Hello World”, the first consists of two, the second consists of three scenes): 3. Fine Art Perhaps the most famous example of an esoteric language inspired by painting - Piet

    The Infamous Hello World Program.
     
    Romeo, a young man with a remarkable patience.
    Juliet, a likewise young woman of remarkable grace.
    Ophelia, a remarkable woman much in dispute with Hamlet.
    Hamlet, the flatterer of Andersen Insulting A/S.
     
    Act I: Hamlet's insults and flattery.
     
    Scene I: The insulting of Romeo.
     
    [Enter Hamlet and Romeo]
     
    Hamlet:
    You lying stupid fatherless big smelly half-witted coward!
    You are as stupid as the difference between a handsome rich brave
    hero and thyself! Speak your mind!
     
    You are as brave as the sum of your fat little stuffed misused dusty
    old rotten codpiece and a beautiful fair warm peaceful sunny summer's
    day. You are as healthy as the difference between the sum of the
    sweetest reddest rose and my father and yourself! Speak your mind!
     
    You are as cowardly as the sum of yourself and the difference
    between a big mighty proud kingdom and a horse. Speak your mind.
     
    Speak your mind!
     
    [Exit Romeo]




    , named after Pete Mondrian, one of the founders of abstract painting. The program code in Piet looks like an abstract drawing made up of 20 different colors - examples of the work of programmers at Piet can be found here .

    By the way, some of the developers are so inspired by their creations that they decide to perpetuate them on canvas - for example, did Jack Andersen, who drew his program in the process. You can read more about Piet in this material on Habré.

    Another language using colors and named after the artist is Matisse (a modification of Brainfuck). Another "extremely esoteric" art programming language is Magritte. Only one program is written on it - in the style of surrealism Rene Magritte - because of which the language is classified as non-functional and comic (about this category a little lower).

    Comic languages


    Sometimes "joke languages" are allocated in a separate group. The esolang wiki portal dedicated to esoteric languages describes comic languages ​​as “not of interest - except for their humorous component”, as well as “trivial and less interesting versions of existing esoteric languages, even in theory.” However, the list of comic languages ​​on esolang alone has more than 130 titles.

    On the other hand, more complex, recognized esoteric PLs are sometimes referred to comic languages. For example INTERCAL, the entire manual on which is a joke: in the introduction, in particular, it is emphasized that "all matches of the programming languages ​​described here with other programming languages, dead or alive, are random."

    As a rule, each esoteric language can be classified in several ways at once - by Turing completeness, goals and objectives (if clearly indicated), by linking to artworks and even by the sense of humor of the creators of the language. In the end, esoteric languages ​​are created to violate all the rules - including the rules of classification.

    In the second part of our five-minute guide, we will try to find out which esoteric languages ​​have the most fans among developers, and why are they developed at all.

    Also popular now: