Programming Languages: the First JokePosted by Mariia Mykhailova on April 1, 2011
Programming languages have jokes and jokers of their own. As a matter of fact, most esoteric programming languages were designed to be a joke (unless they were a brain exercise like the infamous Brainfuck). But there is one language which really deserves to be called The First Joke. In ages past and gone, in year 1972, when all existing programming languages were entirely rational and deadly serious, two jokers pushed the limits and invented a completely new language. They called it "Compiler Language With No Pronounceable Acronym", which for obvious reasons abbreviated to INTERCAL.
40 years have passed; INTERCAL doesn't look like a language which has nothing at all in common with any other major language, as the developers intended it to. A common imperative language which has named variables, arrays, assignment command, 5 operators and a standard library which implements the missing arithmetic operations has a lot more in common with major languages than the basic Brainfuck, let alone two-dimensional languages, non-deterministic languages, paranoid languages, languages with a single instruction and other exhibit items. But INTERCAL stays the path-breaker of the family of esoteric languages, and a unique language in more than one way.
First of all, the reference manual. Modern esoteric languages focus on being special in their core, and their descriptions are meager listings of commands and language specifics. The INTERCAL Programming Language Reference Manual is a unique document, featuring epigraphs from "Alice in Wonderland" and impish comments voiced in a serious manner. Besides, especially for this language the authors developed a system of cute names for service characters used: ' is called spark, " - rabbit-ears, . - spot, : - two-spot, , - tail, ; - hybrid (I'd think "spotted tail" would be more appropriate), $ - big money, ~ - sqiggle etc. (full list of names in given in Tonsil A, which is another unique feature of this document). Combining rabbit-ears with spot to obtain a rabbit is strictly prohibited!
Next, the error messages. Decent programming languages make their error messages informative and point out their reasons as fully as possible. Indecent ones, on the contrary, make the messages either universal or misleading. INTERCAL messages are just as sarcastic as the manual, and are impossible to decipher without the latter. Honestly, one can figure out that E252 "I'VE FORGOTTEN WHAT I WAS ABOUT TO SAY" is caused by the compiler running out of memory while trying to do I/O; or that E182 "YOU MUST LIKE THIS LABEL A LOT!" means the program uses one label in several places. But who on earth could imagine that E405 "PROGRAM REJECTED FOR MENTAL HEALTH REASONS" is caused by using multithreading or backtracking commands without specifying the corresponding option? That E017 "DO YOU EXPECT ME TO FIGURE THIS OUT?" means an attempt to use a constant outside of allowed range? That E127 "SAYING 'ABRACADABRA' WITHOUT A MAGIC WAND WON'T DO YOU ANY GOOD" is cured by including the system library in compiler options?
Some errors have no prototypes in other languages. Thus, E079 "PROGRAMMER IS INSUFFICIENTLY POLITE" and E099 "PROGRAMMER IS OVERLY POLITE" are related to the number of PLEASE statement identifiers (which, by the way, have no other message than producing these errors). E774 "RANDOM COMPILER BUG" is fully described by its name - it occurs at random and usually disappears during recompilation. E995 "DO YOU REALLY EXPECT ME TO HAVE IMPLEMENTED THAT?" is caused by an attempt to run pieces of code which haven't been written yet (don't ask me how, I've no idea).
Finally, there is the language itself. It has a lot to be said about, it's better to read The Revised Reference Manual which preserves the style of the original manual but uses modern language implementations. Here are my favorite parts of it:
- INTERCAL is an exceedingly easy language to learn, one might expect it would be a good language for initiating novice programmers. Perhaps surprising, than, is the fact that it would be more likely to initiate a novice into a search for another line of work.
- The examples of INTERCAL programming which have appeared in the preceding sections of this manual have probably seemed highly esoteric to the reader unfamiliar with the language. With the aim of making them more so, we present here a description of INTERCAL.
- INTERCAL recognizes 5 operators - 2 binary and 3 unary... In a sense, all 5 operators are binary, as they are all bit-oriented, but it is not our purpose here to quibble about bits of trivia.
Precedence of operators is as follows:
(This space intentionally left blank) **
** Keep in mind that the aim in designing INTERCAL was to have no precedents.
- Each statement of the program can have an execution probability associated with it. Besides, some commands block execution of further commands of certain types or changing variables.
- The numbers are printed as "butchered" Roman numerals. To enter a number, one has to spell it digit by digit in any human language supported by the compiler. Each compilers handles character I/O in its own way, and all of them are too terrible to be described here.
Nowadays there still exist people who keep faith in INTERCAL and are proud of their title "technomasohists". Some of them hoodwink their rivals source codes in INTERCAL, the others argue that INTERCAL is better than Perl in many ways:
- it has more readable variables names (right, INTERCAL variables have no names, just the indexes);
- it has a better system of sigils which identifies the variable datatype exactly (. and : are 16 and 32-bit integers, , and ; are arrays of 16 and 32-bit integers);
- no nail clippings (i.e., parentheses - they are replaced with rabbit-ears and sparks);
- very simple precedence rules (what can be more simple than absence of thereof?);
- things which require an extension in Perl are built-in in INTERCAL - for example, Roman numbers;
- INTERCAL is user-oriented, as opposed to program-oriented (unlike most languages, input is done by WRITE IN command, and output by READ OUT);
- finally, programming should be fun; a 15-minute exercises in Perl will take several days in INTERCAL - it's clear which language is supreme :-)
Check Progopedia article about INTERCAL for code examples.