I can has programin langige?

Thank you, internet, you have made my life slightly more complete.

Or less complete. Or something. What was the question again?

I ran across something called LOLCODE today on Digg. LOLCODE is a programming language based on Lolcats. If you're not familiar with lolcats, savor those precious few Sanity Points you have left and click here.

Here's an example of Hello World in LOLCODE:

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

LOLCODE is a kinda-sorta-programming language that started out as a joke, then became a specification, and then people inevitably wrote compilers an interpreters for. No, really. Check implementations on the site, there's a whole list of 'em, including a .Net compiler.

While being hilarious to look at (c'mon, CAN HAS <library>? as a replacement for using, include, or require?), it's actually... usable, as long as you're doing absolutely pointless things with it. By usable, I mean in the same way one could use a screwdriver to hammer in a nail. The kind of useful that comes with the exceptions "as an entertaining party trick" or "as a mental exercise."

Yesterday I happened to run across an article that made vague mention of the FizzBuzz programming test sometimes used in interviews, so I figured, why not screw around and write that? (The answer: it's sorta painful to do in a language that doesn't seem to do modulus division.)

So, that said, here's CheezBurger. I do want to stress: this actually compiles into an executable file using the Lolcode.net compiler. (I still find that somewhat baffling.)

HAI
BTW LOL I HAS A FIZZBUZZ EXAMPLE

CAN HAS STDIO?
I HAS A NUMBAR
LOL NUMBAR R 0

I HAS A MACKSIMUM
LOL MACKSIMUM R 100

IM IN YR LOOPZ
	LOL NUMBAR R NUMBAR UP 1
	
	I HAS A NUMBAR_IZ_CHEEZ
	LOL NUMBAR_IZ_CHEEZ R 0

	I HAS A NUMBAR_IZ_BURGER
	LOL NUMBAR_IZ_BURGER R 0

	I HAS A COUNTAR
	LOL COUNTAR R 0 

	I HAS A MAX_COUNTAR
	LOL MAX_COUNTAR R NUMBAR OVAR 3

	IM IN YR LOOP
		LOL COUNTAR R COUNTAR UP 1

		BTW I CHECKIN FOR CHEEZ LOL
		I HAS A CHEEZ_NUMBAR
		LOL CHEEZ_NUMBAR R COUNTAR TIEMZ 3
		IZ CHEEZ_NUMBAR LIEK NUMBAR?
		YARLY
			LOL NUMBAR_IZ_CHEEZ R 1
		KTHX

		BTW I CHECKIN FOR BURGER LOL
		I HAS A BURGER_NUMBAR
		LOL BURGER_NUMBAR R COUNTAR TIEMZ 5
		IZ BURGER_NUMBAR LIEK NUMBAR?
		YARLY
			LOL NUMBAR_IZ_BURGER R 1
		KTHX

		IZ COUNTAR BIGR THAN MAX_COUNTAR?
		YARLY
			GTFO
		KTHX
	KTHX

	IZ NUMBAR_IZ_CHEEZ LIEK 1 AND NUMBAR_IZ_BURGER LIEK 1?
	YARLY
		VISIBLE "CHEEZBURGER"
	NOWAI
		IZ NUMBAR_IZ_CHEEZ LIEK 1?
		YARLY
			VISIBLE "CHEEZ"
		NOWAI
			IZ NUMBAR_IZ_BURGER LIEK 1?
			YARLY
				VISIBLE "BURGER"
			NOWAI
				VISIBLE NUMBAR
			KTHX
		KTHX
	KTHX

	IZ NUMBAR UP 1 BIGR THAN MACKSIMUM?
	YARLY
		GTFO
	KTHX
KTHX
KTHXBYE

Post a Comment

To post a comment to this blog entry, login below:

Email:
Password:

If you don't have an account, register here.