Bhai ka apna language. Variables, loops, functions, dictionaries, try/catch — sab kuch, bas English ki jagah Hinglish mein likha jaata hai.
kaam namaste(naam)
wapas `Hanji {naam}, kaise ho?`
band
dikha namaste("duniya")
No compiler, no build step — it's a single-file Python interpreter
(poop.py) that reads a .poop file line by line and runs it.
Just Python 3 (3.8+ is safe). No pip installs, no dependencies. That's it.
Check what you've got:
python3 --version- Write some poop in a file ending in
.poop:
// hello.poop
likh naam = "bhai"
dikha "Kem cho", naam
- Run it with the interpreter:
python3 poop.py hello.poopThat's the whole workflow. poop.py is the entire language — one file,
no install step, no virtual environment needed.
If you want to type poop hello.poop instead of python3 poop.py hello.poop,
drop this in your shell config (.bashrc / .zshrc):
alias poop="python3 /path/to/poop.py"On Linux/macOS you can also make it directly executable:
chmod +x poop.py
./poop.py hello.poop(as long as the first line of poop.py stays #!/usr/bin/env python3,
which it already does)
.
├── poop.py the interpreter — the whole language lives here
├── REFERENCE.md full language reference: every keyword, operator, builtin
├── index.html docs site (just open it in a browser, no server needed)
└── main.poop example program
- Variables, printing, input —
likh,dikha,sun if/elif/else—dekh/warna_dekh/nahi_tohwhileandfor-eachloops —jabtak,har_baar- Functions, including recursion —
kaam/wapas - Lists and dictionaries, with literal syntax (
[...]and{...}) try/catch—koshish/pakad- String interpolation —
`Hello {naam}` - Compound assignment and increment/decrement —
+=,x++ - Importing other
.poopfiles —mangwa - ~35 builtin functions (math, string, list, dict, file I/O)
See REFERENCE.md for the full breakdown with examples of everything above.
poop.py is a tree-walking, line-based interpreter — there's no formal
tokenizer/parser/AST stage. It reads the file into a list of lines, and:
run_block()walks a list of lines and executes them one at a timerun_line()pattern-matches each line's keyword prefix ("dekh ","jabtak ","likh ", etc.) and figures out what to do- Blocks (
if/while/for/functions/try) are found by scanning forward for the matchingband, tracking nesting depth as it goes poop_eval()evaluates any expression (arithmetic, comparisons, function calls, indexing, literals) recursively- Control flow (
wapas,tod_de) is passed back up the call stack as a small dict like{"type": "wapas", "value": ...}— every layer (if, loops,try) checks for this and re-propagates it instead of swallowing it, which is what letswapascorrectly break out of a function even when it's several loops/ifs deep.
It's not fast and it's not "correct" in a formal-language-design sense —
but it's readable, hackable, and every keyword is one if line.startswith(...)
away from being findable in the source. If you want to add a keyword,
that's the pattern to follow.
Say you want to add bol as another way to print. In run_line():
if line.startswith("bol "):
rest = line[4:].strip()
print(poop_eval(rest, {**local_vars}))
returnDrop it in near the other statement handlers, done. No grammar file to regenerate, no parser to rebuild.
- No real operator precedence beyond what Python's
eval()gives you for the arithmetic parts — expressions are mostly evaluated left-to-right by keyword. - No classes/objects — dictionaries are the closest thing to structured data.
- No exponential-time protection on evaluation depth —
jabtakhas a hard iteration cap (5,000,000) as a safety net against accidental infinite loops, but recursion is bounded only by Python's own recursion limit. - Arithmetic expressions are evaluated through a restricted Python
eval()(__builtins__stripped, only your own variables exposed) — fine for a toy language you run locally, not something to expose to untrusted input over a network.
It's your language — poop.py is small enough to read start to finish in one sitting. Good next additions if you want to keep going:
- classes / structs (
bandatypes with fields + methods) - ternary expressions
- switch/match (
chuno/case?) - a real tokenizer if the string-matching starts breaking on edge cases
Have fun, bhai.