Mike's Mathom Collection - Esoteric Languages

 

Esoteric Languages

Although I am not a programmer in any legitimate sense, I've used a number of languages in my work over the years; C, FORTRAN, and now python, usually on a daily basis for data processing. Two presented significant challenges to my gray matter: FORTH and Motorola DSP 96002 assembly language. The DSP was especially fun; one could, for example, add two numbers while simultaneously moving two other numbers to two different addresses. The problem was that the moved numbers could not be read by the next instruction; you had to wait for the second instruction after the move. This led to a lot of mental gymnastics trying to keep track of what data was available when.

That did lead me to occasionally messing around with different programming languages just to see what they are like. One of my favorites is an “esoteric language” with the unfortunate name of “brain****” (which I will call “BF”). I say “unfortunate” because I can't enthuse about it in polite company. But it a wonderful language if you like mind-bending mathematical challenges. There are eight basic commands (1 character each) and a memory pointer to a block of memory. In principal, you can compute anything that can be computed with this language, but it might take near-infinite amounts of memory and the age of the Universe to execute the program.

As an example, here is a routine I came up with to do exponentiation; the number in the second memory cell is raised to the power of the number in the first memory cell and the result is left in the 3rd memory cell; in this case it computes 3 to the 4th power:

++++>+++[>+>+<<-]>>[<<+>>-]<<<-[>>[>>+<<-]>>[<<<[>+>+<<-]>>[<<+>>-]>-]<<<<-]

I'm sure there are better versions out there, but it's my own work :-)

The Wikipedia definition of the language gives the basic rules of engagement. The esolangs site give some more specific information. The BF archive has lots of compilers and examples. (I think one of the first programs many CS students write is a BF interpreter/compiler.) There is even a subreddit for it.

There are many online BF interpreters. My favorite one is by Terry Raymond, whose link is unfortunately no longer active. I have stolen his code and modified it to suit my tastes; it is available here.



Creative Commons License Graphics files (JPEG or PNG), unless otherwise credited. If you would like to use something, just ask!
Creative Commons License All other files (.html, .pdf, etc.)
Last update: 2020-04-27