- 28 Weeks. 18 Weeks Down
- New Windows Home Server
- Japan Photo
- Microsoft and Web 2.0 Stuff
- Bing Box on your Website or Blog
- New.CloudApp();
- Fifth Barcamp Sydney, Saturday June 27th
- 2765 Words
- Working for the Underdog
- The Group Twitter Account Conundrum
- Social Media. The Opera is dying, All Hail the Circus
- Reading: Shell Global Scenarios to 2025
- Off My Soapbox of Self Righteousness
- Microsoft and Open Source, Unhandled Exceptions. Sydney, Melbourne, Brisbane
- ReMIX: 11th June
- atNickHodge Episode 12: Mark Pesce
- Stilgherrian in Africa: Project Toto
- A random thought greater than 140 characters
- TEDtalks Ten Commandments for Presenters
- atNickHodge Episode 11: @zuzu Punk Rock Changed My Life
LOLCODE: Part 4, A New Beginning
By Nick Hodge | August 3, 2007
Time to LOLCODE. Watching the forums, it's fun watching the definition of a programming language where the grammar is obvious.
And I've also thought of a great, quotable reason to use LOLCode:
"Nick Hodge, Enthusiast Evangelist for Microsoft, recommends the investigation of LOLCODE as Enterprise-worthy Programming Language if your development project has a strong requirement to entertain future system maintenance engineers, and your present development team gets LOLCATS humor." You can quote me on that.
What was not immediately obvious, another effort is to make your lines of LOLCode funny. Careful choice of variable names should result in LULZ.
There were a few occasions where I had a peek at the C# source code of the LOLCode compiler. It will be interesting to see how much of the engine that makes the compiler is taken over by the new DLR, and how hard/easy it is to create a domain specific language. The DLR contains mainy of the infrastructure pieces, such as creation of abstract syntax trees, etc.
Note that these examples compiled with LOLCODE.Net Build 35, and are based on the 1.2 specification.
First program: Hello World
HAI
VISIBLE "hello world"
KTHXBYE
What's going on here? HAI is the indication of the beginning of the lolcode app; KTHXBYE is the end.
VISIBLE "hello world" prints out, well, hello world.
Second program: Getting Input
HAI
I HAS A FLUFFYZ
VISIBLE "ur namez is?"
GIMMEH LINE FLUFFYZ
VISIBLE "hello "!
VISIBLE FLUFFYZ
KTHXBYE
So, what's going on this time?
I HAS A FLUFFYZ-- declares a variable called FLUFFYZ
GIMMEH LINE FLUFFYZ-- gets some input, in this case from the keyboard
The exclamation mark at the end of the VISIBLE "hello "! keeps the printout on the same line
VISIBLE FLUFFYZ prints out the content of the variable FLUFFYZ. Simple
Third program: Looping, Conditionals
HAI
I HAS A LIFE ITZ 1
I HAS A OSCARZ ITZ 10
IM IN YR HEADSPIN UPPIN YR LIFE TIL BOTH SAEM LIFE AN OSCARZ
VISIBLE LIFE
IM OUTTA YR HEADSPIN
KTHXBYE
This code example should work; it compiles in lolc but neatly stops when running in the CLR. The new parts are the assignment of a value to a variable (I HAS A LIFE ITZ 1)
Secondly, the line "I am in your loop increasing your LIFE until both-the same life and OSCARZ" is a simple loop with increment and a test.
The "IM IN YR HEADSPIN" is an example/attempt at humor. HEADSPIN is the name of the loop. Crafting these names to something funny will provide a future code maintenance geek some LULZ in the future.
No related posts.
Topics: lolcode, teched, technology | 2 Comments »





August 9th, 2007 at 12:53 pm
[...] Stage 1: http://www.nickhodge.com/blog/archives/2025Stage 2: LOLCODE HAS LULZ http://forum.lolcode.com/viewtopic.php?id=304Stage 3: Seems that the [...]
November 10th, 2007 at 2:12 am
Dunno if you've seen this or the further-linked article, but:
http://icanhaz.com/DLR !