hindimejs
v1.1.2
Published
A programming language with a desi twist. It uses commonly used hindi words for commands.π«‘
Maintainers
Readme
HindimeJS π«‘
A tiny, fun programming language in Hindi slang β to test how a language parser works!
π Features
- Hindi Slang Syntax - Write code in familiar Hindi words
- Simple & Fun - Easy to learn, fun to use
- Full Featured - Variables, functions, control flow, modules
- Cross Platform - Works on Windows, Mac, and Linux
- Lightweight - Minimal dependencies, fast execution
π Quick Start
Installation
npm install -g hindimejsYour First Program
Create a file called hello.hindi:
# My first HindimeJS program!
name HAI "Desi Developer"
BOLO "Namaste, " + name + "!"Run it:
hindijs hello.hindiOutput:
Namaste, Developer!π Language Guide
Variables & Assignment
Use HAI for infix assignment (feels natural!):
marks HAI 95
name HAI "Bhai"
flag HAI sach # true
empty HAI khaali # nullLegacy syntax (still supported):
YAAR score 100Math Operations
# Basic arithmetic
result HAI 10 + 5 * 2
BOLO result # 20
# Power and modulo
power HAI 2 ^ 8
remainder HAI 17 % 5Functions
Define functions with kaam and call them with kaam_karo:
kaam greet name {
message HAI "Namaste, " + name + "!"
lotaao message
}
kaam_karo greet "Desi Developer"Or use parentheses syntax:
greet("World")Capturing return values
Use lotaao inside a function to return a value, and assign it with HAI when calling via parentheses syntax.
kaam greet name {
lotaao "Namaste, " + name + "!"
}
msg HAI greet("Mayank")
BOLO msgNote: kaam_karo greet "Mayank" executes the function but does not return a value you can assign.
Control Flow
If-Else:
score HAI 85
agar score >= 90 {
BOLO "Excellent!"
}
nahi_to score >= 80 {
BOLO "Good job!"
}
warna {
BOLO "Keep trying!"
}Loops:
# While loop
i HAI 0
jab_tak i < 5 {
BOLO i
i HAI i + 1
}
# For loop
har_ek item in [1, 2, 3, 4, 5] {
BOLO "Number: " + item
}Arrays & Data Structures
# Create arrays
numbers HAI [1, 2, 3, 4, 5]
names HAI ["Amit", "Priya", "Raj"]
# Access elements
first HAI numbers[0]
BOLO "First number: " + firstModules
Export from math.hindi:
PI HAI 3.14159
kaam square x {
lotaao x * x
}
BHEJO PI
BHEJO squareImport in main.hindi:
lao "math.hindi"
BOLO "Pi is: " + PI
BOLO "Square of 5: " + square(5)π― Examples
Calculator Function
kaam calculate operation a b {
agar operation == "add" {
lotaao a + b
}
nahi_to operation == "multiply" {
lotaao a * b
}
warna {
lotaao "Invalid operation"
}
}
BOLO calculate("add", 10, 5) # 15
BOLO calculate("multiply", 4, 6) # 24Simple Game
# Guess the number game
secret HAI 42
attempts HAI 0
BOLO "Guess the number between 1 and 100!"
jab_tak sach {
attempts HAI attempts + 1
guess HAI 50 # In real app, get user input
agar guess == secret {
BOLO "Correct! You took " + attempts + " attempts."
bas_kar
}
nahi_to guess > secret {
BOLO "Too high!"
}
warna {
BOLO "Too low!"
}
}π¦ CLI Usage
# Run a program
hindijs program.hindi
# Get help
hindijs --help
# Check version
hindijs --versionπ οΈ Development
Prerequisites
- Node.js 14+
- npm or yarn
Setup
git clone https://github.com/thisismayank/hindijs.git
cd hindijs
npm install
npm testProject Structure
hindijs/
βββ src/
β βββ lineTokeniser.js # Tokenizes input
β βββ lineInterpreter.js # Interprets commands
β βββ functionParser.js # Handles functions
β βββ controlParser.js # Handles control flow
βββ lib/
β βββ expressionEvaluator.js
β βββ variableResolver.js
β βββ ...
βββ examples/
β βββ demo.hindi
β βββ functions_demo.hindi
β βββ control_flow_demo.hindi
βββ hindi.js # Main entry pointπ€ Contributing
We love contributions! Here's how you can help:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Development Guidelines
- Keep it meme-friendly and fun! π
- Add Hindi comments in code
- Write tests for new features
- Update documentation for API changes
π License
This project is licensed under the MIT License - see the LICENSE file for details.
π Acknowledgments
- Part of a learning series where I want to understand the workings of the tools I use daily.
π Support
- Issues: GitHub Issues
- Discussions: GitHub Discussions
Made with β€οΈ for the desi developer community
"Coding kar raha hun, masti mein!" π
