Chef (programming language)
Encyclopedia
Chef is an esoteric
Esoteric programming language
An esoteric programming language is a programming language designed as a test of the boundaries of computer programming language design, as a proof of concept, or as a joke...

 (or joke) programming language
Programming language
A programming language is an artificial language designed to communicate instructions to a machine, particularly a computer. Programming languages can be used to create programs that control the behavior of a machine and/or to express algorithms precisely....

 designed by David Morgan-Mar
David Morgan-Mar
David Morgan-Mar is a Ph.D. graduate from the University of Sydney, Australia, best known online for his webcomics, and for creating several humorous esoteric programming languages. He is also the author of several GURPS roleplaying sourcebooks for Steve Jackson Games, as well as a regular...

. It is based on the manipulation of data values in a number of stacks; the same idea is used in assembly programming languages. Each program consists at minimum of the following:
  • A title
  • A list of variables and their data values
  • A list of instructions for stack manipulation


The joke is that the variables tend to be named after basic foodstuffs, the stacks are called 'mixing bowls' and the instructions for manipulating them 'mix', 'stir', etc.. A program, then, reads much like a cooking recipe.

A Hello World
Hello world program
A "Hello world" program is a computer program that outputs "Hello world" on a display device. Because it is typically one of the simplest programs possible in most programming languages, it is by tradition often used to illustrate to beginners the most basic syntax of a programming language, or to...

 example program in Chef:

Hello World Souffle.

Ingredients.
72 g haricot beans
101 eggs
108 g lard
111 cups oil
32 zucchinis
119 ml water
114 g red salmon
100 g dijon mustard
33 potatoes

Method.
Put potatoes into the mixing bowl.
Put dijon mustard into the mixing bowl.
Put lard into the mixing bowl.
Put red salmon into the mixing bowl.
Put oil into the mixing bowl.
Put water into the mixing bowl.
Put zucchinis into the mixing bowl.
Put oil into the mixing bowl.
Put lard into the mixing bowl.
Put lard into the mixing bowl.
Put eggs into the mixing bowl.
Put haricot beans into the mixing bowl.
Liquefy contents of the mixing bowl.
Pour contents of the mixing bowl into the baking dish.

Serves 1.

The phrase "Hello world!" is encoded as ASCII
ASCII
The American Standard Code for Information Interchange is a character-encoding scheme based on the ordering of the English alphabet. ASCII codes represent text in computers, communications equipment, and other devices that use text...

 values in the amount specifiers in the recipe. The ingredient names themselves are variable names, and are here named with a starting letter matching the letter encoded in the number in front for convenience, except that zucchini is the space and potatoes are the exclamation point.

The order of the words is reversed because when the phrase "hello world!" is printed out, the ingredients are "popped" from the stack
Stack (data structure)
In computer science, a stack is a last in, first out abstract data type and linear data structure. A stack can have any abstract data type as an element, but is characterized by only three fundamental operations: push, pop and stack top. The push operation adds a new item to the top of the stack,...

 (also known as the mixing bowl). The last element (last ingredient) to be put in the stack is the first element out of the stack.

A Fibonacci example program can be found on the language's website.

External links

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK