X hits on this document

PDF document

1. INTRODUCTION - page 6 / 10

29 views

0 shares

0 downloads

0 comments

6 / 10

through composition of non-standard and counterintuitive constructs. In this sense INTERCAL also has puzzle aspects.

However, despite the claim that this language has “nothing at all in common with any other major language”, INTERCAL clearly spoofs the features of contemporaneous languages, combining multiple language styles together to create an ungainly, unaesthetic style. From COBOL, INTERCAL borrows a verbose, English-like style, including optional syntax that increases the verbosity; all statements can be prepended with PLEASE. Sample INTERCAL statements in this COBOL style include FORGET, REMEMBER, ABSTAIN and REINSTATE. From FORTRAN, INTERCAL borrows the use of optional line numbers, which can appear in any order, to mark lines, and the DO construct, which in FORTRAN is used to initiate loops. In INTERCAL, however, every statement must begin with DO. Like APL, INTERCAL makes heavy use of single characters with special meaning, requiring even simple programs to be liberally sprinkled with non alphanumeric characters. In a sense, INTERCAL exaggerates the worst features of many languages and combines them together into a single language.

The compiler, appropriately called “ick,” continues the parody. Anything the compiler can’t understand, which in a normal language would result in a compilation error, is just skipped. This “forgiving” feature makes finding bugs very difficult; it also introduces a unique system for adding program comments. The programmer merely inserts non-compileable text anywhere in the program, being careful not to accidentally embed a bit of valid code in the middle of their comment.

The language manual hammers home the parody. After explaining that INTERCAL stands for “Compiler Language with No Pronounceable Acronym,” the manual proceeds with a series of in jokes on language design. At one point the reader is presented with a logic diagram that claims to provide a simpler way of understanding the SELECT operation (SELECT being one of INTERCAL’s two non-intuitive math operators): “The gates used are Warmenhovian logic gates, which means the outputs have four possible values: low, high, undefined …, and oscillating …” The reader is presented with a maze-like logic diagram in which lines needlessly zig-zag, sometimes dead-end, and all eventually connect at the system bus, the BUS LINE; of the many lines heading off diagram from the BUS LINE, all go “TO NEW YORK” except for the one “TO PHILIDELPHIA.” All non-alphanumeric characters are given special names: tail (,), hybrid (;), mesh (#), worm (-) and so forth.

Thirty-three years later, INTERCAL still has a devoted following. Eric Raymond, the current maintainer of INTERCAL, revived the language in 1990 with his implementation C- INTERCAL, which added the COME FROM construct to the language — the inverse of the much-reviled GO TO.

8. MINIMALISM: BRAINFUCK

Languages that parody comment on other programming languages; languages in the minimalist vein, on the other hand, comment on the space of computation. Specifically, they call attention to the very small amount of structure needed to create a universal computational system. (A “system” in this sense can be as varied as a programming language, a formal mathematical system, or a physical processes, such as a machine.) A universal system can perform any computation that it is theoretically possible to perform; such a system can do anything that any other formal system is capable of doing, including emulating

any other system. This property is what allows one to implement one language, such as Perl, in another language , such as C, or to implement an interpreter or compiler for a language directly in hardware (using logic gates), or to write a program that runs on some specific hardware to provide a platform for yet other programs (as the Java Virtual Machine does). Universality in a programming language is obviously a desired trait, since it means that the language places no limits on the processes that can be specified in the language. There are less powerful ways to compute, some of which are used often — for instance, regular expressions, of the sort found in the Find and Replace dialog of word processors, are powerful enough to tell whether a string has an even number of characters in it, but cannot determine whether the length of a string is a prime number, as a universal computer can.

Universal computation was discovered by Alan Turing and described in his 1937 investigation of the limits of computability, “On Computable Numbers.” While his paper proved the counter-intuitive result that there exist formally specified problems for which there exists no computational process (that is, no program) for finding a solution, the important result for this paper was his definition of a notional machine, the Turing Machine, to specify what he meant by computation.

A Turing Machine consists of 1) an infinite tape, divided into cells (memory locations), along which a read/write head moves reading and writing symbols to and from the tape, and 2) a single state register that can store a symbol indicating the machine’s current state. A Turing Machine is governed by a rule table which specifies, for each possible combination of state symbol and symbol read from the tape, what symbol the head will write to the tape, whether the head will move left or right, and what new symbol is stored in the state register. While it is easy to imagine that one could define a TM to compute a specific function, Turing proved that there exist TMs that can simulate the activity of any arbitrary TM; these are universal Turing Machines. The structure necessary to achieve universality is surprisingly small; for example, a universal TM can be defined using only 2 state symbols and 18 tape symbols (2x18).

Minimalist languages strive to achieve universality while providing the smallest number of language constructs possible. Such languages also often strive for syntactic minimalism, making the textual representation of programs minimal as well. Minimal languages are sometimes called Turing Tarpits, after epigram 54 in Alan Perlis’ Epigrams of Programming: “54. Beware the Turing tar-pit in which everything is possible but nothing of interest is easy.” [11].

Brainfuck is an archetypically minimalist language, providing merely seven commands, each represented by a single character. These commands operate on an array of 30,000 byte cells initialized to 0. The commands are:

  • >

    Increment the pointer (point to the memory cell to the right)

< Decrement the pointer (point to the memory cell to the left)

  • +

    Increment the byte pointed to

    • -

      Decrement the byte pointed to

. Output the byte pointed to , Accept a byte of input and write it into the byte pointed to [ Jump forward to the corresponding ] if pointing to 0

Document info
Document views29
Page views29
Page last viewedSun Dec 04 12:30:57 UTC 2016
Pages10
Paragraphs273
Words9932

Comments