INTERCAL Introduction and Examples
From scripting, you started exploring Linux, and that got you all interested in free and open source software, so you started reading about Richard Stallman and the GNU project.
You want to improve your programming skills and your hacker street cred. You've thought about learning C, but that just seems much too useful.
You're hoping to read The Art of Computer Programming, but you've decided to wait until the final edition is available.
So what's the next step? What's the next merit badge on your Geek Scout sash?
When you were a kid, did you learn to speak Klingon or Elvish? Would you like to repeat that experience, with all of its loneliness and nerd angst, but minus the fun?
What is INTERCAL?
Some say INTERCAL is a language. Others say INTERCAL is a joke. Perhaps INTERCAL is just a rumor, a hoax, an urban legend. An Arthurian legend, perhaps?
It's all of these. It's none of these. Does anyone know? Well, actually a lot of people know. It's all very well documented. But the documentation may be a lie in the end.
What Do We Know About INTERCAL?
First of all, we know that INTERCAL is not even the language's real name. The real name of the language is "Compiler Language with No Pronounceable Acronym." INTERCAL is, of course, a pronounceable acronym. Which means that it is not the true acronym.
We also know that INTERCAL was invented in 1972 at Princeton. The two inventors, Don Woods and James M Lyon, intended it originally as a parody. It was designed to work on punch cards, a bizarre and obsolete technology that originated with cloth weaving looms.
INTERCAL was designed different from all other existing computer programming languages.
The most effective way of making a computer programming language different from all other computer programming languages would be to create one that is actually easy to use, and easy to read, and accomplishes the things that you wanted to accomplish, and does not accomplish the things that you do not want it to accomplish.
However, the designers of INTERCAL went the other way.
INTERCAL is deliberately difficult. It is nearly impossible to read or write. Accomplishing the most trivial task is exceptionally time-consuming and headache inducing.
The syntax makes no sense. The vocabulary makes no sense. And weird compiler quirks make it virtually certain that a program written in INTERCAL will not behave as expected the first time it is run.
In other words, when it really comes down to it, INTERCAL is exactly like every other computer programming language — at least at that time. And that was more or less the point.
A Little History
The inventors of INTERCAL implemented it, had a few laughs, and quickly forgot about it.
However, the language manual lived on. The documentation itself was funnier than the language; this makes sense, since the documentation was written in English and the language was completely impenetrable.
Copies of the language manual passed from geek to geek, and uncountable numbers of scraggly beards were stroked along the way.
Eventually, the language found new life in the C-INTERCAL implementation, which still exists today.
There is also a second implementation, call CLC-INTERCAL. This means that at least two different computer programmers, and probably a lot more than that, have spent a nontrivial percentage of their finite lifetimes reading, understanding, and implementing the documentation for a language that doesn't make any sense, and can't actually do much.
What is even more amazing than that is the sheer level of brilliance and mathematical intelligence required to make heads or tails of any of this.
As mentioned previously, the INTERCAL language itself is nearly incomprehensible. Anything in INTERCAL that is actually useful is almost certainly a mistake, and any part of the documentation that is easy to understand is almost certainly a joke.
Here is a bit of sample code taken directly from the INTERCAL documentation:
PLEASE ,1 <- #2 DO .1 <- #2 DO ,1 SUB .1 <- #1 DO ,1 SUB #1 <- ,1 SUB #2 PLEASE ;1 <- #2 BY #2 DO ;1 SUB #1 #2 <- ,1 SUB ,1 SUB .1 DO READ OUT ;1SUB#1.1 DO GIVE UP
I could tell you what this code does, but it wouldn't really matter.
Perhaps the most famous error in INTERCAL has to do with the keyword PLEASE. An INTERCAL program must include the word PLEASE a sufficient number of times. However, it is unclear what that sufficient number is.
If a programmer does not say PLEASE often enough, the program will be rejected by the compiler for not being polite enough. However, if the programmer uses the word PLEASE too much, the program will be rejected for being too polite and too eager.
If this is the sort of behavior you want to see in a compiler, you are a sick, sick person.
Other incredibly useful errors include:
E111 COMMUNIST PLOT DETECTED, COMPILER IS SUICIDING
E277 YOU CAN ONLY DISTORT THE LAWS OF MATHEMATICS SO FAR
E405 PROGRAM REJECTED FOR MENTAL HEALTH REASONS
E666 COMPILER HAS INDIGESTION
E774 RANDOM COMPILER BUG.
That last error, the
Random Compiler Bug can actually be turned off by passing in a particular option when launching a program. This is a "reward for reading the manual." (Which is why I didn't tell you what the particular option was.)
THE INTERCAL PROGRAMMING LANGUAGE REFERENCE MANUAL — The original text from 1973.
The INTERCAL Programming Language Revised Reference Manual — The revised, modern text.
The INTERCAL Resources Page — Everything you might ever need to know about INTERCAL.
The Jargon File — The cultural history of my people.
INTERCAL — An album of house/dance music, by an artist of the same name, named after the language.
You don't want to move forward with INTERCAL. It's a parody language that was intended to highlight the problems with programming languages that existed in the late 1960s and early 1970s. But it remains as a good reminder of how not to design a programming language.