Post tutorial RSS Lolcode Part 1

this is part 1 of a tutorial I wrote a few years ago on lolcode, which is an esoteric programming language. it is intended for someone with no programming experience.

Posted by on - Basic Other

What is it?
Lolcode is an esoteric programming language.
It is a simple language that at one time had a decent sized community.
That community is now pretty much dead and the language is no longer improved.
This is sad because the language has so much potential, but it makes for a great language to learn to program with.

So how do I do it?
You will need either an interpreter or compiler that is compliant with the 1.2 spec

Hold-up, What?
An interpreter is a program that reads code that you wrote and translates it into an action that the computer can perform during run-time.
A Compiler is a program that does all that converting and then packages it into a standalone file so that you can run your program without needing to have an interpreter, it is also a lot faster because your program does not have to be "translated" as it is running.

Okay so where do I get one, and what was that about 1.2 something or other?
I have had good luck with Interpreters, you can find a good one here:

And the 1.2 thing?
A specification (spec) is just a standardized definition of what the language should include and information about it. lolcode has gone through 1 major spec and is on the second minor revision, there is also an incomplete 1.3 spec but I recommend you stick with 1.2, incomplete = naughty naughty you dirty boy, stay away from there. ;O

What is the point of having a spec?
You need rules to play The Game. ;O
Different interpreters and compilers will "translate" your code in different ways. If you make sure your interpreter of compiler is 1.2 compliant that means that if you type in code that is compliant with the 1.2 spec your program will run just fine. You don't want icky bugs in your program because of a non-standard compiler or interpreter!

Oh Oh I see :O but where do I find the 1.2 spec?
It can be found here:

Okay now I have all the stuff i need, i opened the spec in a tab of a good browser like Firefox, bookmarked it, and downloaded that interpreter, so how do i start programming?
Lets start by making an Example program:


HAI 1.2

lets start by setting up that interpreter, go to the zip file and find the executable file inside, copy it wherever, I put mine on the Desktop
next we will want to associate lolcode files with the interpreter, this just means that we can double click the source code file and it will automatically run it, heres how:
copy that example program i made up there into a blank text file with a text editor like Notepad.
Save the file as .lol (.lol is the standard file extension for lolcode programs)
and set the file type to "All files"
Right click the newly created file and choose properties
Under the General tab you will see the option
Opens with: blahblahblah [change...]
click the change button and then the browse button in the next window, now just find the interpreter wherever you saved it.
Click Apply and then OK.

Okay I did that but whats that program you made do?
Lets start by double clicking it and we can see for ourselves :{D
A Console window should open with the text "NAME:" on the screen
enter your name and press enter
it should return:
"HERRO (the name you entered here)!"
"Press ENTER to continue..." (this line may vary between compilers and interpreters)
If it worked good, if not make sure you set everything up correctly, if you did and it still does not work try contacting me under the CHAT page, I am usually on. (and if i am not you can always leave a message on the forums!)

Thats cool! but how did you do it?
Lets take a look at that spec.
Formating>file creation
It explains that all code is put between HAI and KTHXBYE commands, these define the start and end of a program.
also note that the 1.2 is ignored, you put it in there to signify that your code is 1.2 compliant.
Next up is
Whenever you want to store a value you must first declare the Variable you want to store it to, I created a variable called NAME, we will store the users name in it.
you could now store something to it by saying
NAME R (number or string here)
you can also give a value to a variable as soon as you declare it, this is done with ITZ
I HAS A NAME ITZ (value here)
We want the user to input their name so we will just leave it null for now (nothing assigned to it yet)
Next up is
VISIBLE is the command to output something to the console, you can include multiple things to output and there are some ways to format it, we will want it to say "NAME:(input)"
first thing you will probably notice is the ::, : is used to define some formats, here is a list:
:) represents a newline (\n)
:> represents a tab (\t)
:o represents a bell (beep) (\g)
:” represents a literal double quote (“)
:: represents a single literal colon (:)
note that there are 3 more as well but at least 2 of them are not supported in lolexec, they aren't of major importance so i won't cover them, you can look them up if you want
in the spec.
you will see that :: just means :, this is because : is used for stuff but if you want to literally display :) it would think you meant new line, the extra : tells it that thats not what you want and so it is used to make sure that everything works nice and dandy.
the only other major shocker here is the ! at the end, this just tells it to stay on the same line, normally it will automatically stick a :) on the end of the VISIBLE command
alright so we covered that, next up is the input:
GIMMEH is a simple command, it only will accept one input per command and only a variable
we have a variable don't we? yeah thats right, we called it NAME!
this will cause the program for you to wait until there is input and the enter key is pressed
then it stores the entered stuff into the variable as a YARN (a YARN is a string of characters)
so now we have a YARN called NAME and it has a name stored in it, lets output it!
back to VISIBLE, its the same as before just note that it can do multiple expressions. (we did 3 here) also note that "" defines text, if you don't have "" it will assume its a variable. If you output a variable it will dump the contents of the variable on the screen.
Finally we end the program with KTHXBYE.


This comment is currently awaiting admin approval, join now to view.


This comment is currently awaiting admin approval, join now to view.

Post a comment
Sign in or join with:

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.