Java LOLCODE - LOLCODE parser and interpreter (http://lolcode.com/)
Copyright (C) 2007 Brett Kail (bkail@iastate.edu)
http://bkail.public.iastate.edu/lolcode/
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see .
Implementation
--------------
- Specifications
- 1.0 - Fully supported. See section "Specification: 1.0"
- 1.1 - Fully supported. See section "Specification: 1.1"
- 1.2 - Fully supported. See section "Specification: 1.2"
- 1.3 - See section "Specification: 1.3"
- See section "Specification Ambiguities" for this implementation's
resolution of some specification ambiguities.
- Extensions
- See section "Implementation: HAI"
- See section "Implementation: CAN HAS"
- See section "Module: JAVA"
- Compilation
- Java 1.5 is required for the javax.script implementation.
- ICU4J must be present in the lib/ directory. ICU4J is used for named
character support.
- Execution
- Java 1.5 is required.
- ICU4J must be present on the classpath for named character support. If it
is not found at runtime, the implementation gracefully rejects LOLCODE
programs that use named characters.
- Usage
- java -jar build/lolcode.jar FILE
- Simple execution
- java -classpath build/lolcode.jar:icu4j.jar org.stummies.lolcode.Main FILE
- Execution including ICU4j
- See section "TODO" for future enhancement possibilities.
Specification: 1.0
------------------
1. Statements are separated by [\n.]+
2. CAN HAS ?
- See section "Implementation: CAN HAS".
3. GIMMEH
4. HAI
5. KTHXBYE
6. DIAF
7. BYES
8. KTHX
9. IM IN YR
10. VISIBLE [!]
11. I HAS A
- If ITZ is specified, the variable is assigned the specified value.
Otherwise, the variable is assigned NOOB.
12. [## IN MAH]*
- Any expression is allowed rather than just literal NUMBR. If the
expression is not NUMBR or NUMBAR, an exception is thrown.
- If a slot less than 0 is accessed or assigned, an exception is thrown.
- When a variable is expanded, empty slots are set to NOOB.
- If a slot greater than or equal to the size of the BUKKIT is accessed, an
exception is thrown.
13. LOL
- If no index is specified, index 0 is used.
14. IZ
15. Comparison operators
- Operations involving non-NUMBR (including NOOB) result in an exception as
in specification 1.1.
- Operations are evaluated as in specification 1.2.
16. Logical/Bitwise operators
- Operations are evaluated as in specification 1.2.
17. Operators
- Operations involving non-NUMBR (including NOOB) result in an exception as
in specification 1.1.
- Operations are evaluated as in specification 1.2.
- Operator precedence is (highest to lowest):
- TIEMZ, OVARZ
- UP, NERF
- IN MAH
- Comparison
- Logical/Bitwise
Specification: 1.1
------------------
Specification 1.1 is parsed with all operators from specification 1.0.
+ CREATING A LOLCODE FILE
- See section "Implementation: HAI"
+ TYPING AND VARIABLE DECLARATIONS
+ KEYWORDS
+ IDENTIFIERS
+ COMMENTS
- See section "Implementation: OBTW".
+ UNINITIALIZED AND NULL VALUES
+ CONDITIONALS
+ IF-THEN
- IZ from specification 1.0 is supported.
+ SWITCHES
+ INPUT AND OUTPUT
+ ARRAYS AND HASHES
- IN MAH creates BUKKITs as in specification 1.3.
+ GOTO
Specification: 1.2
------------------
+ Formtting
+ whitespace
1. Spaces
- HORIZONTAL TABULATION
- LINE FEED
- VERTICAL TABULATION
- FORM FEED
- CARRIAGE RETURN
- FILE SEPARATOR
- GROUP SEPARATOR
- RECORD SEPARATOR
- UNIT SEPARATOR
- Unicode space character that is not also a non-breaking space
2. Multiple spaces
3. Indentation
4. Commands
5. Newlines (CR, LF, CRLF)
6. Multiple commands (,)
7. Multiple lines (... and u2026)
8. Multiple lines
9. Line continuation and empty lines
10. Empty command continuation
11. Single-line comments
12. Unterminated string literal
+ comments
- See section "Implementation: OBTW".
+ file creation
- See section "Implementation: HAI".
+ Variables
+ scope
- Variables are scoped to their containing statement block. Variables
defined in an O RLY, WTF, or IM IN YR are no longer visible after the
block has closed.
+ naming
+ declaration and assignment
+ Types
+ untyped
- Implicit cast to NUMBR, NUMBAR, or YARN results in an exception.
+ booleans
- WIN is cast to 1, 1.0, and "WIN".
- FAIL is cast to 0, 0.0, and "".
+ numerical types
+ strings
- :{} explicitly casts to YARN.
- :[] is implemented using ICU4J. ICU4J classes must be visible
(i.e., be on the class path).
+ arrays
- There is no support for BUKKIT in specification 1.2.
+ types
+ Operators
+ calling syntax and precedence
+ math
- YARNs are implicitly cast as specified.
- Non-YARNs are implicitly cast to NUMBR or NUMBAR.
+ booleans
- Operands are implicitly cast to TROOF.
+ comparison
- NOOB is equal to NOOB.
+ concatenation
- Operands are implicitly cast to YARN.
+ casting
+ Input/Output
+ terminal-based
- Arguments to VISIBLE and INVISIBLE are explicitly cast to YARN.
+ Statements
+ expression statements
+ assignment statements
+ Flow control
+ if-then
+ case
+ loops
- TIL and WILE expressions are evaluated at the end of the loop only. In
other words, the statements within a loop will execute at least once.
- The variable may be modified in the loop. At the end of the loop
statements, the following statement is executed
R SUM|DIFF OF 1
+ Functions
+ definition
+ returning
+ calling
Specification: 1.3
------------------
Specification 1.3 is an extended version of specification 1.2. It includes
implementations of the mature proposals from 1.3.
+ bukkit
- A new value type FUNCTION is added
+ Prelude
- The expression A can be used anywhere to create NOOB, FAIL, 0,
0.0, "", or an empty BUKKIT.
+ BUKKITs
+ Declaration
+ Old commands in the context of objects
+ Slot access
- "!?", u203d, and u2049 are supported.
- When a FUNCTION slot is accessed, it is called with no arguments.
- A FUNCTION can be called with arguments using the following syntax
(command-break ends all open function calls)
[WIF|OF] [[AN] ][!| MKAY]
- Accessing a slot that does not exist results in an exception.
- If specification 1.0 or specification 1.1 are active, accessing a slot
that does not exist using IN MAH results in NOOB.
+ Scope
- Slot functions declared using HOW DUZ