LOLCODE is an esoteric programming language inspired by lolspeak, the language expressed in examples of the lolcat Internet meme. The language was created in 2007 by Adam Lindsay, researcher at the Computing Department of Lancaster University.
|Designed by||Adam Lindsay|
|Filename extensions||.lol, .lols|
The language is not clearly defined in terms of operator priorities and correct syntax, but several functioning interpreters and compilers exist. One interpretation of the language has been proven Turing-complete.
Language structure and examplesEdit
LOLCODE's keywords are drawn from the heavily compressed (shortened) patois of the lolcat Internet meme. Here follow a “Hello, World!” program and a simple program to output a file to a monitor. Similar code was printed in the Houston Chronicle.
HAI 1.2 CAN HAS STDIO? VISIBLE "HAI WORLD!" KTHXBYE
In all LOLCODE programs, HAI ("Hi!") introduces the program and specifies the version (although this isn't actually used yet).
CAN HAS [LIBRARY]?
In many programming languages, one of the first statements will be a library inclusion for common functions such as input and output. Typically this is included by a call such as #include <stdio.h> [stdio standing for standard input/output library]. This command is a tongue-in-cheek corruption of that, asking if a library is obtainable, obtaining it if possible, and raising an exception if not. It is there primarily for verisimilitude—in fact, it is ignored in current implementations of LOLCODE.
prints a message to the screen.
HAIintroduces the program,
KTHXBYE(which is "K," "THX," and "Bye" all strung together, meaning "OK, thanks, bye") terminates it.
HAI 1.2 CAN HAS STDIO? PLZ OPEN FILE "LOLCATS.TXT"? AWSUM THX VISIBLE FILE O NOES INVISIBLE "ERROR!" KTHXBYE
Other commands include
I HAS A variable for declaring variables,
variable R value ("variable [is/are/being] value") for assigning them, sending error messages to the front end via
INVISIBLE instead of
BTW ("by the way") to denote a comment, making the parser ignore the rest of the line.
Loops are created with IM IN YR label (inspired by the "Im in ur noun, verbing yr related noun" LOLcat meme), and ended with IM OUTTA YR label. Loops can be broken with the keyword
ENUF ("enough"), or in older versions,
GTFO. Loops can also be ended with the conditional
IZ command, as demonstrated in the next example.
HAI 1.0 CAN HAS STDIO? I HAS A VAR IM IN YR LOOP UP VAR!!1 VISIBLE VAR IZ VAR BIGGER THAN 10? KTHX IM OUTTA YR LOOP KTHXBYE
This simple program displays the numbers 1–11 and terminates (as of specification 1.0). The same program as of specification 1.2 is (assuming VAR starts at 0):
HAI 1.2 CAN HAS STDIO? IM IN YR LOOP UPPIN YR VAR TIL BOTH SAEM VAR AN 10 VISIBLE SUM OF VAR AN 1 IM OUTTA YR LOOP KTHXBYE
The first LOLCODE implementation was a PHP parser written by Jeff Jones. The parser's website was also the first website using LOLCODE as an actual web scripting language. Being open source with a BSD style licence, it has been forked and used by multiple websites to implement LOLCODE scripting. The winning Pecha Kucha presentation at PHP Works 2008 was about this parser.
PL/LOLCODE, a project headed by Josh Tolley, makes LOLCODE available as a server-side programming language inside PostgreSQL.
lolcode-java (A Java grammar / interpreter for the LOLCODE programming language) is a project also available but it appears to not yet be compliant with the version 1.3 specification.
LOLCODE has also inspired LOLPython, written by Andrew Dalke. LOLPython uses LOL-inspired syntax similar to that of LOLCODE, but with a Python-like style. It operates by translating the LOLPython source into Python code.
- Dwight Silverman (2007-06-06). "I'm in ur newspaper writin mah colum". Chron.com. Retrieved 2007-06-06.
- "Computing Department at Lancaster University – News". Lancaster University, Computing Department. Archived from the original on 2009-05-28. Retrieved 2009-06-09.
- Hammock, Anne (2008-05-01). "The new fame: Internet celebrity". CNN. Archived from the original on 2009-04-30.
- Arachnid. "Proof that LOLCode is turing complete:BrainF*** interpreter in LOLCode". forum.lolcode.com. Archived from the original on 2007-07-11. Retrieved 2008-10-05.
- Adam Lindsay (2007-05-25). "LOLCODE main page". lolcode.com. Archived from the original on 2007-10-02. Retrieved 2007-10-02.
- "keywords:can-has · LOLCODE". Retrieved 2008-02-10.
- "SORN.net". Archived from the original on February 16, 2009. Retrieved 2007-11-07.
- "LOLCODE + lci".
- "First Parser Comment". Lindsay.at. Retrieved 2009-06-09.
- "Tetraboy's LOLCODE parser". Tetraboy.com. Retrieved 2009-06-09.
- ""The Best Web Language: LOLCODE" Slides". Slideshare.net. Retrieved 2009-06-09.
- "PHP Works". mtacon.com. Retrieved 4 November 2014.
- LOLCODE .NET compiler at Google Code
- TechEd Day 2: Microsoft announces LOLCode support, Long Zheng
- LOLcode in next Visual Studio? For young and funny cats, NetworkWorld.com
- "Video of LOLCODE presentation at TechEd 2007". Blip.tv. 2007-08-17. Archived from the original on 2009-02-05. Retrieved 2009-06-09.
- PL/LOLCODE, pgFoundry
- Deep DLR, John Lam and Martin Maly
- "lolcode grammar interpreter written in Java".
- "LolCode". Fullvolume.co.uk. Retrieved 2009-06-09.
- "Lightning-Parrot". lolcode.com. Retrieved 2009-06-20.
- "LoLCode 1337".
- "Parallel and Distributed Computing with LOLCODE".
- "LOLPython". Dalkescientific.com. 2007-06-01. Retrieved 2009-06-09.