请输入您要查询的百科知识:

 

词条 LOLCODE
释义

  1. Language structure and examples

     Example 1  Example 2  Example 3 

  2. Implementations

  3. Related projects

  4. References

  5. External links

{{Infobox programming language
| name = LOLCODE
| logo = LOLCode logo.png
| paradigm = esoteric
| year = 2007
| designer = Adam Lindsay
| file_ext = .lol, .lols
| influenced_by = Lolcats
| website ={{URL|http://lolcode.org}}
}}LOLCODE is an esoteric programming language inspired by lolspeak, the language expressed in examples of the lolcat Internet meme.[1] The language was created in 2007 by Adam Lindsay, researcher at the Computing Department of Lancaster University.[2][3]

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.[4]

Language structure and examples

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.[5] Similar code was printed in the Houston Chronicle.[1]

Example 1

HAI 1.2CAN HAS STDIO?VISIBLE "HAI WORLD!"KTHXBYE
Code Comment
HAI [VERSION] 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 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.[6] It is there primarily for verisimilitude—in fact, it is ignored in current implementations of LOLCODE.
VISIBLE [MESSAGE] prints a message to the screen.
KTHXBYE Just as HAI introduces the program, KTHXBYE (which is "K," "THX," and "Bye" all strung together, meaning "OK, thanks, bye") terminates it.

Example 2

HAI 1.2CAN HAS STDIO?PLZ OPEN FILE "LOLCATS.TXT"?    AWSUM THX        VISIBLE FILE    O NOES        INVISIBLE "ERROR!"KTHXBYE

In this example,[5] 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 (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.[7] Loops can also be ended with the conditional IZ command, as demonstrated in the next example.

Example 3

HAI 1.0CAN HAS STDIO?I HAS A VARIM IN YR LOOP   UP VAR!!1   VISIBLE VAR   IZ VAR BIGGER THAN 10? KTHXIM OUTTA YR LOOPKTHXBYE
[5]

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.2CAN HAS STDIO?IM IN YR LOOP UPPIN YR VAR TIL BOTH SAEM VAR AN 10    VISIBLE SUM OF VAR AN 1IM OUTTA YR LOOPKTHXBYE

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.[8]

The first LOLCODE implementation was a PHP parser written by Jeff Jones.[9][10] 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.[11][12]

There is a .NET compiler for LOLCODE written by Nick Johnson,[13] and featured in Microsoft developer training seminars, TechEd 2007 Conference (Australia).[14][15][16]

PL/LOLCODE, a project headed by Josh Tolley, makes LOLCODE available as a server-side programming language inside PostgreSQL.[17]

Microsoft Dynamic Language Runtime has an implementation of LOLCODE for testing purposes.[18]

lolcode-java (A Java grammar / interpreter for the LOLCODE programming language) is a project also available[19] but it appears to not yet be compliant with the version 1.3 specification.

A LOLCODE to JavaScript translator is also available.[20]

There is also a LOLCODE compiler included with the Parrot virtual machine as one of the languages demonstrating the use of Parrot's compiler tools.[21]

A compiler, virtual machine and debugger, created by Piper, for a LoLCode like language, LoLCode 1337, written in C, is [https://sourceforge.net/projects/lolcode-1337/ here][22]

A version for parallel and distributed computing can be found [https://www.parallella.org/2017/04/01/parallel-and-distributed-computing-with-lolcode/ here]. [23]

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.[24]

ArnoldC is an offshoot of LOLCODE that replaces lolspeak with quotes from different Arnold Schwarzenegger movies.[25]

References

1. ^{{cite web | author = Dwight Silverman | title = I'm in ur newspaper writin mah colum | publisher = Chron.com | date = 2007-06-06 | url = http://www.chron.com/disp/story.mpl/business/silverman/4862013.html | accessdate = 2007-06-06 }}
2. ^{{cite web|url=http://www.comp.lancs.ac.uk/department/news.html |title=Computing Department at Lancaster University – News |publisher=Lancaster University, Computing Department |date= |accessdate=2009-06-09|archiveurl=https://web.archive.org/web/20090528151824/http://www.comp.lancs.ac.uk/department/news.html|archivedate=2009-05-28}}
3. ^{{cite news|url=http://edition.cnn.com/2008/TECH/05/01/roflcon/index.html|archiveurl=https://web.archive.org/web/20090430233014/http://edition.cnn.com/2008/TECH/05/01/roflcon/index.html|archivedate=2009-04-30|date=2008-05-01|work=CNN|first=Anne|last=Hammock|title=The new fame: Internet celebrity}}
4. ^{{cite web |author = Arachnid |title = Proof that LOLCode is turing complete:BrainF*** interpreter in LOLCode |url = http://forum.lolcode.com/viewtopic.php?id=51 |publisher = forum.lolcode.com |accessdate = 2008-10-05 |deadurl = yes |archiveurl = https://web.archive.org/web/20070711193759/http://forum.lolcode.com/viewtopic.php?id=51 |archivedate = 2007-07-11 |df = }}
5. ^{{cite web |author = Adam Lindsay |title = LOLCODE main page |publisher = lolcode.com |date = 2007-05-25 |url = http://www.lolcode.com |accessdate = 2007-10-02 |deadurl = yes |archiveurl = https://web.archive.org/web/20071002042159/http://lolcode.com/ |archivedate = 2007-10-02 |df = }}
6. ^{{cite web|url=http://lolcode.com/keywords/can-has|title=keywords:can-has · LOLCODE|accessdate=2008-02-10}}
7. ^{{cite web|url=http://www.sorn.net/~sandyd/blog/lolcode-mono-osx.png |title=SORN.net |accessdate=2007-11-07 |deadurl=no |archiveurl=https://web.archive.org/web/20090216203453/http://www.sorn.net/~sandyd/blog/lolcode-mono-osx.png |archivedate=February 16, 2009 |df= }}
8. ^{{cite web |url=http://lolcode.org/ |title=LOLCODE + lci}}
9. ^{{cite web|url=http://lindsay.at/blog/archive/2007/05/21/lolcode.html#comment853 |title=First Parser Comment |publisher=Lindsay.at |date= |accessdate=2009-06-09}}
10. ^{{cite web|url=http://www.tetraboy.com/lolcode/ |title=Tetraboy's LOLCODE parser |publisher=Tetraboy.com |date= |accessdate=2009-06-09}}
11. ^{{cite web|url=http://www.slideshare.net/Tetraboy/the-best-web-language-lolcode |title="The Best Web Language: LOLCODE" Slides |publisher=Slideshare.net |date= |accessdate=2009-06-09}}
12. ^{{cite web|url=http://phpworks.mtacon.com/|title=PHP Works|publisher=mtacon.com|accessdate=4 November 2014}}
13. ^LOLCODE .NET compiler at Google Code
14. ^TechEd Day 2: Microsoft announces LOLCode support, Long Zheng
15. ^LOLcode in next Visual Studio? For young and funny cats, NetworkWorld.com
16. ^{{cite web |url=http://blip.tv/file/343052 |title=Video of LOLCODE presentation at TechEd 2007 |publisher=Blip.tv |date=2007-08-17 |accessdate=2009-06-09 |deadurl=yes |archiveurl=https://web.archive.org/web/20090205180201/http://blip.tv/file/343052 |archivedate=2009-02-05 |df= }}
17. ^PL/LOLCODE, pgFoundry
18. ^Deep DLR, John Lam and Martin Maly
19. ^{{cite web |url=https://code.google.com/p/lolcode-java/ |title=lolcode grammar interpreter written in Java}}
20. ^{{cite web|url=http://fullvolume.co.uk/static/lolcode/ |title=LolCode |publisher=Fullvolume.co.uk |date= |accessdate=2009-06-09}}
21. ^{{cite web|url=http://lolcode.com/news/lightning-parrot |title=Lightning-Parrot |publisher=lolcode.com |date= |accessdate=2009-06-20}}
22. ^{{cite web |url=https://sourceforge.net/projects/lolcode-1337/ | title=LoLCode 1337 }}
23. ^{{cite web |url=https://www.parallella.org/2017/04/01/parallel-and-distributed-computing-with-lolcode// | title=Parallel and Distributed Computing with LOLCODE }}
24. ^{{cite web|url=http://www.dalkescientific.com/writings/diary/archive/2007/06/01/lolpython.html |title=LOLPython |publisher=Dalkescientific.com |date=2007-06-01 |accessdate=2009-06-09}}
25. ^https://lhartikk.github.io/ArnoldC/

External links

  • {{Official website}}
{{Programming languages}}{{DEFAULTSORT:Lolcode}}

2 : Esoteric programming languages|Programming languages created in 2007

随便看

 

开放百科全书收录14589846条英语、德语、日语等多语种百科知识,基本涵盖了大多数领域的百科知识,是一部内容自由、开放的电子版国际百科全书。

 

Copyright © 2023 OENC.NET All Rights Reserved
京ICP备2021023879号 更新时间:2024/11/18 15:12:09