An Obfuscated English-to-Pig-Latin Converter

PIG_LATIN is a C program which converts an input file of English text into a file of "Pig Latin" text, by Don Dodson.

The program was the winner, in the "Most Humorous" category, of the annual International Obfuscated C Code Contest (IOCCC) - a contest you only want to win on purpose!

To see why it was a winner, print out the code. Look at it. Look at it a long time. Realize that the C compiler sees nothing wrong with this code, and can compile it into a program that really does what it says it will do.

As the author says:

"Istha ogrampra akesta Englishwa extta aswa inputwa andwa anslatestra itwa intowa Igpa Atinla."

The obfuscation is on several levels.

Most obviously, the shape of the program.

Underneath that, the variable names are in Pig Latin, as are the names of the standard C functions, such as >putchar. Even main is written as ainma.

The program construction is also very obfuscated, with all of the code being inside the parentheses of one of the 6 orfa loops.


        pig_latin < input > output
will read the text of input, convert it to Pig Latin, and write the converted text to output.


PIG_LATIN is available in a C version.

Related Data and Programs:

CAESAR, a C library which can apply a Caesar Shift Cipher to a string of text.

MANDELBROT_ASCII, a C program which generates an ASCII image of the Mandelbrot fractal set using just two lines of C.

ROT13, a C program which reads a file of text and converts it to ROT13 text, and vice versa.

UUDECODE, a C program which reads a UU encoded text file and translates it back to its original form.

UUENCODE, a C program which translates a file (possibly in binary format) to the UU encoding.


Don Dodson


Ebsterway's Ictionaryday

Source Code:

Examples and Tests:

You can go up one level to the C source codes.

Last revised on 04 December 2007.