LOLCODE, the LOLCat Programming Language

by Joey deVilla on May 28, 2007

Cat at computer: “I can has programming language?”

The moment Anil Dash published his now-famous blog entry on the grammar used by lolcats, Cats Can Has Grammar, the door to studies that were equal parts silly and serious was opened. Not to be content with mere lexical and semiotic analysis of lolcats, some folks have taken it to the next level: the LOLCODE programming language.

LOLCODE is your standard Algol-style programming language (Algol is the grandfather of just about every popular current programming language) married to the lolcat captioning style — that is, ALL CAPS and I CAN HAS SILLY CAT GRAMMER AND SPELING KTHXBYE.

Here’s HAI WORLD, the LOLCODE version of “Hello, World!”:

HAI
CAN HAS STDIO?
VISIBLE "HAI WORLD!"
KTHXBYE

Here’s something that outputs the numbers 1 through 10, a classic beginner’s exercise:

HAI
CAN HAS STDIO?
I HAS A VAR
IM IN YR LOOP
	UP VAR!!1
	VISIBLE VAR
	IZ VAR BIGGER THAN 10? KTHXBYE
IM OUTTA YR LOOP
KTHXBYE

And finally, here’s a program to print the contents of a specified file:

HAI
CAN HAS STDIO?
PLZ OPEN FILE "LOLCATS.TXT"?
	AWSUM THX
		VISIBLE FILE
	O NOES
		INVISIBLE "ERROR!"
KTHXBYE

If someone’s working on an IDE for this language, I have very important stylistic advice: it should make heavy use of the Impact font, just like all those lolcat captions. Bonus points if it’s Impact with a white fill and black stroke!

{ 18 comments… read them below or add one }

1 Steve C May 30, 2007 at 2:50 pm

I’m sure its the only Computer Language where the nested exception handling, designed to allow your running executable to have nine lives before abnormal termination. Just stay alert and be careful how you move that mouse while programming in it. (lol)

2 arcane May 31, 2007 at 4:05 pm

More Golden Words from Gooey … well done :)

3 ginny May 31, 2007 at 11:22 pm

Can we has debuggerr now? Huzban need for werkz. Awsum win!!1!

4 Bernd Haug June 2, 2007 at 3:24 pm

I WANTS TEH EXECPTIONS!!!1!

WHOA LOOK
 PLZ OPEN FILE "INPUTS HEREE!" I WANTS INPUTS
OOOOPS!!!1! I FAILS
 INVISIBLE "UGH :("
 KTHXBYE
FOR WINS
 VISIBLE TEH INPUTS
SO WHATEVER
 CLOES INPUTS
KTHXBYE

5 Bernd Haug June 2, 2007 at 3:25 pm

Ur blog is in my commentz killin my indents!!1!

6 Joey deVilla June 2, 2007 at 6:59 pm

@Bernd: I added <code> and <pre> tags to the code in your comment, so now YOU CAN HAS INDENTZ!!1!!1!

7 Rohan Jayasekera June 3, 2007 at 1:39 am

You are no longer permitted to make me laugh so hard. It hurts.

8 The Virtual One June 5, 2007 at 12:08 am

MY BOOBIES IS IN UR FACE

/that is all

9 Michael Cogle February 4, 2008 at 9:47 am

I’m studying LOLCODE at cambridge in my second year.

10 heheh April 4, 2008 at 1:46 am

errorz in ur 1-10 exapmlez meow:)

11 john locke May 10, 2008 at 5:04 pm

omgzwtfs?
you spells BYE teh wrongs…

i you wants make “KTHXBAI”

;)
-ciaoooo

KTHXBAI

12 Diane June 7, 2008 at 11:38 pm

At last! A programming language I understand :)

Thanks for the smiles!

13 Andrew October 7, 2008 at 11:43 am

Oh hai!!1
Wut dis bein?
Al i no iz dat sumfin wif LOLcode? AWSUM
Chek owt mai rewnskayp w3bsite k?
kthnxbye!!!111one11!1111eleven11!!!!

14 Andrew October 7, 2008 at 11:45 am

I haza sekrit…
NOM! HAH! No sekrit rry

15 BOBKATZZ November 11, 2008 at 10:58 am

HAI
CAN HAS STDIO?
I HAS A VAR
IM IN YR LOOP
SUMPN TO NOM
NOM TIL NONOMINLEFT
IM OUTTA YR LOOP
KTHXBYE

16 Jamie January 13, 2009 at 8:48 am

Hai,

I can has babees for you?

kthnxbai

17 Lucas April 1, 2009 at 10:19 am

After learning VBA….i would proudly and Gladly uses this programming…
Although the books for it would prolly be hard to understand…
–Lucas

18 gvde April 2, 2009 at 10:58 am

lol

Leave a Comment

Previous post:

Next post: