LukeLang is a human-friendly programming language that reads like conversation and compiles to modern JavaScript. Its goal: be easier than Python while feeling expressive and fun, yet powerful enough for real-world programming.
This README serves as the authoritative language guide and syntax reference.
- Install Node.js (v16+ recommended).
- Run a Luke file:
node luke.js SHOW examples/hello.luke. - Or transpile and run directly:
node main.js SHOW examples/hello.luke.
- Conversational keywords with friendly synonyms.
- Minimal punctuation; words over symbols.
- Clear OOP with private fields, inheritance, and unique, brand-specific keywords.
- Seamless interop: compiles 1:1 to readable JavaScript.
- Comments:
// anything(regular JS comments work in Luke files too). - Program markers (optional):
LET'S START/GET OUTTA HERE. - Variables:
- Declare:
MY NAME IS count SET TO 0orMY NAME IS count. - Assign:
SET count TO 10.
- Declare:
- Strings:
- Wordy literal:
SPEAK Hello Worldbecomesconsole.log("Hello World")automatically. - Quoted block:
QUOTE multi line END QUOTE
- Wordy literal:
- Lists:
- Literal:
MAKE LIST WITH 1, 2, 3→[1, 2, 3]. - Indexing:
ITEM AT 2 OF nums→nums[2]. - Property access:
OFor dot:OF obj GET name→obj.name.
- Literal:
- Arithmetic and logic:
ADD a AND b→a + b,SUBTRACT a AND b→a - b.AND,OR,NOTmap to&&,||,!.
- Define:
THIS IS FUNCTION add WITH a, b DO…END FUNCTION.- Synonyms:
MAKE FUNCTION,RECIPE.
- Call:
- Conversational:
ASK calculator TO add WITH 2, 3. - Dot:
calculator.add(2, 3).
- Conversational:
- Return:
GIVE BACK result(alsoSEND BACK,HAND BACK).
- Define:
THIS IS CLASS Animal DO…END CLASS.- Synonyms:
MAKE CLASS,BLUEPRINT,CLASS.
- Inheritance:
FROM,EXTENDS,:and the brand aliasFOLLOWS.- Example:
BLUEPRINT Dog FOLLOWS Animal DO.
- Constructor:
WHEN BORN WITH name DO…END BORN.- Synonyms:
BORN,MAKE ONE,INIT,CONSTRUCTOR,BEGIN,CREATE. SELFmaps tothis.- If a class
FOLLOWSa parent, asuper(...)call is automatically inserted with inferred args; you can also call it manually (see below).
- Private fields (true JS
#fields):PRIVATE secretNameorSECRET secretName→#secretName;.- Initialized:
HAS age SET TO 10. - Bare declaration:
HAS sound.
- Public method:
METHOD speak WITH text DO…END METHOD.- Synonyms:
ACTION,TRICK,ABILITY.
- Private method (brand):
PRIVATE METHOD whisper WITH msg DO…END METHOD.- Also:
SECRET METHOD .... Compiles to#whisper(...)and calls within class becomeSELF.#whisper(...)automatically.
- Call parent method inside a method (brand):
CALL PARENT speak WITH textorCALL SUPER speak WITH text.- Compiles to
super.speak(text).
- Static field:
ALWAYS HAS population SET TO 0(alsoETERNAL,FOREVER).- Compiles to
static population = 0;.
- Static method:
ALWAYS METHOD count WITH a DO…END METHOD.- Compiles to
static count(a) { ... }.
- Define a contract:
CONTRACT Walkable DO MUST METHOD walk WITH speed END CONTRACT - Implement contracts in a class:
BLUEPRINT Robot FOLLOWS Machine IMPLEMENTS Walkable DO.- Synonyms for
IMPLEMENTS:COMPLIES WITH,AGREES TO,ADHERES TO.
- Compliance checks:
- The transpiler emits a static check that throws an error if required methods are missing.
NEW,CREATE,MAKE OBJECT→new.- With arguments:
NEW Dog WITH "Rex"→new Dog("Rex").
- Conversational:
ASK buddy TO speak WITH "Hi"→buddy.speak("Hi").DO speak OF buddy WITH "Hi"→buddy.speak("Hi").
- Dot notation:
buddy.speak("Hi")(direct dot calls are preserved).
SPEAK message,YELL message,SHOUT message,SAY message→console.log(message).- Wordy lines without punctuation are auto-quoted in
SPEAK.
BLUEPRINTfor class,WHEN BORNfor constructor.ALWAYS/ETERNAL/FOREVERfor static members.SECRETfor private,CALL PARENTfor super.CONTRACTwithMUST METHODfor interfaces.FOLLOWSas a friendly alias for inheritance.
BLUEPRINT Animal DO
PRIVATE secretName
HAS sound SET TO "..."
WHEN BORN WITH name DO
SET SECRET OF SELF TO name
END BORN
METHOD speak DO
SPEAK sound OF SELF
END METHOD
END CLASS
BLUEPRINT Dog FOLLOWS Animal IMPLEMENTS Walkable DO
HAS sound SET TO "Woof!"
PRIVATE METHOD whisper WITH msg DO
SPEAK "(" AND msg AND ")"
END METHOD
METHOD speak DO
CALL PARENT speak
DO whisper OF SELF WITH "Good boy"
END METHOD
END CLASS
CONTRACT Walkable DO
MUST METHOD walk WITH speed
END CONTRACT
SET buddy TO NEW Dog WITH "Rex"
ASK buddy TO speak
- Protected members are surfaced as
_membernames for now (advisory convention). - Abstract classes/methods are not yet enforced; see roadmap.
- Module system is currently Node.js-based; use multiple
.lukefiles and standard JS imports in the generated code as needed.
ABSTRACT BLUEPRINTandABSTRACT METHODwith compile-time enforcement.SHIELDED(protected) with better runtime checking for subclass access.- Traits/Mixins:
MIXINblocks that merge methods into classes. - Module system with
IMPORT/EXPORTbrand words. - Optional static typing layer with friendly type terms.
LukeLang favors readable words, minimizes punctuation, and provides conversational method calls. With the brand vocabulary (e.g., FOLLOWS, ALWAYS, CONTRACT), it stays distinct yet intuitive. It is simpler than Python for beginners because:
- Clear, word-first syntax for common tasks.
- Dual method-call styles reduce cognitive load.
- Automatic
super(...)insertion reduces boilerplate. - True private fields via JS
#semantics.
Power-wise, LukeLang now supports private fields, inheritance, static members, interfaces with compliance checks, and parent method calls—providing practical “full OOP” capabilities for everyday development.