Lovelang is a C-based interpreted language with desi human-style phrases.
YouTube: https://www.youtube.com/@clixiya
This README documents the streamlined language surface currently enabled in this repo.
npm install -g lovelang-runtime
lovelang --help
lovelang /full/path/to/lovelang/examples/01-romantic-hello.loveBuild from source (optional):
git clone https://github.com/clixiya/lovelang
cd lovelang
make
./lovelang examples/01-romantic-hello.loveDebug helpers:
./lovelang examples/01-romantic-hello.love --tokens
./lovelang examples/01-romantic-hello.love --debug-love
./lovelang examples/01-romantic-hello.love --mode=shayariyaad name hai "jaan"
vada promise hai "forever"
baby bolo naa "hello"
typing...
agar name barabar hai "jaan" toh
bolo "welcome"
warna
bolo "offline"
bas itna hi
love you baby byeee
- Mutable declarations:
yaad,yaad_karo - Immutable declaration:
vada - Output statements:
bolo,typing - Conditionals:
agar/bewafawithye_karo/vo_karo - Loops:
jabtak,intezaar - Functions:
dhadkan,ehsaas - Blocks:
festival - Stop call:
love_byeee()and aliaslove_you_baby_byeee()
Runtime value types:
intbool(sach,jhooth)stringlistmapnull
Preprocessor runs before lexing/parsing and normalizes these forms:
baby bolo na <expr>->bolo <expr>baby bolo naa <expr>->bolo <expr>baby_bolo_na <expr>->bolo <expr>baby_bolo_naa <expr>->bolo <expr>baby yad rakho <name ...>->vada <name ...>baby yaad rakho <name ...>->vada <name ...>baby_yad_rakho <name ...>->vada <name ...>baby_yaad_rakho <name ...>->vada <name ...>yaad karo <name ...>->yaad_karo <name ...>pucho <prompt>->dil_se_pucho(<prompt>)dil se pucho <prompt>->dil_se_pucho(<prompt>)thoda ruko <ms>->thoda_ruko(<ms>)typing...->typinglove you baby bye...->love_byeee()
Natural flow aliases are also kept:
agar <cond> toh->agar (<cond>) ye_karo {bewafa <cond> toh->bewafa (<cond>) ye_karo {jabtak <cond> tab tak->jabtak (<cond>) ye_karo {intezaar <cond> tab tak->intezaar (<cond>) ye_karo {warna->} vo_karo {warna agar <cond> toh-> else-if expansionbas itna hi-> closes natural blocks
One-liner form:
sun na agar <cond> toh <then_stmt> warna <else_stmt>
yaad count = 0
yaad_karo score hai 10
vada badge hai "gold"
count hai count milan 1
Notes:
vadais immutable.- Reassigning a
vadavariable is a runtime error. name hai expris accepted as assignment whennameis not a reserved keyword.
bolo "hello"
bolo 42
typing...
typing prints a typing indicator line.
Lovelang includes interactive and utility built-ins:
dil_se_pucho(prompt?):- reads one line from stdin
- returns string
- alias:
input(prompt?)
kismat(min, max):- random integer in inclusive range
lafz_len(value):- string length of value (after text conversion)
lambai(value)/len(value):- length for
string,list, andmap
- length for
abhi_time():- current unix timestamp (seconds)
thoda_ruko(ms):- pause execution for milliseconds
Example:
bolo "naam batao"
yaad name hai dil_se_pucho("> ")
yaad lucky hai kismat(1, 100)
yaad chars hai lambai(name)
yaad now hai abhi_time()
bolo "hey " milan name
bolo "lucky: " milan lucky
bolo "length: " milan chars
bolo "time: " milan now
thoda_ruko(700)
bolo "done"
List built-ins:
list_nayi()/pyaar_list()-> creates empty listlist_daal(list, value)/pyaar_daal(list, value)-> append item, returns new lengthlist_nikaal(list)-> pops last item (errors on empty list)list_lao(list, index)-> reads item at index (errors if out of range)list_set(list, index, value)-> updates item at index, returnssach/jhooth
Map built-ins:
map_naya()/raaz_map()-> creates empty mapmap_set(map, key, value)-> sets key, returnssachmap_get(map, key)-> returns value ornullmap_has(map, key)-> returnssach/jhoothmap_keys(map)-> returns list of keys
Notes:
- map keys are converted to string internally.
- printing list/map values uses readable forms like
[a, b]and{key: value}.
lafz_trim(value)lafz_lower(value)lafz_upper(value)lafz_contains(text, needle)lafz_replace(text, from, to)lafz_split(text, sep)-> listlafz_join(list, sep)-> string
Example:
yaad names hai list_nayi()
list_daal(names, "clixiya")
list_daal(names, "rani")
bolo lafz_join(names, ", ")
yaad text hai " PyAr Se "
bolo lafz_trim(text)
bolo lafz_lower(text)
bolo lafz_upper(text)
bolo lafz_replace("i love code", "love", "adore")
type_of(value)/kya_type(value)->int,bool,string,list,map, ornullto_text(value)/text_banao(value)-> string formto_int(value)/int_banao(value)-> integer formto_bool(value)/bool_banao(value)-> truthy/falsey conversion
Modules are preprocessed before lex/parse:
import "path/to/file.love"inlines the target source.- relative paths resolve from the importing file location.
- each file is imported only once per run (deduped).
exportis accepted and stripped (useful for readable module files).
Example:
import "modules/romantic_utils.love"
bolo greet("Clixiya")
bolo greet("Clixiya", mood = "shayari", punct = "...")
dil_khol_ke_padho(path)/file_padho(path)-> read full file textishq_likhdo(path, text)/file_likho(path, text)-> overwrite file, returnssach/jhoothishq_joddo(path, text)/file_jodo(path, text)-> append file, returnssach/jhoothraasta_hai_kya(path)/file_hai_kya(path)-> existence check
Example:
yaad note_file hai "examples/test/module_note.txt"
ishq_likhdo(note_file, "line1")
ishq_joddo(note_file, "\nline2")
bolo raasta_hai_kya(note_file)
bolo dil_khol_ke_padho(note_file)
Core style:
agar (count > 0) ye_karo {
bolo "positive";
} vo_karo {
bolo "zero or negative";
}
Natural style:
agar count bada hai 0 toh
bolo "positive"
warna
bolo "zero or negative"
bas itna hi
yaad i hai 0
intezaar i chhota hai 3 tab tak
bolo i
i hai i milan 1
bas itna hi
Loop guard triggers after 1,000,000 iterations.
dhadkan greet(name, mood = "romantic", punct = "!") {
ehsaas mood milan ": " milan name milan punct
}
bolo greet("baby")
bolo greet("baby", mood = "shayari")
bolo greet("baby", mood = "toxic", punct = "...")
ehsaas is valid only inside dhadkan.
Notes:
- function params can have defaults (
name = exprorname hai expr). - calls support named arguments (
fn(x = 1, y = 2)). - unknown named args or too many positional args produce runtime errors.
festival diwali {
bolo "lights";
}
At runtime it prints festival mode: <name> and executes the block.
Supported:
love_byeee()love_you_baby_byeee()- human phrase
love you baby bye...
Behavior:
- prints farewell (mode-based tone)
- stops execution of remaining statements
Symbol operators:
- Arithmetic:
+ - * / % - Compare:
== != < <= > >= - Logical:
&& || !
Word operators:
- Arithmetic:
milan,doori,intense,divide - Compare:
barabar hai,same hai,equal hai,alag hai,chhota hai,bada hai,chhota ya barabar hai,bada ya barabar hai - Logical:
aur,ya,nahi
// line comment
# line comment
~~ line comment
baby ignore karo natural comment
/* block comment */
These are intentionally not part of the current syntax:
- old mutable keywords:
dil,mood,junoon - old const keyword:
ishq - old output family:
babu_miss_you,shayarana,status,last_seen,seen,auto_reply,gaana - removed built-ins:
chai_break,date_plan
If these appear in source now, parser reports an unknown statement.
lovelang <file.love> [--tokens] [--mode romantic|toxic|shayari] [--debug-love]
--tokens: print token stream after preprocessing--mode: output tone mode--debug-love: print variable set/update logs
include/love.h: token/AST declarationssrc/main.c: CLI and preprocessorsrc/lexer.c: tokenizersrc/parser.c: parsersrc/runtime.c: execution engineexamples/*.love: runnable programsexamples/modules/*.love: module import demosextension/: VS Code syntax + snippets + hovers + run command + settings webviewCATALOG.md: quick file catalog for the projectLICENSE: project license
Q: Is this still interpreted?
A: Yes. Pipeline is: file read -> preprocess (human phrase normalization) -> lex -> parse -> runtime execute.
Q: Can I mix natural and core syntax?
A: Yes, that is the intended workflow.
Q: How do modules work?
A: Use import "path.love". Imports are resolved relative to the current file and each imported file is included once. export is optional and helps mark reusable declarations.
Q: Does love you baby byeee stop execution?
A: Yes. It normalizes to love_byeee() and sets runtime stop flag.