Omgrofl
Omgrofl is an esoteric programming language created in 2006 by Juraj Borza. It is equipped with a stack/queue, has support for byte-sized variables and keywords resembling Internet slang. The name comes from combining the slang "words" omg and rofl. Rofl is actually one of Omgrofl's commands.
Syntax
- Omgrofl programs consist of statements, that are written on separate lines.
- Each command denotes a type of statement.
- Some statements may also contain conditions or expressions.
- An expression is a variable or a number.
- Indentation is optional, it may improve code readability.
- If there are two statements on one line, the second is ignored.
- Empty lines are ignored.
- Omgrofl is not case-sensitive, thus lol is the same as LoL. You may use this to produce nicer code.
Variables
The programmer may use variables in Omgrofl. These must be a form of the slang word lol, like lol, lool, loool, looool, etc.
A variable can be defined as:
lol iz 4
This statement creates a new variable named lol, assigning the value 4 to it.
Statements
Conditionals
wtf condition – is a conditional statement (like if in C).
The statements until the matching brb are executed only if the condition is true.
Usage:
lol iz 1 wtf lol iz liek 1 rofl lol lmao lol brb
Possible conditions are:
iz uber – checks if one expression is greater than another.
usage:
x iz uber y
iz liek - checks if two expressions are equal.
These may be modified by:
nope – negation (like ! in C) - needs to be placed in front of liek or uber.
usage:
x iz nope uber y lol iz nope liek 7
Loops
rtfm – begins a loop.
The statements between rtfm and the matching brb are repeated indefinitely. Thus, a loop must be broken with tldr.
Example:
rtfm lol iz 64 brb
4 variable iz initial-value 2 end-value - begins a "for" loop.
The variable is set to the initial-value, and then the statements between the 4 statement and the matching brb are repeated until the variable reaches the end-value. The initial-value and end-value are evaluated only once.
Usage:
4 variable iz initial-value 2 end-value w00t some code brb
If the initial-value is lower than end-value the variable is increased by 1 after each iteration. If the initial-value is greater than end-value the variable is decreased by 1 after each iteration. If the initial-value equals the end-value the body of the loop executes exactly once. The variable may be modified inside the loop.
tldr – breaks a loop – like break in C. May only be placed between rtfm and brb or between a 4 statement and brb.
I/O
stfw x – reads a value into x. A byte character is read from standard input, and its value is stored into x, like in brainfuck.
rofl x – prints out the value of x as a byte character. Also like in brainfuck.
Stack/Queue
The stack/queue is one data structure that acts as a stack and a queue simultaneously, aka. an input-restricted (as there is no way to push to the back of the queue) deque.
n00b x – pushes x onto the stack / enqueues x.
l33t x – pops a value from the stack and stores it into x. If the stack/queue is empty, 0 is stored into x.
haxor x - dequeues a value. If the stack/queue is empty, 0 is stored into x.
Misc
stfu – exits application immediately. It is unnecessary at the end of the program, use it only when you want to terminate the execution of the program in another place (like exit in C.)
brb – serves as end in Pascal, } in C. See wtf or rtfm.
afk x – pauses the program execution for x milliseconds.
Usage:
loool iz 255 afk loool
pauses the execution for 255 milliseconds.
variable iz x – is assignment – like = in C.
w00t – starts a comment, characters after w00t until the end of the line are treated as a comment (like // in C).
Variable manipulation
lmao x – increments x by one.
roflmao x – decrements value of x by one.
x to /dev/null – clears x.
lol to /dev/null lol iz 0
do the same thing.
Computational class
Because Omgrofl has a queue (which can act like a Turing machine's tape), it is Turing-complete.
Examples
Hello, World!
w00t a Hello, World! program by poiuy_qwert lol iz 72 rofl lol lol iz 101 rofl lol lol iz 108 rofl lol rofl lol lool iz 111 rofl lool loool iz 44 rofl loool loool iz 32 rofl loool loool iz 87 rofl loool rofl lool lool iz 114 rofl lool rofl lol lol iz 100 rofl lol lol iz 33 rofl lol stfu
Addition of two numbers
Only a code snippet:
- lol is the first number (addend).
- lool is the second number (addend).
- We want to add these two numbers together and store the result in loool without losing the values of lol and lool.
loool iz lol looooool iz lool rtfm wtf looooool iz liek 0 tldr brb lmao loool roflmao looooool brb
The same code in C:
uint8_t loool = lol;
uint8_t looooool = lool;
while (true)
{
if (looooool == 0)
break;
loool++;
looooool--;
}
FizzBuzz
For the numbers 1 to 100
w00t An Omgrofl FizzBuzz program by Adam Soutar
w00t The fist/only one in the world? Maybe?
4 lol iz 1 2 100
lool iz lol
loool iz 0
looool iz 48
rtfm
wtf lool iz nope uber 9
tldr
brb
lmao loool
loooool iz 10
rtfm
wtf loooool iz liek 0
tldr
brb
roflmao loooool
roflmao lool
brb
brb
rtfm
wtf looool iz liek 0
tldr
brb
lmao lool
roflmao looool
brb
looool iz 48
rtfm
wtf looool iz liek 0
tldr
brb
lmao loool
roflmao looool
brb
looooool iz lol
loooooool iz 3
loooooooool iz 0
rtfm
roflmao loooooool
wtf looooool iz nope uber loooooool
lmao loooooool
tldr
brb
lmao loooooool
looooooool iz loooooool
rtfm
wtf looooooool iz liek 0
tldr
brb
roflmao looooool
roflmao looooooool
brb
wtf looooool iz liek 0
loooooooool iz 1
tldr
brb
brb
wtf loooooooool iz liek 1
looooooooooooooooooooool iz 70
rofl looooooooooooooooooooool
looooooooooooooooooooool iz 105
rofl looooooooooooooooooooool
looooooooooooooooooooool iz 122
rofl looooooooooooooooooooool
rofl looooooooooooooooooooool
brb
looooool iz lol
loooooool iz 5
looooooooool iz 0
rtfm
roflmao loooooool
wtf looooool iz nope uber loooooool
lmao loooooool
tldr
brb
lmao loooooool
looooooool iz loooooool
rtfm
wtf looooooool iz liek 0
tldr
brb
roflmao looooool
roflmao looooooool
brb
wtf looooool iz liek 0
looooooooool iz 1
tldr
brb
brb
wtf looooooooool iz liek 1
looooooooooooooooooooool iz 66
rofl looooooooooooooooooooool
looooooooooooooooooooool iz 117
rofl looooooooooooooooooooool
looooooooooooooooooooool iz 122
rofl looooooooooooooooooooool
rofl looooooooooooooooooooool
brb
wtf loooooooool iz liek 0
wtf looooooooool iz liek 0
rofl loool
rofl lool
brb
brb
looooooooooooooooooooool iz 10
rofl looooooooooooooooooooool
brb
External resources
- Omgrofl website (from the Wayback Machine; retrieved on 16 January 2007)
- Omgrofl Code Converter - A tool to convert Omgrofl code into Javascript & PHP. (dead link)
- Brainfuck 2 Omgrofl Converter (dead link)
- Omgrofl Interpreter in Java
- Omgrofl Interpreter in Rust
- Urban Dictionary - a handy resource for understanding internet slang and Omgrofl keywords.
- a Vim syntax file for Omgrofl