hn-classics/_stories/2002/12512136.md

23 KiB

Source

Cat's Eye Technologies: Esoteric Topics in Computer Programming

Wayback Machine

success

fail

| ----- | | |

| Feb | JUN | Oct |
| Previous capture | 09 | Next capture | | | | 2001 | 2002 | 2013 |

|
|

12 captures

18 Oct 2000 - 21 Aug 2013

| [

][11] |

[ About this capture][12]

COLLECTED BY

Organization: [Alexa Crawls][13]

Starting in 1996, [Alexa Internet][14] has been donating their crawl data to the Internet Archive. Flowing in every day, these data are added to the [Wayback Machine][15] after an embargo period.

Collection: [Alexa Crawl DL][16]

Crawl DL from Alexa Internet. This data is currently not publicly accessible.

TIMESTAMPS

![loading][17]

The URL of this page is [/esoteric/index.html][18]

| ----- | |  ![Cat's Eye Technologies][19]  | Esoteric Topics
in Computer Programming |

| ----- | |

<< [Esoteric Programming Languages Ring][20] >>

| | ![:-)][21][Mailing List][22] | ![:-)][21][Language Lab][23] | ![:-)][21][Essential Tools][24] | !WWW[25][Retrocomputing Museum][26] | !WWW[25][Random Languages List][27] | !WWW[25][Weird Programming Languages][28] | !WWW[25][The Turing Tarpit][29] |
| A hush falls over the world as we wait with baited breath to find out who won !WWW[25][The 2000 Esoteric Awards][30]! |

| ----- | |

Esoteric Program Forms

The Null Program

If a program is a series of instructions, then the null program is a series of zero instructions. The null program has some interesting properties, not the least of which being that it's simultaneously written in many languages and many paradigms...

Quines

A quine is a program which produces a listing of itself as it's output when run. Gary Thompson has a comprehensive !WWW[25][quine page][31]. David Madore has a !WWW[25][page on quines][32] which describes the underlying principles and explains how to write them. Ben Olmstead also has a !WWW[25][quines list][33]. The null program can be considered a quine in many languages, since it consists of nothing and represents a program which produces no output!

Polyglots

A polyglot is a source code file for a computer program written in multiple computer programming languages simultaneously.

Gary Thompson has a !WWW[25][polyglot page][34]. (Some of the polyglots he lists are also full-fledged quines!) The null program is a polyglot in many languages, though not a particularly interesting one.

Palindrome Programs

Palindrome programs are exactly the same idea as palindrome sentences: they read the same forwards as backwards (disregarding whitespace and punctuation.)

!NEW[35] Bojan Nemec has donated a [palindrome quine in Befunge][36] which is a start. I'd like to see one where the entire code is executed, or one done in [Brainf*ck][37], as well.

Esoteric Programming Practices

Self-Modification

A self-modifying program is a series of instructions which contains one or more instructions to change, at some point during the execution of the program, one or more of the instructions in the series.

There are few if any general rules that apply when code modifies itself. A particularly difficult situation arises when one goes to compile self-modifying code, that is, translate it into another language with a different or non-existent notion of self-modification; the compiler must either produce programs which include a copy of the compiler itself, or the compiler must use sophisticated self-modifying code-and-data flow analysis techniques to try to determine the actual range of semantics of the given program, with self-modifications. Either way, interpreting self-modifying code is generally simpler.

But the bottom line about self-modification is that it's just plain weird. Once you let a program reason about and alter it's own instructions, you've crossed a line where the further execution of the program becomes extremely difficult to predict.

!WWW[25][Malbolge][38] requires use of self-modification to achieve Turing-Completeness. [SMITH][39] has an instruction pointer which cannot do anything except advance (no jumps!) and thus also relies on self-modification to simulate a loop. At the extreme, all [SMETANA][40] can do is modify itself, and is probably not Turing-Complete.

Polycoding

Polycoding is the act of non-trivially compiling or executing a single instance of code in multiple contexts. Generally this is accomplished by programming in multiple dimensions and/or directions and/or topologies or using creative GOTOs, such as with a line number variable (a computed jump) like some BASICs allow.

Optimized tail recursion is an example of a simple polycoding technique; instead of using a subroutine call as the last instruction in a subroutine, use a plain jump to the desired subroutine instead. As with most polycoding techniques, it saves a tiny bit of space and/or time at the cost of making the program harder to maintain.

[Befunge-93][41] (and to a lesser extent, [Wierd][42]) programmers trying to squeeze programs into small spaces, in the quests for such things as the smallest random number generators, bred the development of polycoding idioms in that language, just to get a bit more mileage out of fewer instructions.

The Boo-yah language (an implementation for which is in the works) forces the programmer to write polycode.

!WWW[25][Bullfrog][43] has no conditionals whatsoever; all control flow must be done with computed jumps.

Masochistic Programming

It would seem some programmers are simply masochists.

[Brainf*ck][37] is a good introductory language for those looking to get into the world of cruel and unusual programming.

Trying to write a program with a nested loop and subroutines in [SMITH][44] ought to keep your mind occupied for a while.

The programming language !WWW[25][Malbolge][38] was named after a level of Dante's Inferno; that should give you a clue as to how easy it is to program.

!WWW[25][reMorse][45] should be mentioned here as well; the author repeatedly forewarns that he is not responsible for any loss of sanity caused by reMorse, and for good reason.

If you like relying on references to yourself, you'll enjoy !WWW[25][BAK][46].

And who can ignore !WWW[25][INTERCAL][47], which was created in 1972 for the purpose of being as unlike any other language as possible; it's name is an acronym for "Compiler Language With No Pronounceable Acronym."

Size Matters, and Less is More

[Brainf*ck][37] was designed to be a language for which an ultra-tiny compiler could be written.

So was !WWW[25][False][48], which has nice quasi-functional touches - lambda abstraction and a stack. (False is just one of Wouter van Oortmerssen's many languages, and is named after his favourite Boolean value.)

[Shelta][49] is in many ways a minimal version of FALSE. One implementation of Shelta is written in assembly; another is written in Shelta! Shelta is one of the smallest languages to ever be bootstrapped.

Just Plain Weird

Fed up with stacks, the !WWW[25][Q-BAL][50] language (an implementation for which is coming soon) uses queues for everything. !NEW[35] !WWW[25][Oroogu][51] is a descendant of Q-BAL.

!WWW[25][Unlambda][52] demonstrates that the lambda calculus can be a dangerous tool in the wrong hands.

!WWW[25][Java2K][53] seems to be the product of an extremely disturbed mind - don't show this one to psychiatrists.

And why stop with Earthly languages? !WWW[25][var'aq][54] gives Klingons far and wide the opportunity to do applications programming in their native tongue.

Finally, [ILLGOL][55] is pure joke, sort of a parody of commercial, proprietary development languages. It has no specification, but fairly interesting release notes; the compiler is only available for DOS platforms and is most definitely not open-source.

Esoteric Brain Banks

Where the academics fear to tread, business - to fulfill the demands of the hobbyists - takes up the slack. A lowly sole proprietorship in Canada, [Cat's Eye Technologies][56], hosts this page.

!WWW[25][Assurdo Technologies][57] provides some incredibly (and happily) sick products to the world including dd/sh and an INTERCAL compiler for quantum computers.

!WWW[25][Purists.org][58] supports the !WWW[25][Oroogu][51] language. |

Esoteric Programming Languages

There are a wide variety of programming languages in the world today that require one to use decidedly different paradigms than one might typically use in day-to-day computer programming. They present the programmer with the challenge, intrigue, and entertainment of looking at known algorithms and concepts in a whole new light.

Non-Imperative Languages

Programmers who work exclusively with imperative languages - that is, those languages with an explicit assignment statement - (e.g., C, C++, Perl, Pascal, Java, BASIC, COBOL, etc ad nauseum) typically have more difficulty handling languages where the flow of control is not as directly related to a "currently executing position" in the program source.

So much can be said on the topic of different paradigms, in fact, that I've decided to devote an [entire separate page][59] to them.

Metalanguages

A metalanguage is a language that describes another language. Besides the old chestnuts such as Wirth's EBNF and the countless attributed applications of it for compiler-compilers, here are some fairly freakish variations on the theme:

[MDPN][60] is a metalanguage for describing the process of parsing a multidimensional pattern, and could prove useful for describing languages such as [Plankalkül][61] and [Befunge][62].

[ALPACA][63] is a language for programming arbitrary cellular automata, a metalanguage which can succinctly describe any CA, even complex ones.

SQUISHY, which is now probably lost to the mists of time, was an application of a language-theory construct known as a semi-Thue grammar. The SQUISHY compiler treats each input file as the definition of a compiler. The grammar for such a compiler has embedded semantics such that it can compute by continuously rewriting strings, so it would be quite possible to write a compiler that sings "99 Bottles" by taking any string as input and writing the lyrics to the song as output.

SQUISHY has been superseded by a language called Thue, which differs only in small ways (nondeterministic instead of deterministic; BNF-like instead of EBNF-like; directly based on a semi-Thue grammar; and a proper tarpit to wit,) and for which an implementation is being developed.

Automata as Languages

Some cellular automata, such as [John Conway's Life][64], can (in theory) solve any solvable mathematical problem (such as computing pi to a hundred decimal places) and, as such, can be considered Turing-Complete.

[RUBE][65] is not quite a true cellular automaton, but [REDGREEN][66], the update of RUBE, is. REDGREEN is written in [ALPACA][63].

[noit o' mnain worb][67] can be looked at a tarpit version of the kind of automaton RUBE 'should have been', for clarity: not a cellular automaton, but a particle automaton, in which states do not simply propagate, but particles actually move and collide.

Extreme Tarpits

In the world of computing and informatics, a tar pit (sometimes merged into one word, tarpit), more fully Turing tar pit, is a Turing-complete machine with an arbitrarily low number of discrete instructions. (There are other definitions, but the author of this page prefers this one.)

OISC and URISC, which can be found at the !WWW[25][RCM][26], have only one instruction each. [SMETANA][68] has two instructions but has not been proven Turing-Complete and in all likelihood isn't. !WWW[25][reMorse][45] was originally designed with only two instructions, represented as Morse code. !WWW[25][FORTH][69] can be built up from 3 basic instructions. [Shelta][70] has "no" instructions (it relies on in-line assembly.) [Wierd][71] has a handful of basic instructions determined by angles in chains of only two kinds of specifier characters, 'space' and 'not space'. !WWW[25][Malbolge][38] has 7 instructions. [Brainf*ck][37] has 8 parameterless instructions but is one of the most popular tarpits, having a very beautifully symmetrical grammar for which a very tiny compiler can be built. !WWW[25][Fromage][46] is a ten-instruction tarpit with the bit as the basic data type.

Non-Imperative Tarpits

Who says a tarpit has to be modeled after Turing's machine, anyway? [Sally][72] is nearly a tarpit and under every reasonable definition it is not an imperative language, but a functional one.

Thue is also pretty much a tarpit, having only the barest semantics, and a rather boneheadedly simple syntax. But it can only be classified as a constraint-based language.

[noit o' mnain worb][67] could be classified as a constraint-based language, or maybe a concurrent fungeoid, or a particle automaton. Call it what you will, it has an arbitrarily low number of discrete components which function in combination to simulate a (nearly) Turing-Complete system.

OOPS and beta-Juliet break the object-oriented model down to it's barest form - passing messages - and offer few other semantics. Are these not object-oriented tarpits?

Fungeoids

One approach that's been taken in the design of a virtual machine is to address the storage space non-linearly. [Befunge-93][41] and !WWW[25][Orthogonal][73] all use as their basis Cartesian grids, structured as a finite torus, unlimited Lahey-space, and an unlimited plane, respectively. [Wierd][71] and [worb][67] and Boo-yah also fall into this category, generally speaking, although they each have subtly different ways of handling instructions. !WWW[25][Blank][74] is the original one-dimensional bidirectional fungeoid, where program flow can go either way around a ring of instructions.

Non-Digital Computers

Computer can be built using operational amplifiers instead of logic gates. These machines, called analogue computers (or analog computers if you're in the United States,) take input, perform computations, and produce output, but all in terms of amplitudes of electrical signals, rather than combinations of quantized "on or off" amplitudes, looked at as Boolean values or binary digits.

Non-Electronic Computers

Even though electricity is an easy-to-manage resource on which to base computing machinery, it is far from the only one.

Entirely mechanical computers can be built - abacuses and cash registers are two simple examples. More involved examples include the "Tinkertoy" computers (which could play Tic-Tac-Toe at an expert level) and "ropes and pulleys" and "billiard balls" logic gates.

This is because that Turing-Complete in the real world relies on the following law of physics: two particles cannot share the same space at the same time and will resist doing so.

So, analogous to their electronic cousins, it should be entirely possible (if not exactly economically feasible) to create hydraulic and pneumatic computers based on the same principles of pressure and flow (one-way valves). [worb][67] is an example of a generalized computing environment which is neither electronic nor hydraulic nor pneumatic, but works in an analogous way.

Specs on Spec

While many languages are designed by sheer dint of building a compiler for them, others are so conceptually bizarre that the specification comes first, and the implementation may or may not follow eventually...

[*W][75] has no purpose besides annoying the user.

[Sartre][76] (one of the [Lesser Known Programming Languages][77]) simply has no purpose.

[Tamerlane][78] attempts to resist all efforts to classify it.

The spec for [TURKEY BOMB][79] is probably best left unviewed by mortal eyes.

!WWW[25][Magenta][80] is in many ways a cursed language, wholly vague and full of committee-thinking. |

|

Last Updated Jan 27 ![(c)][81]2001 [Cat's Eye Technologies][56].

[11]: [12]: http://web.archive.org#expand [13]: https://archive.org/details/alexacrawls [14]: http://www.alexa.com/ [15]: http://web.archive.org/ [16]: https://archive.org/details/alexa_dl [17]: http://web.archive.org/static/images/loading.gif [18]: http://web.archive.org/web/20020609152409/http://www.catseye.mb.ca/esoteric/index.html [19]: http://web.archive.org/web/20020609152409im_/http%3A/www.catseye.mb.ca/img/3qtrsize.gif [20]: http://web.archive.org/web/20020609152409/http://www.ringsurf.com/netring?ring=esolang;action=home [21]: http://web.archive.org/web/20020609152409im_/http%3A/www.catseye.mb.ca/img/happyicon.gif [22]: http://web.archive.org/web/20020609152409/http://www.catseye.mb.ca/list.html [23]: http://web.archive.org/web/20020609152409/http://www.catseye.mb.ca/lala/index.html [24]: http://web.archive.org/web/20020609152409/http://www.catseye.mb.ca/tools.html [25]: http://web.archive.org/web/20020609152409im_/http%3A/www.catseye.mb.ca/img/webicon.gif [26]: http://web.archive.org/web/20020609152409/http://www.tuxedo.org/~esr/retro/ [27]: http://web.archive.org/web/20020609152409/http://www.mines.edu/students/b/bolmstea/randlang/index.html [28]: http://web.archive.org/web/20020609152409/http://pages.prodigy.net/rkusnery/weird.html [29]: http://web.archive.org/web/20020609152409/http://www.geocities.com/ResearchTriangle/Station/2266/tarpit/tarpit.html [30]: http://web.archive.org/web/20020609152409/http://www.mines.edu/students/b/bolmstea/essies/index.html [31]: http://web.archive.org/web/20020609152409/http://www.nyx.net/~gthompso/quine.htm [32]: http://web.archive.org/web/20020609152409/http://www.eleves.ens.fr:8080/home/madore/computers/quine.html [33]: http://web.archive.org/web/20020609152409/http://www.mines.edu/students/b/bolmstea/quines/index.html [34]: http://web.archive.org/web/20020609152409/http://www.nyx.net/~gthompso/poly/polyglot.htm [35]: http://web.archive.org/web/20020609152409im_/http%3A/www.catseye.mb.ca/img/new.gif [36]: http://web.archive.org/web/20020609152409/http://www.catseye.mb.ca/esoteric/befunge/src/palinqn.bf [37]: http://web.archive.org/web/20020609152409/http://www.catseye.mb.ca/esoteric/bf/index.html [38]: http://web.archive.org/web/20020609152409/http://www.mines.edu/students/b/bolmstea/malbolge/index.html [39]: http://web.archive.org/web/20020609152409/http://www.catseye.mb.ca/esoteric/smith/index.html [40]: http://web.archive.org/web/20020609152409/http://www.catseye.mb.ca/esoteric/smetana/ [41]: http://web.archive.org/web/20020609152409/http://www.catseye.mb.ca/esoteric/befunge/ [42]: http://web.archive.org/web/20020609152409/http://www.catseye.mb.ca/esoteric/wierd/ [43]: http://web.archive.org/web/20020609152409/http://pages.prodigy.net/rkusnery/bullfrog.html [44]: http://web.archive.org/web/20020609152409/http://www.catseye.mb.ca/esoteric/smith [45]: http://web.archive.org/web/20020609152409/http://pages.prodigy.net/rkusnery/remorse.html [46]: http://web.archive.org/web/20020609152409/http://www2.thecia.net/users/prfnoff/obslang/obslang.html [47]: http://web.archive.org/web/20020609152409/http://www.ccil.org/intercal/ [48]: http://web.archive.org/web/20020609152409/http://www.staff.ecs.soton.ac.uk/~wvo96r/false/ [49]: http://web.archive.org/web/20020609152409/http://www.catseye.mb.ca/esoteric/shelta/index.html [50]: http://web.archive.org/web/20020609152409/http://homepage.eircom.net/~kmgaughan/esolang/q-bal/index.html [51]: http://web.archive.org/web/20020609152409/http://www.purists.org/oroogu/ [52]: http://web.archive.org/web/20020609152409/http://www.eleves.ens.fr:8080/home/madore/programs/unlambda/ [53]: http://web.archive.org/web/20020609152409/http://www.netsurprise.de/chip/java2k/ [54]: http://web.archive.org/web/20020609152409/http://www.geocities.com/connorbd/varaq/ [55]: http://web.archive.org/web/20020609152409/http://www.catseye.mb.ca/esoteric/illgol/ [56]: http://web.archive.org/web/20020609152409/http://www.catseye.mb.ca/index.html [57]: http://web.archive.org/web/20020609152409/http://www.assurdo.com/ [58]: http://web.archive.org/web/20020609152409/http://www.purists.org/ [59]: http://web.archive.org/web/20020609152409/http://www.catseye.mb.ca/lala/paradigm/index.html [60]: http://web.archive.org/web/20020609152409/http://www.catseye.mb.ca/esoteric/mdpn/index.html [61]: http://web.archive.org/web/20020609152409/http://www.catseye.mb.ca/vintage/plankalkuel/index.html [62]: http://web.archive.org/web/20020609152409/http://www.catseye.mb.ca/esoteric/befunge/index.html [63]: http://web.archive.org/web/20020609152409/http://www.catseye.mb.ca/esoteric/alpaca/index.html [64]: http://web.archive.org/web/20020609152409/http://www.catseye.mb.ca/esoteric/alpaca/life/ [65]: http://web.archive.org/web/20020609152409/http://www.catseye.mb.ca/esoteric/rube/index.html [66]: http://web.archive.org/web/20020609152409/http://www.catseye.mb.ca/esoteric/alpaca/redgreen/index.html [67]: http://web.archive.org/web/20020609152409/http://www.catseye.mb.ca/esoteric/worb/index.html [68]: http://web.archive.org/web/20020609152409/http://www.catseye.mb.ca/esoteric/smetana/index.html [69]: http://web.archive.org/web/20020609152409/http://www.eskimo.com/~pygmy/forth.html [70]: http://web.archive.org/web/20020609152409/http://www.catseye.mb.ca/esoteric/shelta/ [71]: http://web.archive.org/web/20020609152409/http://www.catseye.mb.ca/esoteric/wierd/index.html [72]: http://web.archive.org/web/20020609152409/http://www.catseye.mb.ca/esoteric/sally/ [73]: http://web.archive.org/web/20020609152409/http://www.muppetlabs.com/~breadbox/orth/home.html [74]: http://web.archive.org/web/20020609152409/http://friko2.onet.pl/gd/unefunge/ [75]: http://web.archive.org/web/20020609152409/http://www.catseye.mb.ca/esoteric/starw/index.html [76]: http://web.archive.org/web/20020609152409/http://www.catseye.mb.ca/esoteric/sartre/index.html [77]: http://web.archive.org/web/20020609152409/http://www.catseye.mb.ca/vintage/lesserknown/ [78]: http://web.archive.org/web/20020609152409/http://www.catseye.mb.ca/esoteric/tamerlane/index.html [79]: http://web.archive.org/web/20020609152409/http://www.catseye.mb.ca/esoteric/turkeyb/index.html [80]: http://web.archive.org/web/20020609152409/http://www.geocities.com/ResearchTriangle/Station/2266/tarpit/magenta.html [81]: http://web.archive.org/web/20020609152409im_/http%3A/www.catseye.mb.ca/img/copyright.gif