First time here? Check out the site's "greatest hits" or read a post from the archives. Feel free to leave a comment or ask a question, and consider subscribing to the latest posts via RSS or e-mail. Thanks for visiting!
« Baby Sign Language - Update at 2 years | Main | Dynamic Language Translation Widget from... »

During my Friday Keynote at the PNPSummit I did a silly 30 minute PowerPoint that ended with some LOLCats and a few examples of LOLCode. If you're not familiar with LOLCats, they are basically silly pictures of cats that speak a l33tspeak-like language, like IM IN UR BASE KILLIN YUR D00DS.

This language has turned into a Programming Language called LOLCode for which there are already at least TWO .NET implementations. The first implementation of LOLCode.NET is up on Google Code and is by Nick Johnson.

During my talk, unbeknownst to me, literally that minute John Lam was uploading the DLR team's own implementation of LOLCode implemented from scratch on the DLR. The amazing Martin Maly of the DLR team implemented LOLCode on his plane ride to Spain for presentation at TechEd.

I invited John up on stage spontaneously to give a demo of LOLCode and he did...he showed a Fibonacci implementation.

This is great code to read for two reasons. It's two completely separate implementations of the same general idea - an LOLCode compiler. However, they are implemented completely differently. Of course, the DLR team images this as a Dynamic Language so their implementation is a great primer on how to make your own language on the DLR.

HAI

CAN HAS STDIO?
VISIBLE "HAI WORLD!"

I HAS A CODE ITZ "CRAZY"
VISIBLE CODE

I HAS A NUMBR
LOL NUMBR R 2
VISIBLE NUMBR TIEMZ 2

I HAS A FIB
I HAS A A ITZ 1
I HAS A B ITZ 0

VISIBLE "Fibonacci: "
GIMMEH FIB

IM IN YR
    VISIBLE B

    IZ FIB SMALR 1?
		YARLY
			GTFO
	KTHX

    I HAS A TEMP ITZ A UP B
    LOL A R B
    LOL B R TEMP

    NERFZ FIB!!
KTHX

CAN HAS System?

VISIBLE CurrentDirectory ON Environment ON System
NJU Hashtable ON Collections ON System
I HAS A HT ITZ IT

I HAS A DT
LOL DT R DateTime ON System
VISIBLE Now ON DT

COL Add ON HT WIT "LolCode" AN "Rulezz!!"
VISIBLE COL get_Item ON HT WIT "LolCode"

COL Concat ON String ON System WIT "LolCode " AN "Rulezz!!"
VISIBLE IT

KTHXBYE

In order to get the DLR Team's implementation running on your own machine, you need to do the following:

  1. Get the LOLCode sources
  2. Get IronPython 2.0 Alpha 6
  3. Get the Gardens Point Parser Generator (GPPG) 
  4. Get the Gardens Point Scanner Generator (GPLEX)
    These are kind of Lex and Yacc for C#. Open up the Parser.y and Scanner.l to see the language grammar details.
  5. Confirm the PostBuild steps point to the right locations and make sure the Microsoft.Scripting.dll reference points to the Microsoft.Scripting.dll from the IronPython download.

Enjoy! If you don't think this is fun, go play with the MVC Demo Source Code from DevConnections and the PNPSummit.



Sunday, November 11, 2007 7:37:34 AM (Pacific Standard Time, UTC-08:00)
ZOMG, SW33T LOL CODE, LOL

Pop Catalin
Sunday, November 11, 2007 8:42:48 AM (Pacific Standard Time, UTC-08:00)
LOLZ I'M IN UR BLOGG!!!111
Sunday, November 11, 2007 9:53:53 AM (Pacific Standard Time, UTC-08:00)
Ahhhh, this is so beautiful it makes me cry ;'D
loloolllool
Sunday, November 11, 2007 10:18:37 AM (Pacific Standard Time, UTC-08:00)
Its really very good to hear that you are going to give the training for .Net through mails like this...
I am very happy about that and I am eager to learn the .net course through mails like this.....please send me the material of .net.
and Please let me know all the latest updates of this technology
Madhumathi.M
Monday, November 12, 2007 7:26:02 AM (Pacific Standard Time, UTC-08:00)
implemented LOLCode on his plane ride to Spain


I know LOLCode is a fairly simple language, but that's still impressive!
Andy
Monday, November 12, 2007 11:48:59 AM (Pacific Standard Time, UTC-08:00)
Is that cat saying Leroy from the movie "The last dragon"? ; )
Cameron
Monday, November 12, 2007 1:55:52 PM (Pacific Standard Time, UTC-08:00)
I think the cat's yelling at Leroy Jenkins, not worrying about whether Taimak's got the glow on him or whose Converse it'll have to kiss.
When cultural ephemera clash, everybody wins.
Monday, November 12, 2007 3:05:46 PM (Pacific Standard Time, UTC-08:00)
Scott, thanks for the LOLCODE mention. Martin Maly has contributed further details on behind the scenes implementation details at the LOLCODE site.
Tuesday, November 13, 2007 12:31:17 PM (Pacific Standard Time, UTC-08:00)
scott,

lolcats and fibonacci, not sure what to say to that, but thanks for posting something to make me laugh!
Saturday, November 17, 2007 4:08:25 AM (Pacific Standard Time, UTC-08:00)
This is great work. Not wanting Mac and Linux users to be left behind, I've written an article about running the DLR Edition of LOLCODE on Mono...

http://sorn.net/blog/2007/11/LOLCODE-DLR-Edition-on-OS-X-and-Linux-with-Mono
Monday, November 19, 2007 8:14:48 PM (Pacific Standard Time, UTC-08:00)
Bloody brilliant!!
Comments are closed.

Contact

Sponsors

Xceed - The Free WPF Grid
ASP.NET HOSTING
GUI Controls For Drop-In Windows Explorer Like File/Folder Browsing Functionality
SyncBackSE from 2BrightSparks
Free WinForms Library from ComponentFactory.com
CodeIt.Right The First Time
Get closer with NCover
Dell Laptops
Error displaying xml file:

The operation has timed out

System

at System.Net.HttpWebRequest.GetResponse() at Hanselman.TextLinkMacro.TextLinks(String adID, String inventoryKey)

On this page...

Tags

Calendar

<May 2008>
SunMonTueWedThuFriSat
27282930123
45678910
11121314151617
18192021222324
25262728293031
1234567

Archives

Google Ads