INTERCAL
INTERCAL
INTERCAL — the Compiler Language With No Pronounceable Acronym — is the first programming language designed to be difficult on purpose. Written in 1972 by Don Woods and James M. Lyon, then students at Princeton, it is a deadpan parody of every language its authors had suffered through: FORTRAN, COBOL, ALGOL, BASIC, PL/I and SNOBOL all get their noses tweaked at once. The language has no pronounceable name, no conventional control flow, and a compiler that judges the programmer's manners. It also works, completely and correctly, which is what elevates it from a joke on paper to a joke you can run.
INTERCAL's official documentation is itself part of the artifact. The manual is written with the solemn bureaucratic gravity of a genuine IBM language reference, and maintains the straight face so perfectly that readers occasionally fail to notice it is a parody until the compiler rejects their program for being insufficiently polite.[1]
A joke compiled in seriousness
Woods and Lyon began INTERCAL in the spring of 1972, roughly simultaneously with the appearance of structured programming's ascendancy — the era when "real" languages were supposed to be getting more reasonable. Their response was a language "which has none of the characteristics of a normal language," per the manual, and which systematically violates every convention of its ancestors. Where FORTRAN had GOTO, INTERCAL would eventually have COME FROM. Where COBOL had mandatory verbosity, INTERCAL made verbosity politically fraught.[2]
Woods, who would go on to co-author the original Colossal Cave Adventure game a few years later, never entirely escaped the language. When Eric S. Raymond resurrected and maintained C-INTERCAL in the 1990s, he credited Woods with blessing the resurrection — and the manual's humour survived into the new implementation's documentation largely intact.[3]
PLEASE, and other ways to fail
INTERCAL's best-known mechanism is politeness enforcement. Statements may be prefixed with PLEASE — but the compiler enforces a quota. If too few statements carry the polite prefix, compilation fails with a message to the effect that the program is insufficiently polite. If too many do, it fails for being too polite. The manual recommends, in passing, that somewhere between a fifth and a third of statements is generally acceptable — a specification detail that has ruined more than one first INTERCAL program.[4]
The rest of the vocabulary is equally hostile, and equally precise:
COME FROMreplacesGOTO: aCOME FROMstatement is inverted — execution does not jump to it, it jumps from a labelled statement back to theCOME FROM. The programmer must trace not where control goes but where it was when it arrived. The manual notes this has "the same effect" as a jump, which is technically true and practically sadistic.COME FROM semantics and the claimed equivalence">[5]ABSTAINdisables features of the language —ABSTAIN FROM COMMENTINGremoves the compiler's comment-checking; you can abstain from whole statement types, arithmetic, or the ability to do arithmetic in a given base.- Stackless control:
NEXTpushes a return address and jumps,RESUMEpops and returns — but the stack is only 80 levels deep, andFORGETexplicitly discards return addresses mid-stack. STASH/RETRIEVEsave and restore variable values to a hidden stack;IGNORE/REMEMBERtoggle write-permission on individual variables.GIVE UPhalts the program — the manual is emphatic that there is noRETURN.
Arithmetic is where INTERCAL stops pretending to be even cousin to a normal language. Its three primitive operators are mingle (bit-interleaving two operands), select (packed bit extraction governed by a second operand's set bits), and a unary set of AND / OR / XOR applied to a single operand after it has been bit-rotated one place. Multiplication is not provided; the manual suggests the user may "find it amusing" to implement it. The result is arithmetic that is technically complete and humanly unwritable — you can do it, but you will not enjoy it.[6]
The TONSIL specification
The manual's masterstroke is the TONSIL appendix — a section listing features the implementors might someday consider, presented in descending order of plausibility, all of them useless, some of them impossible, and all of them described with absolute bureaucratic sincerity. It is the feature-request backlog as art form, and it established the template every esolang manual since has followed: the joke is not in the language alone but in the documentation's insistence that this is all normal.
What it started
INTERCAL did not invent the idea that a language could be absurd — but it invented the idea that absurdity could be a design goal. In 1972 the joke was a private Princeton one; by the 1990s, with Raymond's C-INTERCAL in distribution and the internet's communities forming, it had become the founding text of a genre. When Urban Müller made Brainfuck in 1993 to achieve the smallest possible compiler, he was working a different seam of the same joke. When Ben Olmstead wrote Malbolge in 1998 specifically to be the hardest language ever devised, he was answering a question INTERCAL had posed two decades earlier: how far can you push a language and still call it a language?
The answer, it turns out, is very far — and INTERCAL remains the original proof that the distance is the point.
Check your understanding
- What does
COME FROMdo — and why is it harder to use thanGOTO? - What happens if an INTERCAL program uses too many
PLEASEstatements? - Which three arithmetic operators does INTERCAL provide, and what is the catch?
- INTERCAL is credited with founding which entire language genre?
Show answers
1 — COME FROM is inverted control flow: execution jumps from a labelled line to the COME FROM statement, so you trace where control was, not where it goes. 2 — compilation fails; the compiler enforces a politeness quota — too few PLEASEs means insufficiently polite, too many means overly polite. 3 — mingle (interleave bits), select (extract bits by pattern), and unary AND/OR/XOR applied to a rotated operand — arithmetic is possible but deliberately punishing. 4 — the entire esoteric programming language tradition — Brainfuck, Malbolge, and every language designed to be difficult, absurd, or tiny on purpose.
Footnotes
- ↑ Woods, D.R. & Lyon, J.M., "The INTERCAL Programming Language Revised Reference Manual" — the original 1973 manual, still the definitive specification
- ↑ INTERCAL entry and history at the esoteric-languages wiki — the community's standard reference for the language's origins and lineage
- ↑ Raymond, E.S., C-INTERCAL home page — the maintained implementation and its lineage
- ↑ INTERCAL manual, section on statement syntax — the original politeness rule
- ↑ INTERCAL manual, control-flow section —
COME FROMsemantics and the claimed equivalence - ↑ INTERCAL manual, expression and operator sections — mingle, select, and rotated-operand bitwise ops