The following outlines the LOLCODE specification that this parser uses.
LOLCODE Recommendation v1.0 + modifications
- Statements are separated by [\n.]+
- CAN HAS <module/"file">?
- for inclusion/requirement
- GIMMEH [(LINE|WORD|LETTAR)] [OUTTA ]
- with default being LINE and STDIN
- HAI
- KTHXBYE
- only closes HAI and exits with good condition
- DIAF [ []]
- Exits the program (failure)
- Status code:
- Printed to stderr or equivalent:
- BYES [ []]
- KTHX
- is the universal "closing bracket" line
- for any if block, looping block, function, etc... except HAI
- IM IN YR []
- VISIBLE [!]
- prints stuff as minimally as possible and with a newline (unless !)
- I HAS A [ITZ ]
Declare a variable. Auto-recognize the type among:
- NUMBAR (integer, currently)
- YARN (string)
- TROOF (boolean)
- BUKKIT (array)
- MAH !!
-
indexes into the array
- Multiple occurences of this index sub-levels of the array.
- 1 IN MAH 2 IN MAH arr <=> arr[2][1]
- Does NOT expand the size of the array (except as l_value of assignment)
- Throws error/dies on out of bounds?
- LOL R
- Assigns value into l_value specified by var.
- Extends the size of var if necessary
- If no index is specified, applies to all elements? (one by default)
- IZ [?] [(.|\n) YARLY] (.|\n)
(.|\n) [NOWAI (.|\n) ] KTHX
- Conditional syntax. See examples.
- Operators are PREFIX. Everything but NOT is binary.
- Logical/Bitwise operators: (NOT|AND|OR|XOR)
- Comparison operators: (BIGR|SMALR|LIEK) ( [DEN|AN] )
- BTW
- Comment syntax. Runs until end of line. Only valid on its own line.