Package Exports
- thenga-lang
- thenga-lang/src/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (thenga-lang) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
๐ฅฅ Thenga Lang
Malayalam Programming Language with Movie Meme Vibes
Thenga Lang is a fun, lightweight programming language inspired by Malayalam language and Malayalam movie culture. Built with Node.js, it brings the flavor of Kerala to programming!
๐ Features
- Malayalam Syntax: Write code in Malayalam-inspired keywords
- Movie References: Special functions inspired by iconic Malayalam movie dialogues
- Full-Featured: Variables, functions, loops, conditionals, error handling
- Interactive REPL: Test your code instantly
- npm Installable: Easy to install and use
- Lightweight: Fast and efficient interpreter
๐ฆ Installation
From Source (Development)
# Clone the repository
git clone <your-repo-url>
cd thenga-lang
# Install dependencies
npm install
# Link globally for testing
npm link
# Now you can use 'thenga' command anywhere
thenga --versionFrom npm (After Publishing)
npm install -g thenga-lang๐ฎ Usage
Run a file
thenga run myfile.thengaStart REPL
thenga replShow examples
thenga examplesDebug tools
# Show tokens
thenga tokenize myfile.thenga
# Show AST
thenga parse myfile.thenga๐ Syntax Guide
Variables
ith_aan x = 10; // Variable declaration
ith_fixed_aan PI = 3.14; // Constant declarationData Types
sheriya // true
sheriyalla // false
onnum_illa // nullOutput/Input
para("Hello!"); // Print
chodhik("Your name?"); // Input (returns string)
enthada_ith(x); // Debug print with type info
kett_paranju("Warning!"); // Warning messageConditionals
seriyano(x velliya 5) { // if (x > 5)
para("Big number");
} allelum(x same_aano 5) { // else if (x == 5)
para("Equal to 5");
} allengil { // else
para("Small number");
}Loops
// For loop - repeat 5 times
repeat_adi(5) {
para(i); // i is auto-available (0 to 4)
}
// While loop
ith_aan count = 0;
odi_repeat_mwone(count cheriya 5) {
para(count);
count = count + 1;
}
odaruth_mone; // break
vitt_kala; // continueFunctions
pani greet(name) { // Function declaration
thirich_tha("Hello " + name); // return
}
ith_aan result = greet("Mone");
para(result);Arrays
ith_aan numbers = [1, 2, 3, 4, 5];
para(numbers[0]); // Access element
para(length(numbers)); // Get lengthObjects
ith_aan person = {
name: "Rajesh",
age: 30
};
para(person.name); // Access property
person.age = 31; // Modify propertyMath Operations
koottu(a, b) // Add
kurakku(a, b) // Subtract
gunikku(a, b) // Multiply
harikku(a, b) // Divide
random() // Random number (0-1)
// Regular operators also work
ith_aan sum = 10 + 5;
ith_aan product = 10 * 5;String Operations
join_pannuda(arr, sep) // Join array to string
split_pannuda(str, sep) // Split string
trim_pannuda(str) // Trim whitespace
kooti_vekkada(str1, str2) // Concatenate stringsComparison Operators
same_aano // ==
bilkul_same // ===
velliya // >
cheriya // <
velliyathum_same // >=
cheriyathum_same // <=
vendathilla // !=Logical Operators
pinnem // &&
allel // ||
onnum_venda // !Error Handling
try_cheyth_nokk {
theri_vili("Error message"); // throw
} pidikk(error) {
para("Caught: " + error);
} ettavum_avasanam {
para("Finally block");
}Special Functions (Movie References!)
nee_po_mone_dinesha(x); // Delete variable (CID Moosa ref)
adipoli_aan(condition); // Assert - throws if false
ner_aano_mwone(x); // Check if truthy
ithenthonn(x); // typeof
copy_adi(x); // Deep copy
aalu_sheri_aano(obj); // Validate object (not null/empty)
scene_idd(1000); // Sleep/wait (milliseconds)
chumma_iri_mone; // Pass/no-op statementComments
// ingane aan This is a single-line comment
/* pand_oru_katha_undayirunu...
This is a multi-line comment
(Once upon a time there was a story...)
*/๐ Example Programs
Hello World
para("Enthaada mone!");Fibonacci Sequence
pani fibonacci(n) {
seriyano(n cheriyathum_same 1) {
thirich_tha(0);
}
seriyano(n same_aano 2) {
thirich_tha(1);
}
thirich_tha(fibonacci(n - 1) + fibonacci(n - 2));
}
repeat_adi(10) {
para("F(" + i + ") = " + fibonacci(i + 1));
}Prime Number Checker
pani is_prime(n) {
seriyano(n cheriyathum_same 2) {
thirich_tha(sheriyalla);
}
ith_aan i = 2;
odi_repeat_mwone(i cheriya n) {
seriyano((n % i) same_aano 0) {
thirich_tha(sheriyalla);
}
i = i + 1;
}
thirich_tha(sheriya);
}
para(is_prime(17)); // sheriya๐ฏ REPL Commands
When using thenga repl:
help- Show help messageclear- Clear screenexitorquit- Exit REPL- Type any Thenga code and press Enter to execute
๐๏ธ Architecture
thenga-lang/
โโโ src/
โ โโโ lexer/
โ โ โโโ tokens.js # Token definitions
โ โ โโโ lexer.js # Lexical analyzer
โ โโโ parser/
โ โ โโโ ast.js # AST node definitions
โ โ โโโ parser.js # Parser
โ โโโ interpreter/
โ โ โโโ interpreter.js # Interpreter/Executor
โ โโโ index.js # Main API
โโโ bin/
โ โโโ thenga.js # CLI tool
โโโ examples/ # Example programs
โโโ tests/ # Test files๐งช Testing
Create a test file test.thenga:
para("Testing Thenga Lang!");
ith_aan x = 42;
adipoli_aan(x velliya 0);
para("Test passed!");Run it:
thenga run test.thengaMade with โค๏ธ and ๐ฅฅ by Malayalam developers, for Malayalam developers!
Enth parayanam... Start coding in Malayalam, mone! ๐