Cow | A Computer Language
If you are thinking that we will be talking about creating a device that can help you to converse with a cow, sorry we aren’t. If you think we are creating some interface like Google translate to help us chat with a cow, sorry, but again it’s a no.
What do you think when you hear the word programming language? Do you imagine huge codes with words like print, out, in, scan, import, and so on? Does all modern-day computer programming language only use such human-understandable words? Let’s see one…
Okay after so many questions and nos what are we going to explore? It’s a programming language called cow.
If you think that the code will be like a cow’s Moo, yes you are right!
The cow is one of the world’s top 5 toughest programming languages along with Malbolge, Brainfuck, Intercal, Whitespace. It was released in early 2013 and is not so popular among the developer community. It is an esoteric programming language or esolang, which simply means that it is designed to experiment with weird ideas, to be hard to program in, or made as a joke rather than for practical use. There is a small but active community building such esoteric languages and also using them. These languages can perform all the tasks that a universal turing machine can and so can be rightfully be called a programming language.
The earliest esoteric language that was deliberately created is called Intercal, designed by Donald R Woods and James M Lyon in 1972. Some of the popular esoteric languages are Brainfuck and Befunge, both developed in 1993.
Even cow is highly influenced by Brainfuck and is designed humorously with Bovinae in mind. Cow has a total of 12 instructions, which is 4 more than Brainfuck and is Turing complete. All 12 instructions are just variations of the word “MOO”, which is the only word which a cow can utter.
Syntax:
Statement ::= moo | mOo | moO | mOO | Moo | MOo | MoO | MOO | OOO | MMM | OOM | oom | S1 S2
Since MOO and moo form a while-loop together, it seems logical to join them as one syntactical construction. Unfortunately, we cannot do so because the instruction mOO can produce individual MOOs and moos, so that (half) while-loops can be formed dynamically. It is also possible for a program to end while still inside a while-loop!
Example program for printing Hello, World!
MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO
MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO
MoO MoO Moo MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO Moo MoO MoO
MoO MoO MoO MoO MoO Moo Moo MoO MoO MoO Moo OOO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO
MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO Moo MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO
MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO
MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO
MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO Moo MOo
MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo
MOo MOo MOo MOo MOo Moo MOo MOo MOo MOo MOo MOo MOo MOo Moo MoO MoO MoO Moo MOo MOo MOo MOo MOo MOo Moo MOo MOo MOo MOo MOo MOo MOo MOo Moo
OOO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO Moo
“ Hello, World!” using loops
MoO MoO MoO MoO MoO MoO MoO MoO MOO moO MoO MoO MoO MoO MoO moO MoO MoO MoO MoO moO MoO MoO MoO MoO moO MoO MoO MoO MoO MoO MoO MoO
MoO MoO moO MoO MoO MoO MoO mOo mOo mOo mOo mOo MOo moo moO moO moO moO Moo moO MOO mOo MoO moO MOo moo mOo MOo MOo MOo Moo MoO MoO
MoO MoO MoO MoO MoO Moo Moo MoO MoO MoO Moo MMM mOo mOo mOo MoO MoO MoO MoO Moo moO Moo MOO moO moO MOo mOo mOo MOo moo moO moO MoO
MoO MoO MoO MoO MoO MoO MoO Moo MMM MMM Moo MoO MoO MoO Moo MMM MOo MOo MOo Moo MOo MOo MOo MOo MOo MOo MOo MOo Moo mOo MoO Moo
Some other instructions
quick exit
OOO
MOo
mOO
simple loop using current memory block as a counter
MOO
MOo
[[ anything in here happens "current" number of times ]]
moo
copy the current value to next memory block
MMM
moO
MMM
loop “current” number of times without affecting current’s value
MMM
moO
MMM
MOO
MOo
[[ move back so original current is current again ]]
mOo
[[ loop here ]]
[[ move forward so the loop continutes to work on the temp counter ]]
moO
moo
test if the current is 3 without affecting current’s value
[[ copy current to temp block ]]
MMM
moO
MMM
[[ copy 3 into another new temp block ]]
moO
OOO
MoO
MoO
MoO
[[ loop 3 times (the 3 is still current) ]]
[[ this also decrements the temp value ]]
MOO
MOo
mOo
MOo
moO
moo
[[ move back to first temp value (the copy of the current value) and check if 0 ]]
mOo
MOO
[[ make original current current again ]]
mOo
OOM
[[ gets here if != 3 ]]
[[ skip down to the bottom past the if ]]
moO
OOO
MOO
moo
[[ make original current current again ]]
mOo
OOM
[[ gets here if == 3 ]]
[[ skip down to the bottom of the if ]]
moO
OOO
MOO
moo
moo
[[ set current back ]]
mOo
[[ all execution resumes here ]]
generate Fibonacci sequence
MoO
moO
MoO
mOo
[[ main loop ]]
MOO
[[ print first number ]]
OOM
[[ temp copy of first number ]]
MMM
moO
moO
MMM
mOo
mOo
[[ store second number off in the first position now ]]
moO
MMM
mOo
MMM
[[ move back to temp number ]]
moO
moO
[[ use temp to add to first and store in second in loop ]]
MOO
MOo
mOo
MoO
moO
moo
mOo
mOo
moo
I hope after reading this you will surely learn more about COW language and start working on some programs in this beautiful language.
These languages show that every idea that a human gets in his mind is worth exploring and implementing. This language might be difficult to code, but I am sure that you had a smile on your face when you read through. Did you ever have this smile when you saw python code? Did you ever smile when you saw a C code? Sometimes it is good to explore some fun languages like COW, isn’t it?
Thank you for reading… Will come back soon with another one…