MasalaScript

MasalaScript

A Hinglish-inspired programming language

Express logic with clarity, warmth, and structured control flow

$ masalascript example.ms

Interactive Playground

Try MasalaScript right in your browser

Code Editor

Output will appear here...

Documentation

MasalaScript (.ms) is a dynamically typed programming language with Hinglish syntax

Program Structure

Every MasalaScript program has a clear beginning and end. Start your code with Chal bhai suru kar ("Let's start brother!") and close it with bas khatam karo ("that's it, finish!"). This structure ensures your program is properly enclosed and ready to execute.

Chal bhai suru kar

// Your program logic goes here

bas khatam karo

Printing Output

To display output in MasalaScript, use ek baat bataun: (meaning "let me tell you something"). You can print strings, numbers, variables, or combine multiple values separated by commas.

// Print a simple message
ek baat bataun: "Hello, World!"

// Print a variable
maan lo name = "Aman"
ek baat bataun: name

// Print multiple values
ek baat bataun: "Score:", 95

// Combine text and variables
ek baat bataun: "Hello,", name, "Welcome!"

Values separated by commas will be printed with a space between them.

Variables

Declare variables using maan lo (meaning "assume" or "let it be"). MasalaScript is dynamically typed, so you don't need to specify types explicitly. Variables can hold numbers, strings, booleans, or null values and can be reassigned anytime.

maan lo count = 10
maan lo name = "Aman"
maan lo isActive = sach

Variables are dynamically typed and mutable. Type inference is automatic.

Data Types

Type Example Description
Number 10, 3.14 Integers and floating-point numbers
String "Hello" Text enclosed in double quotes
Boolean sach, galat True or false values
Null khaali Represents no value

Conditionals

Control the flow of your program with conditional statements. Use agar kismat rahi ("if luck favors") for if-statements, nahi to ("otherwise") for else-if branches, and warna ("else") for the fallback case. You can chain multiple conditions for complex decision logic.

agar kismat rahi (score >= 90) {
    ek baat bataun: "Excellent!"
} nahi to (score >= 75) {
    ek baat bataun: "Good!"
} warna {
    ek baat bataun: "Keep trying!"
}

Loops

Repeat actions using jab tak hai jaan ("as long as there's life") for while loops. The loop continues as long as the condition remains true. Use me bahar ja raha hu ("I'm going out") to break out of a loop early.

maan lo i = 1

jab tak hai jaan (i <= 5) {
    ek baat bataun: i
    i = i + 1
}

// Break example:
jab tak hai jaan (sach) {
    agar kismat rahi (i > 10) {
        me bahar ja raha hu
    }
    i = i + 1
}

Functions

Create reusable code blocks with climax (the main event!) for function definition. Return values using dialogue wapas do ("return the dialogue"). Functions support parameters and can be called anywhere after their definition.

climax add(a, b) {
    dialogue wapas do a + b
}

// Call the function
maan lo result = add(5, 3)
ek baat bataun: result  // Outputs: 8

Complete Example

Here's a complete MasalaScript program demonstrating variables, conditionals, and output. Save this as grade-checker.ms and run it to see MasalaScript in action. This example shows how all the concepts work together in a real program.

Chal bhai suru kar

// Grade checking program
maan lo studentName = "Aman"
maan lo score = 82

ek baat bataun: "Checking grade for:", studentName

agar kismat rahi (score >= 90) {
    ek baat bataun: "Grade: A - Outstanding!"
} nahi to (score >= 75) {
    ek baat bataun: "Grade: B - Well done!"
} nahi to (score >= 60) {
    ek baat bataun: "Grade: C - Good effort!"
} warna {
    ek baat bataun: "Grade: D - Keep improving!"
}

bas khatam karo

Why MasalaScript?

๐ŸŒถ๏ธ

Hinglish Syntax

Express your logic in a familiar, culturally-rich language blend

โšก

Dynamic Typing

Write code faster with automatic type inference

๐ŸŽฏ

Clear Syntax

Readable keywords that make your intent crystal clear