INTERCALThe Compiler Language With No Pronounceable Acronym (INTERCAL) is an esoteric programming language that was created as a parody by Don Woods and James M. Lyon , two Princeton University students, in 1972. It satirizes aspects of the various programming languages at the time,[1] as well as the proliferation of proposed language constructs and notations in the 1960s. There are two maintained implementations of INTERCAL dialects: C-INTERCAL (created in 1990), maintained by Eric S. Raymond[2] and Alex Smith,[3] and CLC-INTERCAL, maintained by Claudio Calvelli.[4] HistoryAccording to the original manual by the authors,[5]
The original Princeton implementation used punched cards and the EBCDIC character set. To allow INTERCAL to run on computers using ASCII, substitutions for two characters had to be made: Version numbersC-INTERCAL swaps the major and minor version numbers, compared to tradition. The HISTORY[7] file shows releases starting at version 0.3 and as of May 2020[update] having progressed to 0.31, but containing 1.26 between 0.26 and 0.27. CLC-INTERCAL version numbering scheme was traditional until version 0.06, when it changed to the scheme documented in the README[8] file, which says:
DetailsINTERCAL was intended to be completely different from all other computer languages. Common operations in other languages have cryptic and redundant syntax in INTERCAL. From the INTERCAL Reference Manual:[5]
INTERCAL has many other features designed to make it even more aesthetically unpleasing to the programmer: it uses statements such as "READ OUT", "IGNORE", "FORGET", and modifiers such as "PLEASE". This last keyword provides two reasons for the program's rejection by the compiler: if "PLEASE" does not appear often enough, the program is considered insufficiently polite, and the error message says this; if it appears too often, the program could be rejected as excessively polite. Although this feature existed in the original INTERCAL compiler, it was undocumented.[9] Despite the language's intentionally obtuse and wordy syntax, INTERCAL is nevertheless Turing-complete: given enough memory, INTERCAL can solve any problem that a Universal Turing machine can solve. Most implementations of INTERCAL do this very slowly, however. A Sieve of Eratosthenes benchmark, computing all prime numbers less than 65536, was tested on a Sun SPARCstation 1 in 1992. In C, it took less than half a second; the same program in INTERCAL took over seventeen hours.[10] DocumentationThe INTERCAL Reference Manual contains many paradoxical, nonsensical, or otherwise humorous instructions:
The manual also contains a "tonsil", as explained in this footnote: "4) Since all other reference manuals have appendices, it was decided that the INTERCAL manual should contain some other type of removable organ."[5] The INTERCAL manual gives unusual names to all non-alphanumeric ASCII characters: single and double quotes are 'sparks' and "rabbit ears" respectively. (The exception is the ampersand: as the Jargon File states, "what could be sillier?") The assignment operator, represented as an equals sign (INTERCAL's "half mesh") in many other programming languages, is in INTERCAL a left-arrow, SyntaxInput (using the Comments can be achieved by using the inverted statement identifiers involving NOT or N'T; these cause lines to be initially ABSTAINed from so that they have no effect.[5] (A line can be ABSTAINed from even if it does not have valid syntax; syntax errors happen at runtime, and only then when the line is un-ABSTAINed.)[5] Data structuresINTERCAL-72 (the original version of INTERCAL) had only four data types: the 16-bit integer (represented with a OperatorsThere are only five operators in INTERCAL-72. Implementations vary in which characters represent which operation, and many accept more than one character, so more than one possibility is given for many of the operators.
Contrary to most other languages, AND, OR, and XOR are unary operators, which work on consecutive bits of their argument; the most significant bit of the result is the operator applied to the least significant and most significant bits of the input, the second-most-significant bit of the result is the operator applied to the most and second-most significant bits, the third-most-significant bit of the result is the operator applied to the second-most and third-most bits, and so on. The operator is placed between the punctuation mark specifying a variable name or constant and the number that specifies which variable it is, or just inside grouping marks (i.e. one character later than it would be in programming languages like C.) SELECT and INTERLEAVE (which is also known as MINGLE) are infix binary operators; SELECT takes the bits of its first operand that correspond to "1" bits of its second operand and removes the bits that correspond to "0" bits, shifting towards the least significant bit and padding with zeroes (so 51 (110011 in binary) SELECT 21 (10101 in binary) is 5 (101 in binary)); MINGLE alternates bits from its first and second operands (in such a way that the least significant bit of its second operand is the least significant bit of the result). There is no operator precedence; grouping marks must be used to disambiguate the precedence where it would otherwise be ambiguous (the grouping marks available are Control structuresINTERCAL statements all start with a "statement identifier"; in INTERCAL-72, this can be In INTERCAL-72, the main control structures are NEXT, RESUME, and FORGET. C-INTERCAL also provides the COME FROM instruction, written Alternative ways to affect program flow, originally available in INTERCAL-72, are to use the IGNORE and REMEMBER instructions on variables (which cause writes to the variable to be silently ignored and to take effect again, so that instructions can be disabled by causing them to have no effect), and the ABSTAIN and REINSTATE instructions on lines or on types of statement, causing the lines to have no effect or to have an effect again respectively.[5] Hello, worldThe traditional "Hello, world!" program demonstrates how different INTERCAL is from standard programming languages. In C, it could read as follows: #include <stdio.h>
int main(void) {
printf("Hello, world!\n");
return 0;
}
The equivalent program in C-INTERCAL is longer and harder to read: DO ,1 <- #13
PLEASE DO ,1 SUB #1 <- #238
DO ,1 SUB #2 <- #108
DO ,1 SUB #3 <- #112
DO ,1 SUB #4 <- #0
DO ,1 SUB #5 <- #64
DO ,1 SUB #6 <- #194
DO ,1 SUB #7 <- #48
PLEASE DO ,1 SUB #8 <- #22
DO ,1 SUB #9 <- #248
DO ,1 SUB #10 <- #168
DO ,1 SUB #11 <- #24
DO ,1 SUB #12 <- #16
DO ,1 SUB #13 <- #162
PLEASE READ OUT ,1
PLEASE GIVE UP
DialectsThe original Woods–Lyon INTERCAL was very limited in its input/output capabilities: the only acceptable input were numbers with the digits spelled out, and the only output was an extended version of Roman numerals. The C-INTERCAL reimplementation, being available on the Internet, has made the language more popular with devotees of esoteric programming languages.[12] The C-INTERCAL dialect has a few differences from original INTERCAL and introduced a few new features, such as a COME FROM statement and a means of doing text I/O based on the Turing Text Model.[9] The authors of C-INTERCAL also created the TriINTERCAL variant, based on the Ternary numeral system and generalizing INTERCAL's set of operators.[9] A more recent variant is Threaded Intercal, which extends the functionality of COME FROM to support multithreading.[13] CLC-INTERCAL has a library called INTERNET for networking functionality including being an INTERCAL server, and also includes features such as Quantum Intercal, which enables multi-value calculations in a way purportedly ready for the first quantum computers. In early 2017 a .NET Implementation targeting the .NET Framework appeared on GitHub. This implementation supports the creation of standalone binary libraries and interop with other programming languages. [14] Impact and discussionIn the article "A Box, Darkly: Obfuscation, Weird Languages, and Code Aesthetics",[12] INTERCAL is described under the heading "Abandon all sanity, ye who enter here: INTERCAL". The compiler and commenting strategy are among the "weird" features described:
In "Technomasochism",[15] Lev Bratishenko characterizes the INTERCAL compiler as a dominatrix:
In popular cultureThe Nitrome Enjoyment System, a fictional video game console created by British indie game developer Nitrome, has games which are programmed in INTERCAL. References
External linksWikimedia Commons has media related to INTERCAL. |