Ook!

Recently, I discovered on the web a programming language called Ook!. According to its designer, its guiding principle is that programs should be writable and readable by orang-utans. To this end, it limits itself to only three syntax elements:

Ook.
Ook?
Ook!

It cheats a little, in that commands are actually pairs of Ooks, thus giving eight separate commands. In this, it is actually a pastiche of a language called variously Brainfuck (by the forthright), Brainf*** (by the censorious) or BF (by the polite). (more about BF).

The available commands (with their C equivalents) are:

Ook! BF CMeaning
Ook. Ook?>++pIncrement memory pointer
Ook? Ook.<--pDecrement memory pointer
Ook. Ook.+++(*p)Increment cell pointed to by memory pointer
Ook! Ook!---(*p)Decrement cell pointed to by memory pointer
Ook. Ook!,getchar(p)Read a character from STDIN
Ook! Ook..putchar(*p)Print ASCII value of character to STDOUT
Ook! Ook?[while (*p) {Move to command after matching Ook? Ook! if value of cell pointed to by memory pointer is 0
Ook? Ook!]}Move to command after matching Ook! Ook! if value of cell pointed to by memory pointer is not zero

Why is this interesting?

he asked rhetorically. Well, it is an interesting example of Terry Pratchett's discworld escaping from it's own reality.

But more interesting (to me at any rate) is that both Ook! and BF are Turing-complete programming languages. Which is to say, you can program any calculation in them.

They take us right down to the primal roots of programming - it's hard to imagine anything simpler. Charles Babbage and Ada Lovelace must have worked on something very similar (perhaps with a syntax closer to BF than Ook!) when working out programs for Babbage's Analytical Engine (never built, unfortunately).

I suppose people with formal computer science degrees have already come across this and are yawning politely but for this Arts graduate it is something of a revelation. Let's look at a concrete example.

An Ook! example

A Mr Lawrence Pit (who also wrote the .NET Ook! compiler) provides a Hello World! example (reproduced below) at his Ook! site. Ook! is not a concise language, so I have made no effort to translate the entire program. However, I have taken it up to the point at which it prints out the letter 'H'. which shows the general principles. The remainder is left as an exercise for the orang-utan:

Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. 
Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook! Ook?
Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. 
Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook? Ook! Ook! 
Ook? Ook! Ook? Ook. Ook! Ook. Ook. Ook? Ook. Ook. Ook. 
Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. 
Ook! Ook? Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. 
Ook. Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook. Ook. 
Ook! Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. 
Ook. Ook. Ook. Ook. Ook. Ook! Ook. Ook! Ook. Ook. Ook. 
Ook. Ook. Ook. Ook. Ook! Ook. Ook. Ook? Ook. Ook? Ook. 
Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. 
Ook. Ook. Ook. Ook. Ook. Ook. Ook! Ook? Ook? Ook. Ook. 
Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook? Ook! Ook! 
Ook? Ook! Ook? Ook. Ook! Ook. Ook. Ook? Ook. Ook? Ook. 
Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook.
Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook! 
Ook? Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. 
Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. 
Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook! Ook! Ook! Ook! 
Ook! Ook! Ook! Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook? 
Ook. Ook! Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook! Ook. 
Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! 
Ook! Ook! Ook. Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! 
Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook. Ook. 
Ook? Ook. Ook? Ook. Ook. Ook! Ook. 
Ook! C Buffer contents
  char *mp = memory_buffer; {0,0,0...}
Ook. Ook? ++mp; {0,0,0...}
Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook.
Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook.
*mp += 9; {0,9,0...}
Ook! Ook? while (*mp) {
Ook? Ook. --mp;
Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook.
Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook.
*mp += 8;
Ook. Ook? ++mp;
Ook! Ook! --(*mp);
Ook? Ook! }
Ook? Ook. --mp; {72,0,0...}
Ook! Ook. putchar(72); // 'H'

What now?

Well, nothing much really. You'd have to be out of your mind to actually want to program in these languages (a brief search of the web will provide numerous examples of people in this state).

Still, if I ever decide to build an Analytical Engine of my own, I now have a much better sense of what to do. And that can't be a bad thing.

Ook!

date

last updated
time