![]() |
|
Paradigm | esoteric |
---|---|
Designed by | Adam Lindsay |
First appeared | 2007 |
Filename extensions | .lol, .lols |
Website | lolcode |
Influenced by | |
Lolcats |
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.
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.
LOLCODE's keywords are drawn from the heavily compressed (shortened) patois of the lolcat Internet meme. Here follows a Hello world program and a simple program to output a file to a monitor. Similar code was printed in the Houston Chronicle.
In this example, commands to open a file (PLZ OPEN FILE "NAME"?
—"Please try to open a file?"), and error handling (AWSUM THX
—"Awesome, thanks!", and O NOES
—"Oh no!") are introduced.
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 VISIBLE
, and 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 (from an Internet meme "I'm in your ___"), and ended with IM OUTTA YR label. Loops lack counters or conditions, and thus do not cease inherently. They must be manually broken with the ENUF
, "enough" in Leetspeak (old version ) command. Loops can also be ended with the conditional IZ
command:
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):
The most recent and up-to-date interpreter for the LOLCODE language is lci, written in C by Justin Meza. It interprets LOLCODE efficiently on a variety of platforms.