Home > Links, Programming > I can has LOLCODE?

I can has LOLCODE?

I rediscovered LOLCODE by Adam Lindsay the other day. Basically, it’s a language whose keywords and syntax consist of lolcat language. Great stuff, that is. I decided to bring it another step forward.

I have created a C++ header that contains #define preprocessor commands to allow you to program in something very much like LOLCODE, using normal C++ compilers. I tried to keep to the accepted specifications for LOLCODE where possible, but the two languages have some differences that made it impossible to create perfect equivalents in all cases. I also included definitions for C++ features like classes, so this implementation of LOLCODE is object-oriented. Up to this point, most of the development surrounding LOLCODE has been focused on simple text based programs, and as far as I know, there is very little support for much else. This opens the door for LOLCODE users to access all the libraries, functions, etc. designed for C or C++.

Now you too can write code that looks like THIS:

#include "lolcode.h"

OHHAI
HAI
	I HAS A NUMBR CALLED VAR R 5 K
	I HAS A NUMBR CALLED LIST THISBIG 10 WOW K
	VISIBLE "OH HAI WORLD!\n" KDONE
	VISIBLE "O BTW VAR R %i\n" ALSO VAR KDONE
	I HAS A NUMBR CALLED COUNT R 0 K

	IM IN YR LOOP
		IZ COUNT LIEK 10 ORLY
		YARLY
			OKBYE
		NOWAI
			LOL LIST WHICH COUNT OKAI R rand WIF DONE LEFTOVRZ 10 UP 1 K
			COUNT UPD K
		KTHX
	KTHX

	VISIBLE "NUMBRS FROM 1 TO 10 K?\n" KDONE
	LOL COUNT R 0 K
	IM IN YR LOOP
		IZ COUNT LIEK 10 ORLY
		YARLY
			OKBYE
		NOWAI
			VISIBLE "LIST #%i R %i\n" ALSO COUNT ALSO LIST WHICH COUNT OKAI KDONE
			COUNT UPD K
		KTHX
	KTHX

	FOUNDYR 0 MKAY
KTHXBYE

You can get the header here. Please leave comments on how I could improve the syntax.

Don’t forget to rate, comment, and subscribe!

Advertisements
Categories: Links, Programming Tags: , ,
  1. April 20, 2010 at 7:38 pm

    This is amazing!

    Now I want to program again! Owait…

  2. TStEgend
    April 20, 2010 at 9:38 pm

    INCREDIBLE
    impractical but damnit all its
    incredible!

  3. jovoc
    April 21, 2010 at 12:05 pm

    I am so using this for LD48 this weekend.
    (maybe not for the whole thing).

    This rules absolutely.

    kthxbye.

  4. Codexus
    April 22, 2010 at 6:54 am

    I has a lol!

  5. April 4, 2012 at 8:36 am

    Nice trick. LOLCODE is sweet. I once wrote an Interpreter for it in Ruby, but it was a little too much work. Macros make more sense! ᵔᵜᵔ

  1. April 20, 2010 at 9:18 pm

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: