7 releases
new 0.1.6 | Mar 3, 2025 |
---|---|
0.1.5 | Mar 3, 2025 |
#710 in Programming languages
188 downloads per month
Used in ilm
43KB
837 lines
📜 IlmLang
IlmLang is a playful, Islamic-themed programming language designed for learning and experimentation. It integrates programming concepts with Islamic terminology, requiring every program to start with bismillah
and end with alhamdulillah
. The language uses Arabic-inspired keywords while maintaining full programming functionality. The file extension is .ilm
, symbolizing "Ilm" (Knowledge).
📌 Tables of Keywords
1. Program Structure
Keyword | Meaning | Equivalent |
---|---|---|
bismillah |
Start of the program (Mandatory) | Program start |
alhamdulillah |
End of the program (Mandatory) | Program end |
2. Variables & Constants
Keyword | Meaning | Equivalent |
---|---|---|
maktub |
Declare a variable (mutable) | let , var |
qadr |
Declare a constant (immutable) | const , final |
hazf |
Delete a variable | del |
tajdid |
Reassign a variable | Assignment (= ) |
3. Input & Output
Keyword | Meaning | Equivalent |
---|---|---|
qawl |
Print output (no newline) | print() , console.log() |
qawl_ |
Print output (with newline) | println() , console.log() + \n |
istima |
Take input from user | input() , scanf() |
kitaba |
Write to a file | write() |
qiraa |
Read from a file | read() |
4. Loops & Iteration
Keyword | Meaning | Equivalent |
---|---|---|
takrar |
Loop (repeat something) | while , for |
khuruj |
Break (exit loop) | break |
istimrar |
Continue execution in loop | continue |
li_kull |
For-each loop | forEach |
5. Conditional Statements
Keyword | Meaning | Equivalent |
---|---|---|
idha |
If condition | if |
aw_idha |
Else if condition | else if |
illa |
Else condition | else |
intikhab |
Switch statement | switch |
hala |
Case in switch | case |
iftiradi |
Default case in switch | default |
khuruj |
Break in switch | break |
6. Functions & Return
Keyword | Meaning | Equivalent |
---|---|---|
wazifa |
Define a function | def , function |
raj |
Return from function | return |
nidaa |
Call a function | Function call |
mukarrar |
Recursive function call | Recursion |
7. Data Types
Keyword | Meaning | Equivalent |
---|---|---|
adad |
Number (integer/float) | int , float |
kalima |
String (text data) | string |
haqq |
Boolean true |
true |
baatil |
Boolean false |
false |
fard |
Single value (scalar) | Scalar type |
8. Success & Errors
Keyword | Meaning | Equivalent |
---|---|---|
mashallah |
Success message | Success message |
inshallah_sabrun |
General error: "Patience, try again" | General error |
astaghfirullah |
Syntax error message | Syntax error |
inna_lillahi |
Runtime error message | Runtime error |
la_hawla |
Null/uninitialized variable error | Null error |
subhanallah |
Unexpected exception | Uncaught exception |
9. Comments
Keyword | Meaning | Equivalent |
---|---|---|
/* tafsir */ |
Multi-line & single-line comments | /* ... */ |
10. Built-in Functions
Keyword | Meaning | Equivalent |
---|---|---|
asghar |
Convert to lowercase | .toLowerCase() |
akbar |
Convert to uppercase | .toUpperCase() |
jam |
Sum of numbers in a list | sum() |
hijri_sana |
Get current Hijri year | getHijriYear() |
taftish |
Check if value exists in list | contains() |
tartib |
Sort a list | sort() |
qis |
Split a string | split() |
ilhiq |
Join strings or lists | join() |
11. Advanced Features
Keyword | Meaning | Equivalent |
---|---|---|
saff |
List (array) | list , array |
idafa |
Append to a list | push() , append() |
istikhraj |
Remove from list | pop() , remove() |
toul |
Length of a list/string | len() , length |
wa |
Boolean logic: "and" | && , and |
aw |
Boolean logic: "or" | ` |
laysa |
Boolean logic: "not" | ! , not |
zawji |
Even number check | is_even() |
fardi |
Odd number check | is_odd() |
baqi |
Divide and return remainder | modulo , % |
miftah |
Dictionary / Object | dict , object |
fath |
Open a resource (file/socket) | open() |
ighlaq |
Close a resource | close() |
sabab |
Try-catch block (try) | try |
istithnaa |
Try-catch block (catch) | catch |
📌 Functionalities with Examples
Below are the key functionalities of IlmLang with examples to demonstrate their usage.
1. Program Structure : Example
Every program must begin with bismillah
and end with alhamdulillah
.
bismillah
qawl("Hello, World!");
alhamdulillah
Output: Hello, World!
2. Variables & Constants : Example
maktub
: Mutable variable declaration.tajdid
: Reassign a variable.qadr
: Immutable constant.
bismillah
maktub x = 5;
tajdid x = 10;
qadr y = 15;
qawl(x + y);
alhamdulillah
Output: 25
3. Input & Output : Example
qawl
: Prints without newline.qawl_
: Prints with newline (\n
is also supported).istima
: Takes user input.
bismillah
maktub name = istima("What is your name? ");
qawl("Assalamu Alaikum, ");
qawl_(name);
qawl("How are you?\nToday is good.");
alhamdulillah
Input: Aisha
Output:
Assalamu Alaikum, Aisha
How are you?
Today is good.
4. Arithmetic & String Interpolation
- Supports arithmetic:
+
,-
,*
,/
,%
(viabaqi
). - String interpolation with
$variable
or${expression}
.
bismillah
maktub a = 4;
maktub b = 5;
qawl_("$a $b"); /* Prints values */
qawl_("${a + b}"); /* Prints sum */
qawl_("${4 * 3}"); /* Prints multiplication */
qawl_("${a - 2}"); /* Prints subtraction */
alhamdulillah
Output:
4 5
9
12
2
5. Loops
takrar
: While loop.li_kull
: For-each loop.
bismillah
maktub i = 0;
takrar (i < 3) {
qawl_(i);
tajdid i = i + 1;
}
saff fruits = ["Tuffah", "Mawz", "Rumman"];
li_kull fruit in fruits {
qawl_(fruit);
}
alhamdulillah
Output:
0
1
2
Tuffah
Mawz
Rumman
6. Conditionals
idha
,aw_idha
,illa
: If-else structure.
bismillah
maktub num = 10;
idha (num > 0) {
qawl_("Positive");
} aw_idha (num < 0) {
qawl_("Negative");
} illa {
qawl_("Zero");
}
alhamdulillah
Output: Positive
7. Functions
wazifa
: Define a function.nidaa
: Call a function.
bismillah
wazifa greet(name) {
raj "Assalamu Alaikum, " + name;
}
qawl_(nidaa greet("Zayd"));
alhamdulillah
Output: Assalamu Alaikum, Zayd
8. Lists & Built-in Functions
saff
: List declaration.idafa
: Append to list.tartib
: Sort list.
bismillah
saff numbers = [3, 1, 4];
idafa numbers 2;
tartib numbers;
qawl_(numbers);
alhamdulillah
Output: [1, 2, 3, 4]
9. Error Handling
sabab
andistithnaa
: Try-catch block.
bismillah
sabab {
maktub x = 5 / 0;
} istithnaa {
qawl_("inna_lillahi");
}
alhamdulillah
Output: inna_lillahi
10. Comments
/* tafsir */
: Single or multi-line comments.
bismillah
/* tafsir: This is a greeting program */
qawl_("Assalamu Alaikum");
alhamdulillah
Output: Assalamu Alaikum
📌 File Extension
.ilm
→ Represents "Ilm" (Knowledge).
Dependencies
~2.2–9.5MB
~91K SLoC