LOLCODE is an
esoteric programming language
An esoteric programming language (sometimes shortened to esolang) is a programming language designed to test the boundaries of computer programming language design, as a proof of concept, as software art, as a hacking interface to another language ...
inspired by
lolspeak
A lolcat (pronounced ), or LOLcat, is an image macro of one or more cats. Lolcat images' idiosyncratic and intentionally grammatically incorrect text is known as lolspeak.
Lolcat is a compound word of the acronymic abbreviation LOL (laugh ...
, the language expressed in examples of the
lolcat
A lolcat (pronounced ), or LOLcat, is an image macro of one or more cats. Lolcat images' Idiosyncrasy, idiosyncratic and intentionally grammatically incorrect text is known as lolspeak.
Lolcat is a Compound (linguistics), compound word of the ...
Internet meme
An Internet meme, or meme (, Help:Pronunciation respelling key, ''MEEM''), is a cultural item (such as an idea, behavior, or style) that spreads across the Internet, primarily through Social media, social media platforms. Internet memes manif ...
.
The language was created in 2007 by Adam Lindsay, a researcher at the Computing Department of
Lancaster University
Lancaster University (officially The University of Lancaster) is a collegiate public university, public research university in Lancaster, Lancashire, England. The university was established in 1964 by royal charter, as one of several new univer ...
.
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
In computability theory, a system of data-manipulation rules (such as a model of computation, a computer's instruction set, a programming language, or a cellular automaton) is said to be Turing-complete or computationally universal if it can be ...
.
Language structure and examples
LOLCODE's
keyword
Keyword may refer to:
Computing
* Index term, a term used as a keyword to documents in an information system such as a catalog or a search engine
* Keyword (Internet search), a word or phrase typically used by bloggers or online content creator to ...
s are drawn from the heavily compressed (shortened)
patois
''Patois'' (, same or ) is speech or language that is considered nonstandard, although the term is not formally defined in linguistics. As such, ''patois'' can refer to pidgins, creoles, dialects or vernaculars, but not commonly to jargon or sl ...
of the lolcat Internet meme. Here follow a
"Hello, World!" program
A "Hello, World!" program is usually a simple computer program that emits (or displays) to the screen (often the Console application, console) a message similar to "Hello, World!". A small piece of code in most general-purpose programming languag ...
and a simple program to output a file to a monitor.
Similar code was printed in the ''
Houston Chronicle
The ''Houston Chronicle'' is the largest daily newspaper in Houston, Houston, Texas, United States. it is the third-largest newspaper by Sunday circulation in the United States, behind only ''The New York Times'' and the ''Los Angeles Times''. ...
''.
* represents a newline ()
* represents a tab ()
* represents a bell character ()
* represents a literal double quote ()
* represents a single literal colon ()
* converts a single hexadecimal Unicode code point to local environment encoding (for example,
UTF-8
UTF-8 is a character encoding standard used for electronic communication. Defined by the Unicode Standard, the name is derived from ''Unicode Transformation Format 8-bit''. Almost every webpage is transmitted as UTF-8.
UTF-8 supports all 1,112,0 ...
)
* interpolates the value of the enclosed variable, cast as a string
* converts normative name of a single Unicode character to local environment encoding
Example 1
HAI 1.2
CAN HAS STDIO?
VISIBLE "HAI WORLD!"
KTHXBYE
Example 2
HAI 1.2
CAN HAS STDIO?
PLZ OPEN FILE "LOLCATS.TXT"?
AWSUM THX
VISIBLE FILE
O NOES
INVISIBLE "ERROR!"
KTHXBYE
In this example, commands to open a file (
PLZ OPEN FILE "NAME"?
—"Please open this file?"), and
error handling
In computing and computer programming, exception handling is the process of responding to the occurrence of ''exceptions'' – anomalous or exceptional conditions requiring special processing – during the execution of a program. In general, a ...
(
AWSUM THX
—"Awesome, thanks!", and
O NOES
—"Oh no!") are introduced.
Example 3
Other commands include
I HAS A ''variable''
for declaring variables,
''variable'' R ''value''
("variable
s/are/beingvalue") 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''
(inspired by the "Im in ur ''noun'', ''verb''ing 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
Example 4
HAI 1.0
CAN HAS STDIO?
VISIBLE "U SEE THIS"
BTW VISIBLE "U SEE NOTHING"
OBTW
VISIBLE "U SEE NOTHIN"
VISIBLE "U STIL SEE NOTHIN"
TLDR
VISIBLE "U SEE THIS"
KTHXBYE
The above example will return the following:
U SEE THIS
U SEE THIS
This is because line 3 outputs
U SEE THIS
but line 5 is ignored due to the fact that it is commented out by the
BTW
keyword. Lines 8 and 9 aren't run because they are in a multiline comment that starts in line 7, and ends on line 10. Line 12 outputs
U SEE THIS
and line 13 terminates the program.
Implementations
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.
The first LOLCODE implementation was a
PHP
PHP is a general-purpose scripting language geared towards web development. It was originally created by Danish-Canadian programmer Rasmus Lerdorf in 1993 and released in 1995. The PHP reference implementation is now produced by the PHP Group. ...
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
PechaKucha (Japanese: ぺちゃくちゃ, IPA: etɕa kɯ̥tɕa ''chit-chat'') is a storytelling format in which a presenter shows 20 slides for 20 seconds per slide. At a PechaKucha Night, individuals gather at a venue to share personal presenta ...
presentation at PHP Works 2008 was about this parser.
There is a
.NET
The .NET platform (pronounced as "''dot net"'') is a free and open-source, managed code, managed computer software framework for Microsoft Windows, Windows, Linux, and macOS operating systems. The project is mainly developed by Microsoft emplo ...
compiler for LOLCODE written by Nick Johnson, and featured in
Microsoft
Microsoft Corporation is an American multinational corporation and technology company, technology conglomerate headquartered in Redmond, Washington. Founded in 1975, the company became influential in the History of personal computers#The ear ...
developer training seminars, TechEd 2007 Conference (Australia).
PL/LOLCODE, a project headed by Josh Tolley, makes LOLCODE available as a server-side programming language inside PostgreSQL.
Microsoft
Microsoft Corporation is an American multinational corporation and technology company, technology conglomerate headquartered in Redmond, Washington. Founded in 1975, the company became influential in the History of personal computers#The ear ...
Dynamic Language Runtime
The Dynamic Language Runtime (DLR) from Microsoft runs on top of the Common Language Runtime (CLR) and provides computer language services for dynamic languages. These services include:
* A dynamic type system, to be shared by all languages using ...
has an implementation of LOLCODE for testing purposes.
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.
A LOLCODE to
JavaScript
JavaScript (), often abbreviated as JS, is a programming language and core technology of the World Wide Web, alongside HTML and CSS. Ninety-nine percent of websites use JavaScript on the client side for webpage behavior.
Web browsers have ...
translator is also available.
There is also a LOLCODE compiler included with the
Parrot virtual machine
Parrot is a discontinued register-based process virtual machine designed to run dynamic languages efficiently. It is possible to compile Parrot assembly language and Parrot intermediate representation (PIR, an intermediate language) to Parr ...
as one of the languages demonstrating the use of Parrot's compiler tools.
A compiler, virtual machine and debugger, created by Piper, for a LoLCode like language, LoLCode 1337, written in C.
A version for parallel and distributed computing can be found.
Related projects
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.
ArnoldC is an offshoot of LOLCODE that replaces lolspeak with quotes from different
Arnold Schwarzenegger
Arnold Alois Schwarzenegger (born July30, 1947) is an Austrian and American actor, businessman, former politician, and former professional bodybuilder, known for his roles in high-profile action films. Governorship of Arnold Schwarzenegger, ...
movies.
References
External links
*
Esoteric programming languages
Lancaster University
Programming languages created in 2007
Science and technology in Lancashire
{{Esoteric programming languages