Obfuscated programming languages

Home / Computer Science

Links

An unlambda interpreter.

Obfuscated programming languages are those that were designed using strange paradigms, uncommon features or that simply were intended to bother the programmer.

I'm a programming language lover; I design and implement strange languages just for fun. And I can tell that both implementing and programming in one of those languages is an enlightening experience.

As far as I know, the first obfuscated language was Intercal, designed by Donald Woods and James Lyon in 1972. Interesting features are the need of a script to have certain level of politeness (you should ask 'PLEASE ...' or 'PLEASE DO ...'); it's logical operators, which work as nothing one has ever seen before; the possibility of "forgetting", "ignoring" and "abstaining from" a command, to express conditional execution (the language has no IF's or WHILE's); the feature of printing numbers in roman numerals and, in the recent C port by ESR, the mythic 'COME FROM' command. It's quite good a non-standard language, as a joke, and also challenging to program in; by no means is it the weirdest.

To me, - though this isn't a flame to other weird languages - the most interesting ones are Befunge and Unlambda, maybe because they are closer to serious experiments than to jokes. (I consider the HQ9+ language to be a good joke, which only prints "hello world" if the input is H, a quine or self-reproduction of the script if the input is Q, and the "99 bottles of bear" song if the input is 9; canonical things to be programmed).

Befunge is a language of the fungeoid family. These are stack-based languages that allow the program counter to move not only forward, but in different directions in a space (a delta vector is added to the position vector); where the space may be a cartesian one (unefunge is unidimensional; befunge, bidimensional and trefunge, tridimensional) or not (the creator suggests also hex-net topologies and Klein-bottles). It is quite easy to write an interpreter for a fungeoid. Programming in one of them really teaches how to program using stacks as the only resource.

Unlambda is an obfuscated functional language, based in the S and K combinators, core of the lambda calculus. In this case, writing an interpreter is a challenge that makes one face the most common problems while implementing functional languages: first class functions, closures, recursion in non tail-recursive languages, call/cc, evaluation delay, garbage collection. Programming in Unlambda is also enlightening, when you finally get how to.

Notice that a common feature of Unlambda and Befunge is the absence of variables. In my humble opinion, imperative language programmers are too tied to variables. These languages (and their serious counterparts: Forth and the Lisp family) show that there's no real need of them.

Top

Pablo Barenbaum
Tell me what you think of this site.