# Meghraj's Programming Language
**Meghraj** is a simple and beginner-friendly programming language with support for both **English** and **Roman-Hindi** syntax.
It is designed to make programming easier to understand while providing useful programming features such as variables, strings, arrays, conditions, loops, functions, input, and output.
---
## Features
- English and Roman-Hindi keywords
- `.my` file support
- Syntax highlighting
- Variables
- Numbers
- Strings
- Boolean values
- Arrays
- Array indexing
- Array modification
- User input
- Output using `print()` and `dikhao()`
- `give` and `do`
- Arithmetic operators
- Comparison operators
- Logical operators
- `if` / `agar`
- `else` / `warna`
- `while` / `jabtak`
- Functions / `kaam`
- `return` / `lautao`
- `break` / `roko`
- `continue` / `jaari`
- Single-line comments
- Multi-line comments
- VS Code Run command
- Node.js based execution
---
# Requirements
Before using Meghraj, install the following:
### 1. Visual Studio Code
Download and install Visual Studio Code:
https://code.visualstudio.com/
### 2. Node.js
Meghraj uses Node.js to execute the generated program.
Download Node.js:
https://nodejs.org/
Check whether Node.js is installed:
```bash
node --version
Example:
v22.x.x
Installation
Install Meghraj from VS Code Marketplace
Open Visual Studio Code.
Open the Extensions panel:
Ctrl + Shift + X
- Search for:
Meghraj
Find Meghraj Programming Language.
Click Install.
Reload VS Code if required.
After installation, VS Code will recognize Meghraj files.
Create a Meghraj File
Meghraj programs use the .my file extension.
Example:
hello.my
Other examples:
calculator.my
student.my
array.my
program.my
Your First Meghraj Program
Create a file:
hello.my
Write:
yeh name = "Meghraj";
dikhao("Hello " + name);
Save the file.
Output:
Hello Meghraj
Congratulations! You have written your first Meghraj program.
Run a Meghraj Program
Open your .my file in VS Code.
Press:
Ctrl + Shift + P
Search for:
Meghraj: Run Program
Press Enter.
The extension will:
- Read the Meghraj source code.
- Compile the program.
- Generate JavaScript code.
- Execute the generated code using Node.js.
- Display the output in the terminal.
Variables
Variables are used to store values.
Meghraj supports both English and Roman-Hindi syntax.
English
this x = 10;
this name = "Meghraj";
Roman-Hindi
yeh x = 10;
yeh name = "Meghraj";
Example:
yeh age = 20;
yeh marks = 95;
dikhao(age);
dikhao(marks);
Output:
20
95
Output
Meghraj supports:
print()
print("Hello World");
dikhao()
dikhao("Hello World");
Output:
Hello World
Print a Variable
yeh name = "Meghraj";
dikhao(name);
Output:
Meghraj
Print an Expression
yeh x = 10;
yeh y = 20;
dikhao(x + y);
Output:
30
Print Multiple Values
dikhao("Name:", "Meghraj");
Another example:
yeh age = 20;
print("Age:", age);
give / do
Meghraj also supports the original give and do syntax.
English
this x = 10;
this y = 20;
give result = x + y;
Output:
30
Roman-Hindi
yeh x = 10;
yeh y = 20;
do result = x + y;
Output:
30
You can also use:
dikhao(x + y);
Use input() to receive information from the user.
Example:
yeh name = input("Enter your name: ");
dikhao("Hello " + name);
Example:
Enter your name: Meghraj
Hello Meghraj
Input is received as a string.
yeh city = input("Enter your city: ");
dikhao("Your city is " + city);
Example:
Enter your city: Mumbai
Your city is Mumbai
Strings
Strings are used for text.
Double Quotes
yeh name = "Meghraj";
Single Quotes
yeh name = 'Meghraj';
Both are supported.
String Concatenation
Use + to combine strings.
yeh first = "Meghraj";
yeh last = "Patil";
dikhao(first + " " + last);
Output:
Meghraj Patil
String and Variable
yeh name = "Meghraj";
dikhao("Hello " + name);
Output:
Hello Meghraj
Arrays
Arrays store multiple values in one variable.
Create an Array
yeh numbers = [10, 20, 30, 40];
Access Array Elements
Array indexing starts from 0.
yeh numbers = [10, 20, 30, 40];
dikhao(numbers[0]);
dikhao(numbers[1]);
dikhao(numbers[2]);
dikhao(numbers[3]);
Output:
10
20
30
40
Change an Array Element
yeh numbers = [10, 20, 30];
numbers[1] = 100;
dikhao(numbers[1]);
Output:
100
String Array
yeh names = ["Meghraj", "Sagar", "Amar"];
dikhao(names[0]);
dikhao(names[1]);
dikhao(names[2]);
Output:
Meghraj
Sagar
Amar
Empty Array
yeh numbers = [];
Arithmetic Operators
Meghraj supports:
| Operator |
Meaning |
Example |
+ |
Addition |
x + y |
- |
Subtraction |
x - y |
* |
Multiplication |
x * y |
/ |
Division |
x / y |
% |
Modulus |
x % y |
Example:
yeh a = 20;
yeh b = 5;
dikhao(a + b);
dikhao(a - b);
dikhao(a * b);
dikhao(a / b);
dikhao(a % b);
Output:
25
15
100
4
0
Comparison Operators
| Operator |
Meaning |
== |
Equal |
!= |
Not Equal |
> |
Greater Than |
< |
Less Than |
>= |
Greater Than or Equal |
<= |
Less Than or Equal |
Example:
yeh x = 10;
dikhao(x > 5);
dikhao(x < 20);
dikhao(x == 10);
dikhao(x != 20);
Logical Operators
| Operator |
Meaning |
|
|
&& |
AND |
|
|
| | |
OR |
|
|
! |
NOT |
|
|
Example:
yeh age = 20;
agar (age >= 18 && age <= 60) {
dikhao("Valid age");
}
Boolean Values
Meghraj supports Boolean values.
English
true
false
Roman-Hindi
sahi
galat
Example:
yeh isStudent = sahi;
dikhao(isStudent);
If Statement
English
this age = 20;
if (age >= 18) {
print("Adult");
}
Roman-Hindi
yeh age = 20;
agar (age >= 18) {
dikhao("Adult");
}
If / Else
English
this age = 20;
if (age >= 18) {
print("Adult");
} else {
print("Minor");
}
Roman-Hindi
yeh age = 20;
agar (age >= 18) {
dikhao("Adult");
} warna {
dikhao("Minor");
}
Output:
Adult
While Loop
The while loop repeats code while a condition is true.
English
this i = 1;
while (i <= 5) {
print(i);
i = i + 1;
}
Roman-Hindi
yeh i = 1;
jabtak (i <= 5) {
dikhao(i);
i = i + 1;
}
Output:
1
2
3
4
5
Functions
Functions are reusable blocks of code.
English
function add(a, b) {
return a + b;
}
Roman-Hindi
kaam add(a, b) {
lautao a + b;
}
Call a Function
yeh result = add(10, 20);
dikhao(result);
Output:
30
Another Function Example
kaam square(x) {
lautao x * x;
}
yeh result = square(5);
dikhao(result);
Output:
25
Return
Use return or lautao to return a value from a function.
English
function multiply(a, b) {
return a * b;
}
Roman-Hindi
kaam multiply(a, b) {
lautao a * b;
}
Break
Use break to stop a loop.
English
break;
Roman-Hindi
roko;
Example:
yeh i = 1;
while (i <= 10) {
if (i == 5) {
break;
}
dikhao(i);
i = i + 1;
}
Output:
1
2
3
4
Continue
Use continue to skip the current iteration.
English
continue;
Roman-Hindi
jaari;
Example:
yeh i = 0;
while (i < 5) {
i = i + 1;
if (i == 3) {
continue;
}
dikhao(i);
}
Output:
1
2
4
5
Comments are ignored by the compiler.
Use //.
// This is a comment
yeh x = 10;
dikhao(x);
Use /* ... */.
/*
This is a
multi-line comment
*/
yeh x = 100;
dikhao(x);
English and Roman-Hindi Keywords
Meghraj supports both English and Roman-Hindi keywords.
| English |
Roman-Hindi |
this |
yeh |
give |
do |
if |
agar |
else |
warna |
while |
jabtak |
function |
kaam |
return |
lautao |
true |
sahi |
false |
galat |
break |
roko |
continue |
jaari |
print() |
dikhao() |
Mixed Syntax
You can use English and Roman-Hindi syntax together.
Example:
yeh x = 10;
if (x > 5) {
dikhao("x is greater than 5");
}
Another example:
this x = 10;
agar (x > 5) {
print("x is greater than 5");
}
Both are valid.
Complete Example
This example uses variables, input, arrays, conditions, loops, and output.
// Student Information Program
yeh name = input("Enter your name: ");
yeh marks = [80, 90, 95];
dikhao("Student:", name);
yeh i = 0;
jabtak (i < 3) {
dikhao("Marks:", marks[i]);
i = i + 1;
}
Example output:
Enter your name: Meghraj
Student: Meghraj
Marks: 80
Marks: 90
Marks: 95
Calculator Example
yeh a = 10;
yeh b = 5;
dikhao("Addition:", a + b);
dikhao("Subtraction:", a - b);
dikhao("Multiplication:", a * b);
dikhao("Division:", a / b);
dikhao("Modulus:", a % b);
Output:
Addition: 15
Subtraction: 5
Multiplication: 50
Division: 2
Modulus: 0
Student Result Example
yeh name = input("Enter your name: ");
yeh marks = 85;
dikhao("Student:", name);
dikhao("Marks:", marks);
agar (marks >= 40) {
dikhao("Result: Pass");
} warna {
dikhao("Result: Fail");
}
VS Code Command
To run a Meghraj program:
Ctrl + Shift + P
Then search:
Meghraj: Run Program
Press Enter.
Manual Installation from VSIX
If the Meghraj extension is provided as a .vsix file:
- Open VS Code.
- Open Extensions.
Ctrl + Shift + X
- Click the
... menu in the Extensions panel.
- Select:
Install from VSIX...
- Select the Meghraj
.vsix file.
- Reload VS Code if required.
Troubleshooting
Meghraj: Run Program is not appearing
Check the following:
- The file has the
.my extension.
- The Meghraj extension is installed.
- VS Code has been reloaded.
- Node.js is installed.
Node.js is not recognized
Run:
node --version
If this does not work, install Node.js and restart VS Code.
Syntax highlighting is not working
Make sure your file name ends with:
.my
Example:
hello.my
Then make sure VS Code recognizes the language as:
Meghraj
Array Error
If you see:
Unknown character: [
or:
Unknown character: ]
make sure you are using the latest version of the Meghraj extension.
Current Limitations
Meghraj is currently under development.
The following features are not yet implemented or are still being developed:
for / keLiye loop
- Advanced string methods
- Advanced array methods
- Objects
- Classes
- Modules
- Exception handling
- Static type system
- Standard library
- Advanced debugging
- IntelliSense
- Code formatting
Future Plans
The planned development of Meghraj includes:
for / keLiye loop
- More array operations
- String methods
- Math functions
- More built-in functions
- Objects
- Classes
- Modules
- File handling
- Better error messages
- Autocomplete
- IntelliSense
- Code snippets
- Formatting
- Debugging support
- Standard library
GitHub Repository
https://github.com/MeghrajSharadPatil/meghraj
About Meghraj
Meghraj is a custom programming language created as a learning and programming-language-development project.
It explores concepts such as:
- Lexical analysis
- Parsing
- Abstract Syntax Trees
- Code generation
- Runtime execution
- Programming language design
- VS Code extension development
The goal is to provide a simple programming experience while exploring how programming languages work internally.
License
This project is currently under development.
Add your preferred open-source license before distributing the project as open source.
Meghraj
Simple Syntax. Powerful Ideas.