Gourmet ProgrammingPosted by Mariia Mykhailova on July 31, 2011
Esoteric programming languages are fascinating; thanks in no small part to the fact that for every occasion there is a language. Literally. A language for animal lovers and painters, for hackers and puzzle lovers, for jargonauts and poets... Here are several languages for gourmets - people who don't live by bread alone.
Chef is one of the most known esoteric programming languages. It always tops the lists of weirdest languages (usually with the same program Hello World Souffle). Programs in Chef look like recipes, and the programmer has to follow one simple rule: any program should not only run with the desired result but also be easy to prepare and result in a delicious dish.
Of course, in actual practice nobody follows the second condition - the interpreters don't check it, and the best the programmers can do is maintain the general likelihood by not using anything evidently inedible. Initial values of variables are set as quantities of corresponding ingredients, but one can use different measurement units - grams, pinches, milliliters, cups, teaspoons and tablespoons and simply units, so the quantities can be made credible by a long stretch of the imagination. But the recipe itself...
Chef is a stack-oriented programming language, and has stacks of two kinds - mixing bowls for doing the actual calculations and baking dishes for printing the results. Most of commands look like adding ingredients to the bowls (the verb used defines the action performed), liquefying and mixing them. In the end bowls contents is poured in the baking dishes. Theoretically the result can turn out quite good, but personally I wouldn't take the risk of tasting my programs :-)
Prior to cooking something fancy one has to stock up on kitchen-stuff - at least that's the logic behind the next language. A program written in Grocery List is, well, a grocery list. The specific items in the list are not too important - the commands to perform are encoded in the first letters of the names and sometimes in line lengths. Writing a program which is disguised as a real list is about as hard as a real recipe in Chef - in my version of Hello, World! the most frequent first letters are `v` (push ASCII-code of the next list item) and `p` (print the top element of the stack) - and how many food names you know that start from these letters?
The development of an esoteric language often stops before the interpreter is created - some of them are invented as a mind exercise, others aim to be as hard to implement as possible, and yet others, like Grocery List, bore the author too fast. But sometimes the language gets so little attention from the author that it gets no decent specification - a lot of them enter the eternity as a draft "it would be fun if Hello, World! was written like this". Actually, Hello, World! is all we know about a language called Sammich:
bread mayo Hello, sauce World! sauce bread
We can guess that bread with mayo is BEGIN, plain bread - END, the sauce works as PRINT, but hardly anything else. Well, except for maybe that the author likes some elaborate sandwiches :-)
There also exist a couple more food-based languages, but they are less interesting to my taste - and less developed as well.