History of Computers - INTERCAL

From SJS Wiki
Jump to: navigation, search

--Ikamat (talk) 14:32, 18 September 2016 (CDT)

Intro

The Compiler Language With No Pronounceable Language, abbreviated INTERCAL, is an esoteric programming language created at Princeton.[1] It is designed to be as different from mainstream programming languages as possible; as a result, it is notoriously difficult to write anything useful in the language. Due to this reputation, INTERCAL has found limited use in terms of mainstream programming, but its influence has been profound.

Overview

First published as a manual in 1972, INTERCAL directly serves to satirize various programming paradigms common in more popular languages. The language was originally defined by two Princeton students, Don Woods and Jim Lyon. Their specification, known as INTERCAL-72, defines a large amount of the language's operators and mechanisms.[2] This specification was expanded with the release of C-INTERCAL by Eric Raymond. C-INTERCAL is a Unix-hosted INTERCAL compiler, and while it carries over most of the features from the original INTERCAL specification, some features are dropped for the sake of compatibility while others are added to replace said features. One example of this can be seen in the language's choice of operators. Whereas the original INTERCAL-72 spec defined an EBCDIC character set using the ¢ and ⊻ for interleave and exclusive-or, respectively, the newer C-INTERCAL manual swaps EBCDIC for the more universal ASCII character set. In doing so, ¢ and ⊻ are replaced with $ and ?. These changes are documented in the manual as "representing the increasing cost of software in relation to hardware" and "the average person's reaction on first encountering exclusive-or."[3] However, a large amount of seemingly purposeless features remain in place, such as error code E774. This code signifies a "random compiler bug" and there is a ~1/10 chance of encountering the error after compilation and during runtime. While workarounds for the error exist (such as using the -b compilation option), there is no official solution.[4] HJr2VwA.jpg
Jim Lyon[5]
INTERCAL is a difficult language to use in any circumstance. This is part of the language's goals; as the manual states:

INTERCAL's main advantage over other programming languages is its strict simplicity. It has few capabilities, and thus there are few restrictions to be kept in mind. Since it is an exceedingly easy language to learn, one might expect it would be a good language for initiating novice programmers. Perhaps surprising, then, is the fact that it would be more likely to initiate a novice into a search for another line of work.

[6]

The language's roundabout ways of doing things is apparent after comparison with another, more common programming language. For example, here is a classic Hello World program written in C:

   #include <stdio.h>
   
   int main() {
       puts("Hello, world!");
       return 0;
   }
302px-Don_Woods.jpg
Don Woods[7]

And here is a comparable program written in INTERCAL:

   PLEASE DO,1 <- #14
   PLEASE DO,1SUB#1 <- #238
   DO,1SUB#2 <- #108
   DO,1SUB#3 <- #112
   DO,1SUB#4 <- #0
   DO,1SUB#5 <- #64
   DO,1SUB#6 <- #194
   DO,1SUB#7 <- #48
   DO,1SUB#8 <- #22
   DO,1SUB#9 <- #248
   DO,1SUB#10 <- #168
   DO,1SUB#11 <- #24
   DO,1SUB#12 <- #16
   DO,1SUB#13 <- #162
   DO,1SUB#14 <- #52
   PLEASE READ OUT ,1
   PLEASE GIVE UP

After being compiled (and assuming that the compiler does not experience E774), both programs produce the same output:

   Hello, world!
but the INTERCAL program is nearly incomprehensible.[8] Other hindrances to using the language seriously come in the form of user input; while most languages accept numerical input as decimal numbers (2, 19, 1337, etc), INTERCAL accepts numerical input as words representing these numbers (TWO, ONE NINER, ONE THREE THREE SEVEN). Numerical output, of course, is in Roman numerals (II, XIX, MCCCXXXVII).[9] Additional inconveniences are imposed by the compiler. If the PLEASE statement appears to infrequently in a program, the compiler will complain that the PROGRAMMER IS INSUFFICIENTLY POLITE; however, if the PLEASE statement is used too often, the compiler will report that the PROGRAMMER IS OVERLY POLITE. In all instances, the user will be asked to CORRECT SOURCE AND RESUBNIT (the misspelling of resubmit has been carried over from INTERCAL-72).[10] Despite these barriers, INTERCAL remarkably maintains Turing-completeness. This means that, given enough resources, any computer algorithm can be written in the language.[11] SAVE0007.jpg
Illustration of INTERCAL's complex I/O system[12]

Significance

Because it is technically possible to use INTERCAL, the language is called an esoteric programming language. In fact, INTERCAL is the first documented esoteric language, or esolang, in computing history. Excited by the new challenge of making software into usable art, many programmers mimicked INTERCAL and set forth to create their own esolang. Notable examples of esolangs are Befunge, where all program execution is mapped to a toroid; brainf*ck, in which there are only 8 operators ([, ], +, -, >, <, ., and ,); and Whitespace, a heap-based programming language in which all instructions are encoded in varying amounts of empty space (tabs, spaces, newlines, etc).[13] [14] [15] All of these languages stem from INTERCAL. Even though the Compiler Language With No Pronounceable Acronym was never excessively popular, INTERCAL's influence lives on, and its creation marks an important point in computing history.

References

  1. http://www.muppetlabs.com/~breadbox/intercal-man/s01.html#2
  2. http://www.muppetlabs.com/~breadbox/intercal-man/
  3. http://catb.org/esr/intercal/ick.htm#Princeton-and-Atari-Syntax
  4. http://catb.org/esr/intercal/ick.htm
  5. [1]
  6. https://3e8.org/pub/intercal.pdf
  7. [2]
  8. [3]
  9. http://catb.org/esr/intercal/ick.htm#READ-OUT-and-WRITE-IN
  10. http://catb.org/esr/intercal/ick.htm#Errors
  11. http://c2.com/cgi/wiki?TuringComplete
  12. [4]
  13. http://catseye.tc/node/Befunge-93.html
  14. http://www.muppetlabs.com/~breadbox/bf/
  15. http://compsoc.dur.ac.uk/whitespace/tutorial.html

Links