vedaskript is toy programming language, based on Sanskrit keywords and operators. The language includes features like variables, basic operations, loops, conditions, and built-in functions, all expressed in Sanskrit.
// Output will appear here
Vedaskript is a unique programming language inspired by the ancient language of Sanskrit, seamlessly blending the elegance of tradition with the practicality of modern programming. Designed for enthusiasts of both programming and linguistic heritage, Vedaskript introduces Sanskrit-based keywords and syntax for fundamental programming concepts such as variables, loops, functions, and conditions. Powered by WebAssembly and Pyodide, Vedaskript ensures high performance and compatibility, making it accessible directly through web platforms while maintaining a native execution experience. Whether you're exploring its linguistic charm or leveraging its robust features, Vedaskript offers a perfect fusion of the past and present in the world of coding.
This is the general structure of a program in the Sanskrit-based programming language. It includes the main function and basic code structure.
कार्य मुख्यः() {
}
In this example, we declare a variable using the Sanskrit keyword चरः and assign a numerical value to it.
चरः संख्या = 10;
Here, we define a function using the Sanskrit keyword कार्य followed by the function name. The function will print a message using मुद्रणम्.
कार्य योग(अ, ब) {
प्रतिददाति अ + ब; // Return Statement
}
This demonstrates how to work with different data types such as integers, floats, strings, booleans, and null values in Sanskrit-based code.
चरः संख्या = 10; // Integer
चरः मूल्य = 10.5; // Float
चरः नाम = "राज"; // String
चरः सत्य = सत्य; // Boolean
चरः अज्ञात = रिक्त; // Null
This example demonstrates how to use an if-else condition in Sanskrit using the यदि and अन्यथा keywords.
यदि (संख्या > 5) {
मुद्रणम्("संख्या बड़ी है");
} अन्यथा {
मुद्रणम्("संख्या छोटी है");
}
This block demonstrates a while loop using the Sanskrit keyword यावद् to repeat a statement as long as a condition is true.
यावद् (संख्या < 5) {
संख्या = संख्या + 1;
मुद्रणम्(संख्या);
}
The प्रतिददाति keyword is used to return a value from a function in this example.
कार्य परिणामम्() {
प्रतिददाति 10;
}
The विरमतु keyword is used to exit the loop prematurely.
यावद् (संख्या < 10) {
यदि (संख्या == 5) {
विरमतु;
}
संख्या = संख्या + 1;
मुद्रणम्(संख्या);
}
The अनुवर्तते keyword is used to skip to the next iteration of the loop.
यावद् (संख्या < 10) {
यदि (संख्या == 5) {
अनुवर्तते;
}
संख्या = संख्या + 1;
मुद्रणम्(संख्या);
}
The मुद्रणम् function is used to print values to the console. It's an inbuilt function that allows for displaying data.
कार्य मुख्यः() {
मुद्रणम्("नमस्ते संसार!");
}