LOLCODE: Difference between revisions
m moved ,H,,,A,,,G,,,G,,,Ĕ,,,R ? to LOLCODE over redirect: Pagemove vandalism cleanup |
Buenotaco55 (talk | contribs) Incorrect creator |
||
Line 6: | Line 6: | ||
| date = [[2007-06-06]] |
| date = [[2007-06-06]] |
||
| url = http://www.chron.com/disp/story.mpl/business/silverman/4862013.html |
| url = http://www.chron.com/disp/story.mpl/business/silverman/4862013.html |
||
| accessdate = 2007-06-06 }}</ref> The language was created in 2007 by |
| accessdate = 2007-06-06 }}</ref> The language was created in 2007 by Benjamin Baer, researcher at the Computing Department of [[Lancaster University]].<ref>[http://www.comp.lancs.ac.uk/department/news.html Lancaster University Computing Department News]</ref> |
||
The language is not clearly defined in terms of operator priorities and correct syntax, but several functioning interpreters and compilers already exist. The language has been proven [[Turing-complete]] by the implementation of a [[Brainfuck]] compiler.<ref>{{cite web |
The language is not clearly defined in terms of operator priorities and correct syntax, but several functioning interpreters and compilers already exist. The language has been proven [[Turing-complete]] by the implementation of a [[Brainfuck]] compiler.<ref>{{cite web |
Revision as of 13:27, 10 November 2008
LOLCODE is an esoteric programming language inspired by the language expressed in examples of the LOLCAT Internet meme.[1] The language was created in 2007 by Benjamin Baer, researcher at the Computing Department of Lancaster University.[2]
The language is not clearly defined in terms of operator priorities and correct syntax, but several functioning interpreters and compilers already exist. The language has been proven Turing-complete by the implementation of a Brainfuck compiler.[3]
Language structure and examples
LOLCODE is written in heavily compressed (shortened) English Internet slang, and a person who understands this slang can often understand a LOLCODE program without prior experience. Here follows a Hello world program and a simple program to output a file to a monitor. Highly accessible, similar code was printed in the Houston Chronicle.[1]
Example 1:
HAI CAN HAS STDIO? VISIBLE "HAI WORLD!" KTHXBYE [4]
Code Comment HAI
In all LOLCODE programs, HAI (an internet slang misspelling of "hi") introduces the program. CAN HAS [FILE]?
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 file is obtainable, obtaining it if possible, and raising an exception if not[5]. It is there primarily for authenticity — in fact, it is ignored in current implementations of LOLCODE. VISIBLE [MESSAGE]
prints a message to the screen. KTHXBYE
HAI
introduces the program, soKTHXBYE
(meaning "Okay — thanks — bye!") terminates it.
Example 2:
HAI CAN HAS STDIO? PLZ OPEN FILE "LOLCATS.TXT"? AWSUM THX VISIBLE FILE O NOES INVISIBLE "ERROR!" KTHXBYE [4]
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, LOL variable R value
("laughter [at] 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 KTHX ("okay-thanks!"). Loops lack counters or conditions, and thus do not cease inherently. They must be manually broken with the GTFO
(deprecated in favor of ENUF
– "enough" in Leetspeak) [6] command. Loops can also be ended with the conditional IZ
command:
Example 3:
HAI CAN HAS STDIO? I HAS A VAR IM IN YR LOOP UP VAR!!1 IZ VAR BIGGER THAN 10? KTHX VISIBLE VAR IM OUTTA YR LOOP KTHXBYE [4]
This simple program displays the numbers 1–10 and terminates (as of specification 1.0). The same program as of specification 1.2 is (assuming VAR starts at 0):
HAI CAN HAS STDIO? IM IN YR LOOP UPPIN YR VAR TIL BOTHSAEM VAR AN 10 VISIBLE SUM OF VAR AN 1 IM OUTTA YR LOOP KTHXBYE
Implementations
There is a .NET compiler for LOLCODE written by Nick Johnson,[7] and featured in Microsoft developer training seminars, TechEd 2007 Conference (Australia).[8][9][10]
PL/LOLCODE, a project headed by Josh Tolley, makes LOLCODE available as a server-side programming language inside PostgreSQL.[11]
Microsoft Dynamic Language Runtime has an implementation of LOLCODE for testing purposes.[12]
References
- ^ a b Dwight Silverman (2007-06-06). "I'M IN UR NEWSPAPER WRITIN MAH COLUM". Chron.com. Retrieved 2007-06-06.
{{cite web}}
: Check date values in:|date=
(help) - ^ Lancaster University Computing Department News
- ^ Arachnid. "Proof that LOLCode is turing complete:BrainF*** interpreter in LOLCode". forum.lolcode.com. Retrieved 2008-10-05.
- ^ a b c Adam Lindsay (2007-05-25). " "LOLCODE main page". lolcode.com. Retrieved 2007-10-02.
{{cite web}}
: Check|url=
value (help); Check date values in:|date=
(help) - ^ "keywords:can-has · LOLCODE". Retrieved 2008-02-10.
- ^ SORN.net
- ^ 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
- ^ PL/LOLCODE, pgFoundry
- ^ Deep DLR, John Lam and Martin Maly