📌 JSONTY Documentation

JSONTY - A minimalist programming language based on JSON
JSONTY allows you to manipulate variables, perform operations, execute conditions, loops, and define functions.
Github: https://mr-julus.is-a.dev/jsonty/github

Requirements

fs, readline-sync

NPM Package

You can also use the NPM Package: npm install jsonty

Features

Available

Coming soon...

📖 Syntax

🔹 Defining Variables

{
    "set": {
        "x": "10",
        "y": "20"
    }
}

🔹 Displaying Messages

{
    "show": ["(x)"]
}

🔹 Mathematical Operations

{
    "set": {
        "z": "(x) (+) (y)"
    }
}

Different mathematical operations: +, -, *, /, =, !=, <=, and >=

🔄 Control Structures

✅ Conditions (if, else if, else)

{
    "if": {
        "condition": "(x) (>) 5",
        "do": {
            "show": ["x is greater than 5"]
        }
    },
    "else if": {
        "condition": "(x) (<) 5",
        "do": {
            "show": ["x is less than 5"]
        }
    },
    "else": {
        "do": {
            "show": ["x is equal to 5"]
        }
    }
}

🔁 Loops (for, while)

{
    "for": {
        "i": [1, 5],
        "do": {
            "show": ["(i)"]
        }
    }
}

{
    "while": {
        "condition": "(x) (<) 20",
        "do": {
            "set": {
                "x": "(x) (+) 1"
            },
            "show": ["(x)"]
        }
    }
}

🔧 Functions

🔹 Defining a Function

{
    "fct": {
        "name": "calcul",
        "args": ["a", "b"],
        "do": {
            "set": {
                "result": "(a) (+) (b)"
            },
            "return": "(result)"
        }
    }
}

🔹 Calling a Function

{
    "call": {
        "name": "calcul",
        "args": ["10", "5"]
    },
    "show": ["(result)"]
}

⌨️ User Input

{
    "ask": {
        "q": "Enter your name"
    },
    "show": ["Hello, (q)!"]
}

⚠️ Error Handling (try/catch)

{
    "try": {
        "do": {
            "set": {
                "x": "1 (/) 0"
            }
        }
    },
    "catch": {
        "do": {
            "show": ["Error detected: (error)"]
        }
    }
}
loading...