The Funge family of programming languages consists of a group of n-dimensional, stack-based programming languages. The most prominent and original member of the family, Befunge (a two-dimensional language), was invented in 1993 by Chris Pressey. Befunge, like its n-dimensional1 siblings, is Turing-complete, yet was designed to be ‘a nightmare to compile’soup. It can safely be said that Funges are ‘unusual’ languages. For an example, the following is the archetypal ‘Hello World’ programme in Unefunge (one-dimensional Funge):
This programme already demonstrates quite a few of the features of a Funge (the syntax used here is the common denominator, Befunge '93): the existence of a stack; changing the direction of the PC; ‘0gnirts’-type strings et cetera. In the discussions to follow, it is assumed that the reader already knows at least Befunge '93. Otherwise, apart from boredom, insanity of click-happiness, the reader has little reason to be reading this page.
Compiling Funges is problematic because of their self-modifying
tendencies and multi-directional PC. Befunge compilers are not
impossible to write, but they
Following the example of the (in)famous Lisp machines, would it not be possible to accelerate and facilitate the creation of a Funge system using dedicated hardware? Not only is this possible, it also an idea perverted enough to ﬁt in with Funge itself.
This paper describes Fungus, an architecture designed and optimised for the execution of Funge software. It is hoped that this will give rise to further nightmares, quite likely involving Cthulhu in a bikini teaching INTERCAL to ﬁrst-year law students.
Fungus is a microcoded, 16-bit, two-dimensional extreme RISC machine extremely suited to the interpretation of Funge at the hardware level. The author visualises the implementation of Funge compilers to generate Fungus-native code. The reader to whom the concept of Cthulhu in a bikini sounds acceptable may additionally visualise optimising Funge compilers for Fungus2.
The entire concept is theoretical, but a working emulator of Fungus can be built. Funge machines (like Lisp machines before them) can be utilised in the exploration of hack value, and as a means of punishing cocky undergraduates who think programming is an activity best done using a mouse. It is this author's belief that emerging programmers should be made painfully aware of the nightmares lurking in these Black Arts. The thorny path of Fear eventually leads to the green meadows of Knowledge. Or madness.
- 1. where n ∈ ℕ, n ≥ 1 — the existence of fractal and zero-dimensional Funges is left as an exercise to the suicidal reader. The author purposefully avoids contemplating the existence of negative-dimension Funges in a last and possibly futile bid to retain sanity.
- 2. The ambitious but clearly deranged programmer should, at this author's humble suggestion, try to visualise a lecture theatre full of future lawyers as a gentle deterrent. If this fails to work, please visualise Chtulhu in a bikini lecturing said lawyers.