This interpeter implements a subset of the LOLCODE esoteric programming language, with some modifications. The implemented language features are listed below.
HAI
[...program...]
KTHXBYE
All programs must start with HAI and end with KTHXBYE. Contrary to original specification, there should be no version number after HAI.
I HAS A [variable name] - declare variable (NOOB type and no value)
I HAS A [variable name] ITZ [value] - declare variable with value
I HAS A [variable name] ITZ A [type] - declare variable with type
[variable name] R [expression]
Variables are local to the enclosing function or block. To assignment a value after declaration: [variable name] R [expression]. The RHS expression must resolve to a value of matching type of the declared variable, or any type if the variable is of type NOOB.
NUMBR (integer)
NUMBAR (float) - decimal part is delimited by a dot (.)
YARN (string) - must be quoted in double quotes (")
TROOF (boolean) - TROOF/FAIL
NOOB (undefined)
Type NOOB implicitly casts to zero values. Explicit casting or string escapes are not implemented. Variables are only accessible after declaration. For implicit casting rules, (see spec)
SUM OF [var1] AN [var2]
DIFF OF [var1] AN [var2]
BOTH OF [var1] AN [var2]
EITHER OF [var1] AN [var2]
BIGGR OF [var1] AN [var2]
SMALLR OF [var1] AN [var2]
DIFFRINT [var1] AN [var2]
Operators follow the original specification (see spec).
VISIBLE "Hey"!
VISIBLE "Hello" AN myVariable AN 123!
VISIBLE prints to standard output. Supports infinite arity, and is terminated by the command delimiter ("," or newline). Concatenates all arguments after implicitly casting them to strings. End the last argument with ! to print a newline at the end.
IM IN YR I HAS A count ITZ 0, WILE DIFFRINT count AN BIGGR OF count AN 5
[...code block...]
IM OUTTA YR
Where "I HAS A count ITZ 0" is a variable declaration statement, with TYPE or VALUE of variable specified (see Variables section above). The variable will be declared in the local scope of the loop. See spec for details.
HOW IZ I myFunction YR myArgument
[...code block...]
IF U SAY SO
I IZ myFunction YR "123" MKAY
Functions follow the original specification (see spec).
HAI
HOW IZ I Greet
VISIBLE "HELLO WORLD"!
IF U SAY SO
IM IN YR I HAS A COUNT ITZ 0, WILE DIFFRINT COUNT AN BIGGR OF COUNT AN 5
I IZ Greet MKAY
COUNT R SUM OF COUNT AN 1
IM OUTTA YR
KTHXBYE