Farm

From Esolang
Jump to navigation Jump to search
Farm
Paradigm(s) imperative
Designed by Julien Reichert & Vivien Maisonneuve
Appeared in 2008
Memory system tape-based
Dimensions one-dimensional
Computational class Turing complete
Major implementations OCaml implementation
Influenced by Brainfuck
File extension(s)


Farm is an esoteric language based on brainfuck with some shortcut instructions, like changing the current pointed case to a (97 in ASCII code). As the name may suggest it, instructions are actually animal onomatopea, which can be written in french or english (some are even translated in german and dutch).

To run the program, there must be in first argument an input file containing ASCII text to be copied down with the instruction 'gloup'.

Language overview

The beginning of any program must be either cocorico or cock a doodle doo and the end must always be houuu or howl.

The language has a notation of comments - % ignores everything until the end of line, it will also ignore every character which is not a letter (except the - in hee-haw). Also note that for an instruction to be accepted, the onomatopea must be only one of the following:

  • lower case only,
  • upper case only or
  • only lower case except for the first character.

Here is the complete list of onomatopea which have a brainfuck equivalent:

Onomatopea brainfuck equivalent Description
ouah, waf, wau, bark, arf, woof or ouaf + increment current byte (wraps around at 255)
miaou, meow, miau, miauw, mew or miaow - decrement current byte (wraps around at 255)
meuh or moo > increment pointer (doubles the array if it would get out of bounds to the right)
coin, quack or couac < decrement pointer (throws an error if it gets out of bound)
gloup, gloups or bloup , read one byte from input (throws error if there are no bytes to be read)
groink or grunt . output the current byte as ASCII character
sss or hiss [ go past corresponding blater or blat if the current byte is zero
blater or blat ] jump back to corresponding sss or hiss if the current byte is non-zero

The following onomatopea are shortcuts helpful for string operations:

Onomatopea Description
cui, piu, chirp, tchip, twiet or tweet write 97 (value of a)
squick, squeak or squeal write 122 (value of z)
groar or roar write 65 (value of A)
bzz or buzz write 90 (value of Z)
hihan, heehaw or hee-haw write 48 (value of 0)
bee or bleat write 57 (value of 9)
cot or cluck write 32 (value of )

The following onomatopea are shortcuts helpful for memory operations:

Onomatopea Description
rouuu exchange the current byte and the one in memory (initially zero)
leo replace current byte on tape with byte in memory (won't override the value in memory)
coucou begins the registering of a list of instructions (erases the current memory)
glouglou or gobble ends this registering, all memorized instructions are NOT done
hihihi makes at once all instructions in the memorized list

Example program

An example of a program in Farm, printing Hello world!:

Cock a doodle doo
roar bark bark bark bark bark bark bark grunt
chirp bark bark bark bark grunt
sss meow moo bark moo bark quack quack blater moo moo
bark bark bark bark bark bark bark grunt grunt
sss meow moo bark moo bark quack quack blater moo moo
bark bark bark grunt
moo cluck grunt
moo squick meow meow meow grunt
quack quack grunt
bark bark bark grunt
quack grunt
quack quack meow grunt
cluck bark grunt
howl