Programming Languages: The First Joke
Programming languages have their own pranksters and their own jokes. Actually, most esoteric programming languages were conceived precisely as jokes (of course, if not as a challenge to the public, like F * ckf * ck, or as an exercise for the mind, like Brainfuck). But there is one language that has rightfully earned the honorary title of First Joke. Back in 1972, when all existing programming languages were extremely practical and deadly serious, in the early morning of May 26 a couple of pranksters pushed the boundaries of what exists and came up with a fundamentally new language. They christened it Compiler Language With No Pronounceable Acronym, which for obvious reasons was reduced to INTERCAL .
Almost 40 years have passed since then. INTERCAL has long ceasedhave nothing to do with any mainstream language as its developers wanted. You must admit that an ordinary imperative language in which there are named variables, arrays, an assignment operation, as many as 5 operators and a standard library that implements the missing arithmetic operations has much more in common with normal languages than Brainfuck itself, not to mention two-dimensional non-deterministic languages languages, paranoid languages, languages with a single instruction and other exhibits of our vivarium. But he continues to be a pioneer of the genre, unique in many ways.
First of all, a reference guide. Later esoteric languages concentrate their unusualness in the very essence of the language, their manuals are limited to dry factual descriptions of commands and features.The INTERCAL Programming Language Reference Manual is a unique description of a programming language, with epigraphs from "Alice in Wonderland" and sarcastic comments uttered in a completely serious tone. In addition, especially for this language, the authors developed a system of euphemisms for the used service symbols: '- spark,' - rabbit ears,. - spot,: - double spot,, - tail,; - hybrid (although a “spotted tail” would be more logical ), $ - big money, ~ - zagogulin, etc. (a complete list is attached to the manual). Combining rabbit ears with a spot to get a rabbit is prohibited!
Next, error messages. In decent languages, error messages are informative and accurately indicate the reasons for what happened. In dishonest ones, on the contrary, messages are either universal or throw up the wrong reasons for the error. INTERCAL errors are just as malicious as the manual, and without a reference they are not deciphered in principle. In fact, you can guess that E252 “I forgot what I was going to say” is a memory overflow error during I / O operations, and E182 “It seems you really like this label” is an error of using the same label several times. But who in their right mind and solid memory would come up with the idea that the E405 “Program was rejected for mental health reasons” signals the use of multithreading commands or calculations with rollbacks without the corresponding compiler option, E017 “What,
Some errors have no analogues in other languages at all. So, the pair E079 “Programmer is not polite enough” and E099 “Programmer is too polite” refer to the number of identifiers of the PLEASE command in the program (by the way, the PLEASE identifier does not carry any other semantic load). Error E774 "Random compiler bug" is fully consistent with its name - it occurs by chance and usually disappears when recompiled. E995 “What, did I really have to implement this?” Occurs when I try to execute code that has not yet been written (just don’t ask how this can be done!).
Finally, the language itself. You can talk about it for a long time, but it is better to read the Revised Reference Manual , which preserves the style of the original manual, but uses modern language implementations. Here are some of my favorite places:
And nowadays, people who are loyal to INTERCAL and proud of their rank of techno-masochists remain - some throw up the source code for the operating system in this wonderful language, others prove that INTERCAL is better than Perl:
Almost 40 years have passed since then. INTERCAL has long ceasedhave nothing to do with any mainstream language as its developers wanted. You must admit that an ordinary imperative language in which there are named variables, arrays, an assignment operation, as many as 5 operators and a standard library that implements the missing arithmetic operations has much more in common with normal languages than Brainfuck itself, not to mention two-dimensional non-deterministic languages languages, paranoid languages, languages with a single instruction and other exhibits of our vivarium. But he continues to be a pioneer of the genre, unique in many ways.
First of all, a reference guide. Later esoteric languages concentrate their unusualness in the very essence of the language, their manuals are limited to dry factual descriptions of commands and features.The INTERCAL Programming Language Reference Manual is a unique description of a programming language, with epigraphs from "Alice in Wonderland" and sarcastic comments uttered in a completely serious tone. In addition, especially for this language, the authors developed a system of euphemisms for the used service symbols: '- spark,' - rabbit ears,. - spot,: - double spot,, - tail,; - hybrid (although a “spotted tail” would be more logical ), $ - big money, ~ - zagogulin, etc. (a complete list is attached to the manual). Combining rabbit ears with a spot to get a rabbit is prohibited!
Next, error messages. In decent languages, error messages are informative and accurately indicate the reasons for what happened. In dishonest ones, on the contrary, messages are either universal or throw up the wrong reasons for the error. INTERCAL errors are just as malicious as the manual, and without a reference they are not deciphered in principle. In fact, you can guess that E252 “I forgot what I was going to say” is a memory overflow error during I / O operations, and E182 “It seems you really like this label” is an error of using the same label several times. But who in their right mind and solid memory would come up with the idea that the E405 “Program was rejected for mental health reasons” signals the use of multithreading commands or calculations with rollbacks without the corresponding compiler option, E017 “What,
Some errors have no analogues in other languages at all. So, the pair E079 “Programmer is not polite enough” and E099 “Programmer is too polite” refer to the number of identifiers of the PLEASE command in the program (by the way, the PLEASE identifier does not carry any other semantic load). Error E774 "Random compiler bug" is fully consistent with its name - it occurs by chance and usually disappears when recompiled. E995 “What, did I really have to implement this?” Occurs when I try to execute code that has not yet been written (just don’t ask how this can be done!).
Finally, the language itself. You can talk about it for a long time, but it is better to read the Revised Reference Manual , which preserves the style of the original manual, but uses modern language implementations. Here are some of my favorite places:
- INTERCAL is a very easy language to learn, and one would suggest that it would be good for initiating novice programmers. In fact, he is more likely to push the programmer to look for another job.
- The examples of programs given in the previous sections may seem quite esoteric to a reader unfamiliar with the language. To reinforce this impression, we provide a description of the language.
- INTERCAL has 5 operators - 2 binary and 3 unary. However, in a sense, all operators are binary, since they all operate with a binary representation of the arguments, but this play on words takes us away from the presentation.
- The priority of the operators is defined as follows: (the rest of the page is purposefully left blank - do not forget that the creators of INTERCAL set as their goal the absence of priorities).
- Each program command can be set to the probability with which it will be executed when the program starts. In addition, there are commands that block the execution of subsequent commands of a certain type or change of variables.
- Numbers are displayed in Roman notation, and are entered in words one digit in any language that the compiler supports. Character input / output is implemented differently in different compilers, and is in any case too terrible to describe here.
And nowadays, people who are loyal to INTERCAL and proud of their rank of techno-masochists remain - some throw up the source code for the operating system in this wonderful language, others prove that INTERCAL is better than Perl:
- more readable variable names (in INTERCAL, variables have no names, but only numbers);
- exact prefixing of a variable of its type (. and: - 16 and 32-bit integers,, and; - arrays of 16 and 32-bit integers);
- no scraps of nails (that is, brackets - instead of them in INTERCAL, single and double quotes);
- very simple rules for the priority of operations (what could be simpler than their absence?);
- INTERCAL has built-in things that require extensions in Perl - for example, Roman numbers;
- targeting the user, not the program (unlike most languages, the input is performed with the WRITE IN command, the output is READ OUT);
- finally, the programming process itself should be fun; a program that can be written in Perl in 15 minutes will take several days on INTERCAL - it is clear which language is better ;-)