modi-lang
v1.0.0
Published
๐ฎ๐ณ Modi Lang โ The Deshbhakt Programming Language. Mitron, ab coding bhi deshbhakti hai!
Maintainers
Readme
๐ฎ๐ณ Modi Lang
The Deshbhakt Programming Language
"Mitron, ab coding bhi deshbhakti hai!"
Modi Lang is a hilarious, fully functional programming language where every keyword is a famous Modi catchphrase. Write programs that compile your patriotism into actual code! ๐
โโโโ โโโโ โโโโโโโ โโโโโโโ โโโ โโโ โโโโโโ โโโโ โโโ โโโโโโโ
โโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโ โโโ โโโโโโโโโโโโโ โโโโโโโโโโโ
โโโโโโโโโโโโโโ โโโโโโ โโโโโโ โโโ โโโโโโโโโโโโโโ โโโโโโ โโโโ
โโโโโโโโโโโโโโ โโโโโโ โโโโโโ โโโ โโโโโโโโโโโโโโโโโโโโโ โโโ
โโโ โโโ โโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโ โโโโโโ โโโโโโโโโโโโโโโ
โโโ โโโ โโโโโโโ โโโโโโโ โโโ โโโโโโโโโโโ โโโโโโ โโโโโโโโโโโโ ๐ฅ Installation
Quick Install (Recommended)
npm install -g modi-langThat's it! The modi command is now available globally. ๐
One-Line Install Scripts
Windows (PowerShell):
irm https://raw.githubusercontent.com/bishwa100/modi-lang/main/install.ps1 | iexMac / Linux:
curl -fsSL https://raw.githubusercontent.com/bishwa100/modi-lang/main/install.sh | bashVerify Installation
modi --version # Modi Lang v1.0.0 ๐ฎ๐ณ
modi help # Show all commandsUninstall
npm uninstall -g modi-lang๐จ VS Code Extension (IDE Support)
Get full syntax highlighting for .modi files in VS Code!
Install from Source
- Copy the
modi-lang-vscodefolder to your VS Code extensions:- Windows:
%USERPROFILE%\.vscode\extensions\modi-lang - Mac/Linux:
~/.vscode/extensions/modi-lang
- Windows:
- Restart VS Code
- Open any
.modifile โ enjoy colorful syntax! ๐จ
Install from VSIX
cd modi-lang-vscode
npx -y @vscode/vsce package
# Then in VS Code: Ctrl+Shift+P โ "Install from VSIX"Features
- ๐จ Full syntax highlighting for all Modi Lang keywords
- โจ๏ธ Auto-closing brackets and quotes
- ๐ฌ Comment toggling with
Ctrl+/ - ๐
.modifile icon and association - ๐ง Smart indentation
๐ Quick Start
# Create a new project
modi init my-project
cd my-project
# Run the program
modi run main.modi
# Start interactive REPL
modi repl
# Run any .modi file
modi run examples/hello.modi
# Show help
modi help๐ Your First Program
Create a file called hello.modi:
namaste
modi greeting = "Mitron, Bhaiyo aur Behno!";
mann_ki_baat(greeting);
mann_ki_baat("Acche din aane wale hain! ๐");
jai_hindRun it:
modi run hello.modiOutput:
Mitron, Bhaiyo aur Behno!
Acche din aane wale hain! ๐๐ฃ๏ธ Language Reference
Keywords
| What You Want | Modi Lang Says | Why It's Funny |
|---|---|---|
| let / var | modi | Modi creates everything |
| print | mann_ki_baat | He speaks to the nation |
| if | agar_modi | Conditional on Modi's will |
| else | nahi_toh | The alternative |
| else if | warna_modi | Another condition, another promise |
| true | acche_din | Good days = True โจ |
| false | jumla | Jumla = False ๐ |
| while | ghuma_ke | Loops around and around |
| for | sabka_saath | Iterate with everyone |
| function | mitron | Every speech starts with "Mitron..." |
| return | laut_aao | Return home with a value |
| null | nota | None of the Above |
| input | chai_pe_charcha | Take input over chai โ |
| try | modi_hai_toh | Modi hai toh mumkin hai! |
| catch | pakoda | When things go wrong, sell pakodas ๐ณ |
| break | demonetization | Breaks the loop like it broke the economy ๐ธ |
| continue | aage_badho | Skip and move forward |
| == | same2same | Equality check, desi style |
| != | jumla_hai | That's a jumla! |
| AND | aur | And in Hindi |
| OR | ya | Or in Hindi |
| NOT | bilkul_nahi | Absolutely not! |
| // comment | // suno mitron | Listen friends... (ignored) |
๐คฃ Opposition Party Roasts (The Funniest Feature!)
Use opposition party names as constants โ each returns a hilariously fixed value:
| Keyword | Value | The Roast ๐ |
|---|---|---|
| cpim | 0 | Zero seats, zero impact! CPIM = 0, always! ๐ |
| congress | "" (empty) | Empty promises, empty result! Khaali hai! ๐ซ |
| aap | "muft" | Everything is free! Revdi culture! ๐๐ธ |
| tmc | "khela_hobe" | Khela ho raha hai! ๐ |
| rjd | "jungle_raj" | Back to the jungle era! ๐ฟ๐
|
| pappu | nota (null) | Pappu can't pass! ๐โ |
| sp | "cycle" | Cycle chalate raho! ๐ฒ |
| aimim | 1 | Ek hi seat milti hai, always! 1๏ธโฃ๐ค |
| bsp | "haathi" | Elephant walking slow! ๐ |
| jdu | "paltu" | Switches sides every season! ๐๐ฆ |
Example:
// CPIM is always 0 โ use it like a constant!
mann_ki_baat("CPIM seats: " + cpim); // Output: CPIM seats: 0
// Pappu is always null โ can't pass!
agar_modi (pappu) {
mann_ki_baat("Impossible!");
} nahi_toh {
mann_ki_baat("Pappu fail ho gaya!"); // This always runs! ๐
}
// Congress in a condition โ empty = falsy!
agar_modi (congress) {
mann_ki_baat("Never happens!");
} nahi_toh {
mann_ki_baat("Congress khaali hai!"); // Always empty! ๐ซ
}
// Math with opposition
mann_ki_baat(cpim + aimim); // Output: 1 (0 + 1)Program Structure
Every Modi Lang program starts with namaste and ends with jai_hind:
namaste
// your code here
jai_hind(Both are optional but good deshbhakti practice! ๐ฎ๐ณ)
๐ Examples
Variables
modi name = "Mitron";
modi age = 74;
modi is_pm = acche_din;
modi score = nota;Conditions
agar_modi (votes >= 272) {
mann_ki_baat("Majority! ๐");
} warna_modi (votes >= 200) {
mann_ki_baat("Coalition needed! ๐ค");
} nahi_toh {
mann_ki_baat("Opposition mein baitho! ๐ค");
}Loops
// For loop
sabka_saath (modi i = 1; i <= 10; i = i + 1) {
mann_ki_baat(i);
}
// While loop
modi count = 5;
ghuma_ke (count > 0) {
mann_ki_baat("Countdown: " + count);
count = count - 1;
}Functions
mitron add(a, b) {
laut_aao a + b;
}
mann_ki_baat(add(10, 20)); // 30Arrays (Rally)
modi states = ["Gujarat", "UP", "Maharashtra"];
mann_ki_baat(states[0]); // Gujarat
mann_ki_baat(lambai(states)); // 3Try-Catch
modi_hai_toh {
modi x = 10 / 0;
} pakoda (error) {
mann_ki_baat("Error: " + error);
}FizzBuzz โ Modi Edition ๐ช
namaste
sabka_saath (modi i = 1; i <= 30; i = i + 1) {
agar_modi (i % 15 same2same 0) {
mann_ki_baat("๐ Acche Din!");
} warna_modi (i % 3 same2same 0) {
mann_ki_baat("๐ฎ๐ณ Modi!");
} warna_modi (i % 5 same2same 0) {
mann_ki_baat("๐ค Mitron!");
} nahi_toh {
mann_ki_baat(i);
}
}
jai_hindRecursion โ Factorial ๐ฃ๏ธ
namaste
mitron factorial(n) {
agar_modi (n same2same 0) { laut_aao 1; }
laut_aao n * factorial(n - 1);
}
mann_ki_baat("5! = " + factorial(5));
jai_hind๐ค Error Messages (The Best Part!)
Modi Lang doesn't just show errors โ it roasts you:
| Error | Modi Lang Says | |---|---| | Syntax Error | "Mitron, ye kya likh diya? Galat syntax hai! ๐คฆ" | | Undefined Variable | "Ye variable toh Note-bandi mein chala gaya! ๐ธ" | | Division by Zero | "Zero se divide? Ye toh jumla hai mitron! โ๐ซ" | | Type Error | "Chai aur pakoda mix mat karo! ๐ต๐ณ" | | Stack Overflow | "Itna recursion? Modiji bhi thak jayenge! ๐ตโ๐ซ" | | Missing Semicolon | "Digital India mein precision zaroori hai! โจ๏ธ" | | File Not Found | "Shayad Swachh Bharat mein saaf ho gayi! ๐งน" | | Runtime Crash | "BREAKING: Program crashed! Blame it on Congress! ๐" |
๐งฐ Built-in Functions
| Function | Description |
|---|---|
| mann_ki_baat(value) | Print to console |
| chai_pe_charcha(prompt) | Read user input โ |
| lambai(array_or_string) | Get length |
| aankda(value) | Convert to number |
| bhaashan(value) | Convert to string |
| jodo_rally(array, value) | Push to array |
| nikalo(array) | Pop from array |
| type_kya_hai(value) | Get type name |
| split(str, delimiter) | Split string |
| uppercase(str) | To uppercase |
| lowercase(str) | To lowercase |
| abs(value) | Absolute value |
| power(base, exp) | Exponentiation |
| random() / random(min, max) | Random number ๐ฒ |
| floor(value) | Floor |
| ceil(value) | Ceiling |
| round(value) | Round |
๐๏ธ Architecture
Source Code (.modi) โ Lexer (Tokens) โ Parser (AST) โ Evaluator (Execute) โ OutputBuilt as a tree-walking interpreter in Node.js. No external dependencies!
๐ Project Structure
Modi Lang/
โโโ bin/modi.js # CLI entry point (the `modi` command)
โโโ src/
โ โโโ tokens.js # Token types & keywords
โ โโโ ast.js # AST node definitions
โ โโโ lexer.js # Tokenizer
โ โโโ parser.js # Parser
โ โโโ evaluator.js # Interpreter
โ โโโ environment.js # Variable scoping
โ โโโ builtins.js # Built-in functions
โ โโโ errors.js # Funny error messages
โ โโโ repl.js # Interactive REPL
โโโ examples/ # Example .modi programs
โ โโโ hello.modi # Hello World
โ โโโ fizzbuzz.modi # FizzBuzz Modi edition
โ โโโ demo.modi # Full feature demo
โ โโโ ... # Many more examples!
โโโ tests/ # Test suite
โ โโโ test_basic.js # Comprehensive tests
โโโ modi-lang-vscode/ # VS Code extension
โ โโโ syntaxes/ # TextMate grammar
โ โโโ language-configuration.json
โ โโโ package.json
โโโ install.sh # Mac/Linux install script
โโโ install.ps1 # Windows install script
โโโ package.json # npm package config
โโโ LICENSE # MIT License
โโโ README.md๐ ๏ธ CLI Commands
| Command | Description |
|---|---|
| modi run <file.modi> | Run a Modi Lang program |
| modi repl | Start interactive REPL |
| modi init [name] | Create a new Modi Lang project |
| modi help | Show help |
| modi version | Show version |
| modi <file.modi> | Run directly (shorthand) |
๐ค Contributing
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Make your changes
- Run tests:
npm test - Commit:
git commit -m 'Add amazing feature' - Push:
git push origin feature/amazing-feature - Open a Pull Request
๐ฆ Publishing
Publish to npm
npm login
npm publishPublish VS Code Extension
cd modi-lang-vscode
npx -y @vscode/vsce package
npx -y @vscode/vsce publish๐ Disclaimer
This is a satirical/fun project meant purely for entertainment and learning about programming language design. No political affiliation intended โ just good old desi humor! ๐
Jai Hind! ๐ฎ๐ณ
