hindiscript-lang
Version:
HindiScript – A tiny Hindi-first toy language that runs .hs files. Created by Atikin Verse.
82 lines (72 loc) • 2.46 kB
JavaScript
// Central list of Hindi → Internal token replacements.
// Keep ONLY whole-word/token-safe replacements (handled by translator).
export const KEYWORDS = {
// Declarations
"केवल": "let",
"स्थिर": "const",
"परिवर्तनीय": "var",
// Logic & control
"यदि": "if",
"अन्यथा": "else",
"जबतक": "while",
"करो": "do",
"पुनः": "for",
"विराम": "break",
"अगला": "continue",
"बदल": "switch",
"मामला": "case",
"डिफ़ॉल्ट": "default",
"प्रयत्न": "try",
"दोष": "catch",
"सदैव": "finally",
"फेंको": "throw",
// Booleans & operators
"सत्य": "true",
"असत्य": "false",
"बराबर": "===",
"असमान": "!==",
"बड़ा": ">",
"छोटा": "<",
"समान": "==",
"नहीं": "!",
"और": "&&",
"या": "||",
// Functions & classes
"कार्य": "function",
"वापसी": "return",
"वर्ग": "class",
"निर्माता": "constructor",
"विस्तार": "extends",
"अंतर": "super",
"यह": "this",
"विधि": "method",
"गुण": "property",
"नया": "new",
// Async/Promise style
"अप्रत्याशित": "async",
"प्रतीक्षा": "await",
// Standard library bridge (exposed via runtime)
"छापो": "__print", // print to console (Hindi output)
"लंबाई": "length", // .लंबाई on arrays/strings
"जोड़ो": "push",
"हटाओ": "pop",
"शामिल": "includes",
"प्रत्येक": "forEach",
"मानचित्र": "map",
"छांटो": "filter",
"घटाओ": "reduce",
// I/O helpers via runtime
"समयबाद": "__setTimeout",
"निर्धारित": "__setInterval",
"रोकनिर्धारित": "__clearInterval",
// Entry
"मुख्य": "__main"
};
// Identifiers allowed as globals from runtime
export const SAFE_GLOBALS = [
"__print",
"__setTimeout",
"__setInterval",
"__clearInterval",
"__main"
];