├── .eslintignore ├── .eslintrc.js ├── .github └── FUNDING.yml ├── .gitignore ├── CONTRIBUTION.md ├── LICENCE ├── README.md ├── SETUP.md ├── babel.config.js ├── package-lock.json ├── package.json ├── public ├── Scripts │ ├── x0popup.min.css │ └── x0popup.min.js ├── _redirects ├── favicon.ico ├── img │ └── icons │ │ ├── android-chrome-192x192.png │ │ ├── android-chrome-512x512.png │ │ ├── android-chrome-maskable-192x192.png │ │ ├── android-chrome-maskable-512x512.png │ │ ├── android-icon-144x144.png │ │ ├── android-icon-36x36.png │ │ ├── android-icon-48x48.png │ │ ├── android-icon-72x72.png │ │ ├── android-icon-96x96.png │ │ ├── apple-icon-114x114.png │ │ ├── apple-icon-144x144.png │ │ ├── apple-icon-57x57.png │ │ ├── apple-icon-72x72.png │ │ ├── apple-icon-precomposed.png │ │ ├── apple-touch-icon-120x120.png │ │ ├── apple-touch-icon-152x152.png │ │ ├── apple-touch-icon-180x180.png │ │ ├── apple-touch-icon-60x60.png │ │ ├── apple-touch-icon-76x76.png │ │ ├── apple-touch-icon.png │ │ ├── favicon-16x16.png │ │ ├── favicon-32x32.png │ │ ├── favicon-96x96.png │ │ ├── icon-128x128.png │ │ ├── icon-144x144.png │ │ ├── icon-152x152.png │ │ ├── icon-192x192.png │ │ ├── icon-384x384.png │ │ ├── icon-72x72.png │ │ ├── icon-96x96.png │ │ ├── ms-icon-310x310.png │ │ ├── ms-icon-70x70.png │ │ ├── msapplication-icon-144x144.png │ │ ├── mstile-150x150.png │ │ └── safari-pinned-tab.svg ├── index.html └── robots.txt ├── quasar.conf.js ├── result.txt ├── src ├── App.vue ├── assets │ ├── Linkedin.png │ ├── Logo.png │ ├── LogoBlack.png │ ├── LogoWhite.png │ ├── LogoWhite.svg │ ├── Logoori.png │ ├── git.png │ ├── instagram.png │ ├── swanand.png │ ├── wave.png │ ├── wave.svg │ ├── wave5.png │ ├── waveMobile.png │ └── youtube.webp ├── components │ ├── Header.vue │ ├── Kalaam.js │ └── monokai.css ├── exampleCodes │ ├── bintodec.js │ ├── calculatorEx1.js │ ├── checkUndefined1.js │ ├── checkUndefined2.js │ ├── condition1.js │ ├── example2.js │ ├── executionstack1.js │ ├── factorialof.js │ ├── fibonacci.js │ ├── forloop.js │ ├── forloop2.js │ ├── formname.js │ ├── function1.js │ ├── function2.js │ ├── kalaamData.js │ ├── multical.js │ ├── primenumber.js │ ├── reverseEx3.js │ └── whileloop.js ├── lib.zip ├── lib │ ├── Compiler │ │ ├── constants.js │ │ └── main.js │ ├── HelperLibrary │ │ └── main.js │ ├── Interpretor(temp) │ │ ├── Compiler │ │ │ └── main.js │ │ ├── HelperLibrary │ │ │ └── main.js │ │ ├── PushTokens │ │ │ └── main.js │ │ ├── Scripts │ │ │ ├── BuildOperations.js │ │ │ ├── DataCleaning.js │ │ │ ├── Handlers.js │ │ │ ├── Helpers.js │ │ │ ├── HindiChars.js │ │ │ ├── finders.js │ │ │ ├── main.js │ │ │ └── testers.js │ │ ├── TypeCheck │ │ │ ├── AdvancedTypeChecking.js │ │ │ └── TypeChecking.js │ │ └── scanner │ │ │ └── main.js │ ├── PushTokens │ │ └── main.js │ ├── Scripts │ │ ├── BuildOperations.js │ │ ├── DataCleaning.js │ │ ├── Handlers.js │ │ ├── Helpers.js │ │ ├── HindiChars.js │ │ ├── finders.js │ │ ├── main.js │ │ └── testers.js │ ├── TypeCheck │ │ ├── AdvancedTypeChecking.js │ │ └── TypeChecking.js │ ├── constants.js │ └── scanner │ │ └── main.js ├── main.js ├── quasar.js ├── registerServiceWorker.js ├── router │ └── index.js ├── store │ └── index.js ├── styles │ ├── quasar.sass │ └── quasar.variables.sass └── views │ ├── About.vue │ ├── Documentation.vue │ ├── Examples.vue │ ├── FourOhFour.vue │ ├── Home.vue │ ├── Practise.vue │ └── Support.vue ├── test └── examples │ ├── (Example2).test.js │ ├── bintodec.test.js │ ├── calculator(Example1).test.js │ ├── checkUndefined1.test.js │ ├── checkUndefined2.test.js │ ├── condition1.test.js │ ├── executionstack1.test.js │ ├── factorialof.test.js │ ├── fibonacci.test.js │ ├── forloop.test.js │ ├── forloop2.test.js │ ├── formname.test.js │ ├── function1.test.js │ ├── function2.test.js │ ├── multical.test.js │ ├── prime.test.js │ ├── reverse(Example3).test.js │ └── whileloop.test.js └── vue.config.js /.eslintignore: -------------------------------------------------------------------------------- 1 | kalaam.js 2 | .vue 3 | -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | 'extends': 'eslint:recommended', 3 | 'parser': 'babel-eslint', 4 | 'env': { 5 | 'browser': true, 6 | 'node': true, 7 | }, 8 | 'rules': { 9 | // enable additional rules 10 | 'indent': ['error', 4,], 11 | 'linebreak-style': ['error', 'unix',], 12 | 'quotes': ['error', 'single',], 13 | 'semi': ['error', 'always',], 14 | 15 | // override default options for rules from base configurations 16 | 'comma-dangle': ['error', 'always',], 17 | 18 | 'no-cond-assign': ['error', 'always',], 19 | 20 | 21 | 22 | // disable rules from base configurations 23 | 'no-console': 'off', 24 | 'no-useless-escape':'off', 25 | 'no-irregular-whitespace':'off', 26 | 'no-self-assign':'off', 27 | 'no-redeclare': 'off', 28 | 'no-inner-declarations': 'off', 29 | 'no-case-declarations':'off' 30 | 31 | 32 | }, 33 | }; -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: [swanandapps] 4 | patreon: swanandkdm 5 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | /dist 4 | 5 | # local env files 6 | .env.local 7 | .env.*.local 8 | 9 | # Log files 10 | npm-debug.log* 11 | yarn-debug.log* 12 | yarn-error.log* 13 | 14 | # Editor directories and files 15 | .idea 16 | .vscode 17 | *.suo 18 | *.ntvs* 19 | *.njsproj 20 | *.sln 21 | *.sw? 22 | -------------------------------------------------------------------------------- /CONTRIBUTION.md: -------------------------------------------------------------------------------- 1 | # Contributing to Kalaam 2 | We love your input! We want to make contributing to this project as easy and transparent as possible, whether it's: 3 | 4 | - Reporting a bug 5 | - Discussing the current state of the code 6 | - Submitting a fix 7 | - Proposing new features 8 | 9 | ## We Use [Github Flow](https://guides.github.com/introduction/flow/index.html), So All Code Changes Happen Through Pull Requests 10 | Pull requests are the best way to propose changes to the codebase. We actively welcome your pull requests: 11 | 12 | 1. Fork the repo and create your branch from `dev-Kalaam-NextVersion`. 13 | 2. The setups for recreating the project have been given in the [SETUP.md](SETUP.md) file. 14 | 3. If you've added code that should be tested, add tests. 15 | 4. Ensure the test suite and build passes, by running `npm run test` and `npm run build` 16 | 17 | 5. Issue that pull request! 18 | 19 | 24 | 25 | ## Report bugs using Github's [issues](https://github.com/Kalaam-Programming-Language/Kalaam/issues) 26 | We use GitHub issues to track public bugs. Report a bug by [opening a new issue](https://github.com/Kalaam-Programming-Language/Kalaam/issues/new/choose); it's that easy! 27 | 28 | ## Write bug reports with detail, background, and sample code 29 | 30 | **Great Bug Reports** tend to have: 31 | 32 | - A quick summary and/or background 33 | - Steps to reproduce 34 | - Be specific! 35 | - Give sample code if you can. 36 | - What you expected would happen 37 | - What actually happens 38 | - Notes (possibly including why you think this might be happening, or stuff you tried that didn't work) 39 | 40 | People *love* thorough bug reports. I'm not even kidding. 41 | 42 | 43 | ## License 44 | By contributing, you agree that your contributions will be licensed under its MIT License. 45 | 46 | Copyright (c) 2020-present, Swanand Kadam -------------------------------------------------------------------------------- /LICENCE: -------------------------------------------------------------------------------- 1 | 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2020-present, Swanand Kadam 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

Kalaam logo

2 | 3 |

Contribute to Kalaam

4 | 5 | ## Introduction 6 | 7 | Kalaam is the programming language in Hindi and has all the basic functionalities of a modern programming language. From for loops to while loops and from functions to conditional statements. 8 | 9 | Kalaam has it's own parser, interpreter and executes source code from parse tree generated by the parser. 10 | 11 | ## Summary 12 | 13 | 14 | 1. Kalaam Website 15 | 2. Interpreter imported from npm 16 | 3. Only changes to be made here are frontend 17 | 4. Make sure npm Kalaam package is doing the job correctly 18 | 5. Check testcases on npm package as well. 19 | 20 | 21 | ## Branch Guide 22 | 23 | `v1.0.0` 24 | 25 | - The first version of Kalaam. You can explore it to see how first version came out to be. 26 | - No development work happens here anymore. 27 | 28 | 29 | 30 | 31 | `v1.1.0` 32 | 33 | - The latest version of Kalaam with improvments over v1.0.O. 34 | - contains latest stable Kalaam code. 35 | - No new functionality added but more flexible code, testcases, error handling and a lot of functional programming. 36 | 37 | Goals 38 | 39 | - [x] Refactoring, Better Code structure and Improved code readability 40 | - [x] Improve primitive Datatypes parsing 41 | - [x] Commenting majority of codebase 42 | - [x] modularise codebase as per functionalities 43 | - [x] 15+ testcases 44 | 45 | 46 | 47 | 48 | `v1.2.0-dev` 49 | 50 | - As the name suggests, this is where devlopment work happens for next version of Kalaam. 51 | - If you want to contrubute, submit PR's to this branch only. 52 | 53 | Goals 54 | 55 | - [] NPM package initialization 56 | - [] IDesigning an E2E package 57 | - [] Separate repo for npm package and frontend 58 | - [] Standalone Documentation 59 | - [] guidelines on further contributions 60 | 61 | 62 | 63 | ## Contributions 64 | 65 | - You can work on either Frontend, Backend or Documentation, whatever you think you can be best at with your current level of experience. 66 | - This is a complete Kalaam.io application. The compiler will be made available as a standalone npm package called Kalaam-core. 67 | - Fork the repo and create PR's on current dev branch. For now, it is #`v1.2.0-dev`#. 68 | - Feel free to play with project. Creative ideas are most welcome. 69 | 70 | `NOTE: MAKE SURE TO CREATE A PULL REQUEST ON 'v1.2.0-dev' and NOT DIRECTLY ON THE MASTER BRANCH.` 71 | 72 | 73 | ## Steps to follow 74 | 75 | 1. Fork the repo 76 | 2. Create a issue. Add relevant label - mention following things 77 | 78 | a) What is the issue 79 | b) What problems is it causing 80 | c) how to recreate the issue 81 | d) which part of code is causing the issue 82 | 83 | 4. Create branch with the name of issue you want to fix. for e.g ```fixes whitespace issue while cleaning sourcecode``` 84 | 5. Run necessary tests using ```npm run test```. Add more test cases if you need to. 85 | 6. Make sure your code is not breaking anything. 86 | 7. Comment each line of your code. Write down why you are doing it instead of how you are doing it. Tell a story! 87 | 8. Once you are ready, create a PR on current dev branch. DO NOT CREATE PR'S DIRECTLY ON MASTER BRANCH. 88 | 9. Your code will be reviewed and if all good, PR will be merged. 89 | 10. Happy Contributing ⚙️ 90 | 91 | 92 | ## Future plans 93 | 94 | - Right now, Kalaam is in it's early stage. Many programming languages took decades of team work to reach their goals. We go step by step. 95 | - Kalaam needs to have a usecase so that people can start building stuff with it. The use-case can be unique that suits well to the Indian ecosystem. This will help us to move in a straight direction. Right now it's best for learning purposes. 96 | 97 | ## Documentation 98 | 99 | To check out documentation visit [Documentation](https://www.kalaam.io/documentation). 100 | 101 | - Documentation needs a lot of work. I think short video tuts will really help instead of just the overload of texts. 102 | 103 | ## Examples 104 | 105 | To check out examples visit [live examples](https://www.kalaam.io/examples). 106 | 107 | Feel free to add more examples. We have three categories for examples. Basic, Intermediate, and advanced. Add according to context. 108 | 109 | ## Questions 110 | 111 | For questions and support please use [the discord server](https://discord.com/invite/EMyA8TA). 112 | 113 | 114 | 115 | ## Where is the compiler code?: 116 | 117 | Visit 'src/lib/Compiler/main.js' in repo structure to access Kalaam compile engine and learn about how Kalaam works. 118 | 119 | ## To test kalaam.io locally 120 | 121 | The setups for recreating the project have been given in the [SETUP.md](SETUP.md) file. 122 | 123 | ## Issues 124 | 125 | Found an issue in Kalaam? Please use [submit issue](https://github.com/Kalaam-Programming-Language/Kalaam/issues). 126 | 127 | ## License 128 | 129 | [MIT](http://opensource.org/licenses/MIT) 130 | 131 | Copyright (c) 2020-present, Swanand Kadam 132 | 133 | --- 134 | 135 | 136 | ## परिचय 137 | 138 | कलाम हिंदी में प्रोग्रामिंग भाषा है और इसमें आधुनिक प्रोग्रामिंग भाषा के सभी बुनियादी कार्य हैं। लूप्स से लेकर लूप्स तक और फंक्शन्स से लेकर कंडीशनल स्टेटमेंट्स तक। कलाम का अपना पार्सर, दुभाषिया है और पार्सर द्वारा उत्पन्न पार्स ट्री से स्रोत कोड निष्पादित करता है। 139 | 140 | 141 | ## शाखा गाइड 142 | 143 | `v1.0.0` 144 | 145 | - कलाम का पहला संस्करण। आप यह देखने के लिए इसका पता लगा सकते हैं कि पहला संस्करण कैसा रहा। 146 | - अब यहां कोई विकास कार्य नहीं होता है। 147 | 148 | 149 | 150 | 151 | 152 | `v1.1.0` 153 | - कलाम का नवीनतम संस्करण v1.0.O से अधिक सुधारों के साथ। 154 | - नवीनतम स्थिर कलाम कोड शामिल है। 155 | - कोई नई कार्यक्षमता नहीं जोड़ी गई लेकिन अधिक लचीला कोड, टेस्टकेस, त्रुटि प्रबंधन और बहुत सारी कार्यात्मक प्रोग्रामिंग। 156 | 157 | लक्ष्य 158 | 159 | - [x] रिफैक्टरिंग, बेहतर कोड संरचना और बेहतर कोड पठनीयता 160 | - [x] आदिम डेटाटाइप पार्सिंग में सुधार करें 161 | - [x] कोडबेस के बहुमत पर टिप्पणी करना 162 | - [x] कार्यात्मकताओं के अनुसार मॉड्यूलर कोडबेस 163 | - [x] 15+ टेस्टकेस 164 | 165 | 166 | 167 | 168 | `v1.2.0-dev` 169 | 170 | - जैसा कि नाम से पता चलता है, यह वह जगह है जहां कलाम के अगले संस्करण के लिए विकास कार्य होता है। 171 | - यदि आप योगदान देना चाहते हैं, तो पीआर इस शाखा में ही जमा करें। 172 | 173 | 174 | लक्ष्य 175 | 176 | - [] एनपीएम पैकेज आरंभीकरण 177 | - [] एक E2E पैकेज की IDesigning 178 | - [] npm पैकेज और फ्रंटएंड के लिए अलग रेपो 179 | - [] स्टैंडअलोन दस्तावेज़ीकरण 180 | - [] आगे के योगदान पर दिशानिर्देश 181 | 182 | 183 | 184 | ## Contributions 185 | 186 | - आप फ्रंटएंड, बैकएंड या डॉक्यूमेंटेशन में से किसी पर भी काम कर सकते हैं, जो भी आपको लगता है कि आप अपने वर्तमान स्तर के अनुभव के साथ सर्वश्रेष्ठ हो सकते हैं। 187 | - यह एक पूर्ण Kalaam.io एप्लिकेशन है। कंपाइलर को कलाम-कोर नामक एक स्टैंडअलोन एनपीएम पैकेज के रूप में उपलब्ध कराया जाएगा। 188 | - रेपो फोर्क करें और वर्तमान देव शाखा पर पीआर बनाएं। अभी के लिए, यह #v1.2.0-dev# है। 189 | - परियोजना के साथ खेलने के लिए स्वतंत्र महसूस करें। रचनात्मक विचारों का स्वागत है। 190 | - साथी योगदानकर्ताओं से जुड़ने के लिए कलाम डिस्कॉर्ड सेवर का उपयोग करें। (https://discord.gg/vpezZjQQSQ) 191 | 192 | 193 | `नोट: 'v1.2.0-dev' पर एक पुल अनुरोध बनाना सुनिश्चित करें और सीधे मास्टर शाखा पर नहीं।` 194 | 195 | 196 | ## अनुसरण करने के लिए कदम 197 | 198 | 199 | 1. फोर्क रेपो 200 | 2. उस समस्या के नाम से शाखा बनाएं जिसे आप ठीक करना चाहते हैं। 201 | 3. उदाहरण के लिए स्रोत कोड की सफाई करते समय व्हाइटस्पेस समस्या को ठीक करता है npm रन टेस्ट का उपयोग करके आवश्यक परीक्षण चलाएँ। यदि आपको आवश्यकता हो तो और परीक्षण मामले जोड़ें। 202 | 4. सुनिश्चित करें कि आपका कोड कुछ भी नहीं तोड़ रहा है। 203 | 5. अपने कोड की प्रत्येक पंक्ति पर टिप्पणी करें। आप इसे कैसे कर रहे हैं इसके बजाय लिखें कि आप इसे क्यों कर रहे हैं। 204 | 6. एक बार जब आप तैयार हो जाएं, तो वर्तमान देव शाखा पर एक पीआर बनाएं। सीधे मास्टर शाखा पर जनसंपर्क न बनाएं। 205 | 7. आपके कोड की समीक्षा की जाएगी और अच्छा होने पर पीआर का विलय कर दिया जाएगा। 206 | 8. खुश योगदान ⚙️ 207 | 208 | 209 | ## भविष्य की योजनाएं 210 | - कलाम अभी शुरुआती दौर में हैं। कई प्रोग्रामिंग भाषाओं को अपने स्तर तक पहुंचने में दशकों का टीम वर्क लगा। हम कदम दर कदम चलते हैं। 211 | - कलाम के पास एक यूजकेस होना चाहिए ताकि लोग उससे सामान बनाना शुरू कर सकें। उपयोग-मामला अद्वितीय हो सकता है जो भारतीय पारिस्थितिकी तंत्र के लिए उपयुक्त है। यह हमें एक सीधी दिशा में आगे बढ़ने में मदद करेगा। अभी यह सीखने के उद्देश्यों के लिए सबसे अच्छा है। 212 | - कलाम को अपना प्रोजेक्ट मानें, इसे एक्सप्लोर करें और बेझिझक नए आइडिया आज़माएँ। 213 | 214 | 215 | ## प्रलेखन 216 | 217 | दस्तावेज़ीकरण की जाँच करने के लिए दस्तावेज़ीकरण पर जाएँ। [दस्तावेज़ीकरण](https://www.kalaam.io/documentation). 218 | 219 | - दस्तावेज़ीकरण के लिए बहुत काम की ज़रूरत है। मुझे लगता है कि लघु वीडियो वास्तव में पाठों के अधिभार के बजाय वास्तव में मदद करेंगे। 220 | 221 | ## उदाहरण 222 | 223 | उदाहरण देखने के लिए लाइव उदाहरण देखें।[लाइव उदाहरण](https://www.kalaam.io/examples). 224 | 225 | अधिक उदाहरण जोड़ने के लिए स्वतंत्र महसूस करें। उदाहरण के लिए हमारे पास तीन श्रेणियां हैं। बेसिक, इंटरमीडिएट और एडवांस। संदर्भ के अनुसार जोड़ें।
 226 | ## प्रशन 227 | 228 | 229 | 230 | ## कंपाइलर कोड कहां है ?: 231 | 232 | कलाम कंपाइल इंजन तक पहुंचने के लिए रेपो संरचना में 'src/lib/Compiler/main.js' पर जाएं और जानें कि कलाम कैसे काम करता है। 233 | 234 | 235 | ## kalam.io स्थानीय स्तर कैसे काम करता है। 236 | 237 | kalam.io का स्थानीय स्तर पर परीक्षण करने के लिए प्रोजेक्ट को फिर से बनाने के लिए सेटअप SETUP.md फाइल में दिया गया है। 238 | 239 | ## मुद्दे 240 | 241 | कलाम में एक मुद्दा मिला? कृपया सबमिट समस्या का उपयोग करें। [सबमिट समस्या ](https://github.com/Kalaam-Programming-Language/Kalaam/issues). 242 | 243 | 244 | -------------------------------------------------------------------------------- /SETUP.md: -------------------------------------------------------------------------------- 1 | # Steps for recreating 2 | 3 | ### Step 1: 4 | 5 | Fork the repository.
6 | (Top right corner Fork button will be there.) 7 | 8 | ### Step 2: 9 | 10 | Clone the forked repository to local machine using: 11 | ```bash 12 | git clone https://github.com/{Your Github Username}/Kalaam.git 13 | ``` 14 | Enter your github name inside the curly braces present inside the url. 15 | 16 | ### Step 3: 17 | 18 | `cd` into the folder where the repository has been cloned and then run the following command. 19 | 20 | ```bash 21 | npm install 22 | ``` 23 | 24 | After `node_modules` directory has been created in the root repository directory on the local machine run the commands in **Step 4** and **Step 5**. 25 | 26 | ### Step 4: 27 | 28 | 29 | ```bash 30 | npm run test 31 | ``` 32 | 33 | ### Step 5: 34 | 35 | 36 | ```bash 37 | npm run build 38 | ``` 39 | 40 | ### Step 6: 41 | 42 | ```bash 43 | npm run serve 44 | ``` 45 | 46 | After running the above command [kalaam.io](https://www.kalaam.io/) will be launched on the local server and testing can be done accordingly. -------------------------------------------------------------------------------- /babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | "presets": [ 3 | "@vue/cli-plugin-babel/preset" 4 | ], 5 | "plugins": [ 6 | [ 7 | "transform-imports", 8 | { 9 | "quasar": { 10 | "transform": "quasar/dist/babel-transforms/imports.js", 11 | "preventFullImport": true 12 | } 13 | } 14 | ] 15 | ] 16 | } -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "kalaam-FE", 3 | "version": "1.2.0", 4 | "author": "Swanand Kadam ", 5 | "repository": "git://github.com/Kalaam-Programming-Language/Kalaam-core.git", 6 | "scripts": { 7 | "serve": "vue-cli-service serve", 8 | "build": "vue-cli-service build", 9 | "lint": "eslint --ext .js, src", 10 | "lint-fix": "eslint --fix src", 11 | "prod": "npm run build && npm run lint", 12 | "test": "jest" 13 | }, 14 | "dependencies": { 15 | "@quasar/extras": "^1.0.0", 16 | "codemirror": "^5.58.2", 17 | "core-js": "^3.4.4", 18 | "kalaam": "^2.3.3", 19 | "quasar": "^1.12.13", 20 | "readline": "^1.3.0", 21 | "register-service-worker": "^1.7.1", 22 | "vue": "^2.6.10", 23 | "vue-carousel": "^0.18.0", 24 | "vue-clipboard2": "^0.3.1", 25 | "vue-codemirror": "^4.0.6", 26 | "vue-router": "^3.3.2", 27 | "vuetify": "^2.2.11", 28 | "vuex": "^3.1.2" 29 | }, 30 | "devDependencies": { 31 | "@vue/cli-plugin-babel": "^4.1.0", 32 | "@vue/cli-plugin-pwa": "^4.4.4", 33 | "@vue/cli-plugin-router": "^4.4.1", 34 | "@vue/cli-plugin-vuex": "^4.1.0", 35 | "@vue/cli-service": "^4.4.6", 36 | "babel-eslint": "^10.1.0", 37 | "babel-plugin-transform-imports": "1.5.0", 38 | "eslint": "^7.25.0", 39 | "eslint-config-airbnb-base": "^14.2.1", 40 | "eslint-plugin-import": "^2.22.1", 41 | "eslint-plugin-vue": "^7.9.0", 42 | "jest": "^26.2.2", 43 | "node-sass": "^4.13.0", 44 | "sass": "^1.19.0", 45 | "sass-loader": "^8.0.0", 46 | "vue-cli-plugin-quasar": "~2.0.2", 47 | "vue-cli-plugin-vuetify": "^2.0.5", 48 | "vue-template-compiler": "^2.6.10", 49 | "vuetify-loader": "^1.3.0" 50 | }, 51 | "publishConfig": { 52 | "registry": "https://npm.pkg.github.com" 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /public/Scripts/x0popup.min.css: -------------------------------------------------------------------------------- 1 | /* x0popup - v0.3.3 | http://gao-sun.github.io/x0popup */ 2 | .x0l,.x0l .ball{position:absolute}.xi-error span::before,.xi-info span::before,.xi-ok span::before,.xi-warning span::before{content:'';box-sizing:border-box}.x0l{width:120px;height:10px;top:50%;left:50%;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%)}.x0l .ball{width:0;height:0;border:5px solid #000;border-radius:30%;-webkit-animation-duration:2s;animation-duration:2s;-webkit-animation-timing-function:ease;animation-timing-function:ease;-webkit-animation-iteration-count:infinite;animation-iteration-count:infinite}.x0l .ball-1{border-color:#555;-webkit-animation-name:BallFly-1;animation-name:BallFly-1}.x0l .ball-2{border-color:#777;-webkit-animation-name:BallFly-2;animation-name:BallFly-2}.x0l .ball-3{border-color:#999;-webkit-animation-name:BallFly-3;animation-name:BallFly-3}.x0l .ball-4{border-color:#bbb;-webkit-animation-name:BallFly-4;animation-name:BallFly-4}@-webkit-keyframes BallFly-1{88%,from,to{margin-left:0}38%,50%{margin-left:110px}}@keyframes BallFly-1{88%,from,to{margin-left:0}38%,50%{margin-left:110px}}@-webkit-keyframes BallFly-2{4%,92%,from,to{margin-left:0}42%,54%{margin-left:110px}}@keyframes BallFly-2{4%,92%,from,to{margin-left:0}42%,54%{margin-left:110px}}@-webkit-keyframes BallFly-3{8%,96%,from,to{margin-left:0}46%,58%{margin-left:110px}}@keyframes BallFly-3{8%,96%,from,to{margin-left:0}46%,58%{margin-left:110px}}@-webkit-keyframes BallFly-4{12%,from,to{margin-left:0}50%,62%{margin-left:110px}}@keyframes BallFly-4{12%,from,to{margin-left:0}50%,62%{margin-left:110px}}.x0p-overlay{position:fixed;left:0;top:0;width:100%;height:100%;background-color:rgba(180,180,180,.8);z-index:99998;-webkit-animation:x0pfadeIn .5s ease;animation:x0pfadeIn .5s ease}.x0p,.xi{left:50%}.x0p{position:fixed;top:50%;font-size:16px;background-color:#fff;-webkit-transform:translate(-50%,-60%);transform:translate(-50%,-60%);font-family:STHeiti,Helvetica;-webkit-animation:x0ppop .45s ease;animation:x0ppop .45s ease;z-index:99999}.x0p-overlay.no-animation,.x0p.no-animation,.x0p.no-animation .xi>span::before{-webkit-animation:none;animation:none}@-webkit-keyframes x0pfadeIn{from{opacity:0}to{opacity:1}}@keyframes x0pfadeIn{from{opacity:0}to{opacity:1}}@-webkit-keyframes x0ppop{from{-webkit-transform:scale(.9) translate(-55%,-60%);transform:scale(.9) translate(-55%,-60%);opacity:.3}50%{-webkit-transform:scale(1.1) translate(-45%,-60%);transform:scale(1.1) translate(-45%,-60%);opacity:.7}to{-webkit-transform:scale(1) translate(-50%,-60%);transform:scale(1) translate(-50%,-60%);opacity:1}}@keyframes x0ppop{from{-webkit-transform:scale(.9) translate(-55%,-60%);transform:scale(.9) translate(-55%,-60%);opacity:.3}50%{-webkit-transform:scale(1.1) translate(-45%,-60%);transform:scale(1.1) translate(-45%,-60%);opacity:.7}to{-webkit-transform:scale(1) translate(-50%,-60%);transform:scale(1) translate(-50%,-60%);opacity:1}}@-webkit-keyframes x0pslideUp{from{-webkit-transform:translate(-50%,200%);transform:translate(-50%,200%);opacity:0}to{-webkit-transform:translate(-50%,-60%);transform:translate(-50%,-60%);opacity:1}}@keyframes x0pslideUp{from{-webkit-transform:translate(-50%,200%);transform:translate(-50%,200%);opacity:0}to{-webkit-transform:translate(-50%,-60%);transform:translate(-50%,-60%);opacity:1}}@-webkit-keyframes x0pslideDown{from{-webkit-transform:translate(-50%,-260%);transform:translate(-50%,-260%);opacity:0}to{-webkit-transform:translate(-50%,-60%);transform:translate(-50%,-60%);opacity:1}}@keyframes x0pslideDown{from{-webkit-transform:translate(-50%,-260%);transform:translate(-50%,-260%);opacity:0}to{-webkit-transform:translate(-50%,-60%);transform:translate(-50%,-60%);opacity:1}}.xi{position:absolute;width:80px;height:80px;top:50%;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%)}.xi-ok span::before{position:absolute;height:8%;border-radius:10px;background-color:#60BF80}.xi-ok-left::before{width:40%;left:15%;top:50%;-webkit-transform:rotate(45deg);transform:rotate(45deg);-webkit-animation:showOKLeft .6s ease;animation:showOKLeft .6s ease}.xi-ok-right::before{width:60%;left:35%;top:42%;-webkit-transform:rotate(-50deg);transform:rotate(-50deg);-webkit-animation:showOKRight .75s ease;animation:showOKRight .75s ease}@-webkit-keyframes showOKLeft{75%,from{-webkit-transform:rotate(45deg);transform:rotate(45deg);width:0;left:21%;top:37%}to{-webkit-transform:rotate(45deg);transform:rotate(45deg);width:40%;left:15%;top:50%}}@keyframes showOKLeft{75%,from{-webkit-transform:rotate(45deg);transform:rotate(45deg);width:0;left:21%;top:37%}to{-webkit-transform:rotate(45deg);transform:rotate(45deg);width:40%;left:15%;top:50%}}@-webkit-keyframes showOKRight{80%,from{-webkit-transform:rotate(-50deg);transform:rotate(-50deg);width:0;left:46%;top:65%}to{-webkit-transform:rotate(-50deg);transform:rotate(-50deg);width:60%;left:35%;top:42%}}@keyframes showOKRight{80%,from{-webkit-transform:rotate(-50deg);transform:rotate(-50deg);width:0;left:46%;top:65%}to{-webkit-transform:rotate(-50deg);transform:rotate(-50deg);width:60%;left:35%;top:42%}}.xi-info span::before{position:absolute;background-color:#5080DF}.xi-info-circle::before{width:11%;height:11%;border-radius:50%;left:50%;top:15%;-webkit-transform:translateX(-50%);transform:translateX(-50%)}.xi-info-line::before{width:8%;height:45%;border-radius:10px;left:50%;top:35%;-webkit-transform:translateX(-50%);transform:translateX(-50%)}.xi-warning span::before{position:absolute;background-color:#F29F3F}.xi-warning-circle::before{width:11%;height:11%;border-radius:50%;left:50%;top:71%;-webkit-transform:translateX(-50%);transform:translateX(-50%)}.xi-warning-line::before{width:8%;height:45%;border-radius:10px;left:50%;top:15%;-webkit-transform:translateX(-50%);transform:translateX(-50%)}.xi-error span::before{position:absolute;background-color:#EF6080;width:8%;border-radius:10px}.xi-error-right::before{height:80%;top:10%;left:50%;-webkit-transform:translateX(-50%) rotate(45deg);transform:translateX(-50%) rotate(45deg);-webkit-animation:errorDrawRight .6s ease;animation:errorDrawRight .6s ease}.xi-error-left::before{height:80%;top:10%;left:50%;-webkit-transform:translateX(-50%) rotate(-45deg);transform:translateX(-50%) rotate(-45deg);-webkit-animation:errorDrawLeft .75s ease;animation:errorDrawLeft .75s ease}@-webkit-keyframes errorDrawLeft{75%,from{height:0;top:22%;left:23%}to{height:80%;top:10%;left:50%}}@keyframes errorDrawLeft{75%,from{height:0;top:22%;left:23%}to{height:80%;top:10%;left:50%}}@-webkit-keyframes errorDrawRight{80%,from{height:0;top:22%;left:76%}to{height:80%;top:10%;left:50%}}@keyframes errorDrawRight{80%,from{height:0;top:22%;left:76%}to{height:80%;top:10%;left:50%}}.noscroll{overflow:hidden} 3 | .x0p.default .button,.x0p.default .icon-wrapper,.x0p.default .text-pure-wrapper,.x0p.default .text-wrapper{display:inline-block;vertical-align:top}.x0p.default .icon-wrapper{position:relative;width:35%;height:100%}.x0p.default .text-wrapper{position:relative;width:65%;height:100%;margin:0 auto}.x0p.default .text-pure-wrapper{position:relative;width:100%;height:100%}.x0p.default .text-anchor{position:absolute;top:50%;width:100%;-webkit-transform:translateY(-50%);transform:translateY(-50%)}.x0p.default .content{width:100%;height:80%;height:calc(100% - 40px)}.x0p.default.no-button .content{height:100%}.x0p.default .buttons{width:100%;height:40px;position:absolute;bottom:0;background-color:#eee}.x0p.default .text-wrapper .input,.x0p.default .text-wrapper .text,.x0p.default .text-wrapper .title{padding-left:0}.x0p.default .title{padding:0 25px;box-sizing:border-box;font-size:28px;font-weight:700;color:#333}.x0p.default .text{margin-top:5%;padding:0 25px;font-size:18px;color:#777}.x0p.default .error{margin-top:1px;padding:5px 10px;font-size:13px;background-color:#fe9999;color:#fcfcfc}.x0p.default .input{padding:0 30px}.x0p.default input[type=text],.x0p.default input[type=password]{margin-top:7%;padding:8px 10px;outline:0;background-color:#f9f9f9;border-width:0 0 1px;border-style:solid;border-color:#aaa;font-size:18px;box-sizing:border-box;width:100%;color:#aaa;-webkit-transition:all ease .3s;transition:all ease .3s}.x0p.default input[type=text]:focus,.x0p.default input[type=password]:focus{border-color:#5080DF;color:#5080DF}.x0p.default .button{text-align:center;padding:12px 0;font-size:16px;margin-bottom:0;box-sizing:border-box;border:0;outline-width:0;outline-style:solid;outline-offset:-1px}.x0p.default .button-outline:focus{outline-width:1px;-webkit-animation:x0pButtonOutline .3s ease;animation:x0pButtonOutline .3s ease}.x0p.default .button:hover{cursor:pointer}@-webkit-keyframes x0pButtonOutline{from{outline-offset:7px}to{outline-offset:-1px}}@keyframes x0pButtonOutline{from{outline-offset:7px}to{outline-offset:-1px}}.x0p.default .button-ok{background-color:#60BF80;outline-color:#207F40;color:#fefefe}.x0p.default .button-ok:hover{background-color:#50AF70}.x0p.default .button-cancel{background-color:#eee;outline-color:#aaa;color:#666}.x0p.default .button-cancel:hover{background-color:#e3e3e3}.x0p.default .button-warning{background-color:#F29F3F;outline-color:#B25F00;color:#fefefe}.x0p.default .button-warning:hover{background-color:#E28F2F}.x0p.default .button-info{background-color:#6090EF;outline-color:#2050AF;color:#fefefe}.x0p.default .button-info:hover{background-color:#5080DF}.x0p.default .button-error{background-color:#EF6080;outline-color:#AF2040;color:#fefefe}.x0p.default .button-error:hover{background-color:#DF5070} -------------------------------------------------------------------------------- /public/Scripts/x0popup.min.js: -------------------------------------------------------------------------------- 1 | /* x0popup - v0.3.3 | http://gao-sun.github.io/x0popup */ 2 | "use strict";var x0popup,x0p,x0pDefaultConfig={title:"Message",text:null,theme:"default",overlay:!0,width:"90%",height:"50%",maxWidth:"450px",maxHeight:"200px",type:"text",icon:null,iconURL:null,inputType:null,inputValue:null,inputPlaceholder:null,inputColor:null,inputValidator:null,inputPromise:null,showCancelButton:null,buttons:null,autoClose:null,html:!1,animation:!0,animationType:"pop",overlayAnimation:!0,keyResponse:!0,showButtonOutline:!1,buttonTextOk:"OK",buttonTextConfirm:"Confirm",buttonTextCancel:"Cancel",buttonTextDefault:"Button"};x0popup=x0p=function(){function t(){var t="";return t+="width: "+y.width+";",t+="height: "+y.height+";",null!=y.maxWidth&&(t+="max-width: "+y.maxWidth+";"),null!=y.maxHeight&&(t+="max-height: "+y.maxHeight+";"),y.animation&&(t+="-webkit-animation-name: x0p"+y.animationType+"; animation-name: x0p"+y.animationType+";"),!y.overlay&&(t+="outline: 1px solid #ddd"),t}function e(){var t="",e=null==y.icon?y.type:y.icon;switch(t+='
',e){case"ok":t+='';break;case"error":t+='';break;case"info":t+='';break;case"warning":t+='';break;case"custom":t+='"}return t+="
"}function n(){var t="";if(x=y.buttons,null==x&&(x=[],1!=y.showCancelButton&&(0==y.showCancelButton||"warning"!=y.type&&"input"!=y.type)||x.push({type:"cancel",key:27}),"text"==y.type||"input"==y.type?x.push({type:"info",key:13}):x.push({type:y.type,key:13})),0==x.length)return"";var e=1==y.keyResponse?"button":"div",n=x.length,i="width: "+(100/n).toFixed(2)+"%; width: calc(100% / "+n+");",l=1==y.showButtonOutline?" button-outline":"";t+='
';for(var o=0;o'+c(a)+""}return t+="
"}function i(t){var e=document.getElementById(t);null!=e&&e.parentNode.removeChild(e)}function l(){g.classList.remove("noscroll"),document.removeEventListener("keydown",u),i("x0popup"),i("x0p-overlay")}function o(){var t=document.getElementById("x0p-buttons");t.innerHTML='
'}function a(){for(var t=x.length-1,e=0;e0){var i=document.getElementById("x0p-button-"+(x.length-1));i.addEventListener("keydown",function(t){9==t.keyCode&&(document.getElementById("x0p-button-0").focus(),t.preventDefault?t.preventDefault():t.returnValue=!1)}),document.getElementById("x0p-button-"+t).focus()}else document.activeElement.blur()}function u(t){for(var e=t.keyCode,n=0;n'+t+"")}function c(t){if(t.hasOwnProperty("text"))return t.text;switch(t.type){case"ok":case"error":case"info":return x0pDefaultConfig.buttonTextOk;case"warning":return x0pDefaultConfig.buttonTextConfirm;case"cancel":return x0pDefaultConfig.buttonTextCancel;default:return x0pDefaultConfig.buttonTextDefault}}function d(){var t=y.inputColor;return null==t?"":""}function v(t){var e=document.createElement("div");return e.innerText=e.textContent=t,t=e.innerHTML}var x,f=arguments[0],m=null,y=JSON.parse(JSON.stringify(x0pDefaultConfig)),h=null,g=document.body;if("string"==typeof f)y.title=arguments[0],void 0!=arguments[1]&&(y.text=arguments[1]),void 0!=arguments[2]&&(y.type=arguments[2]),void 0!=arguments[3]&&("boolean"==typeof arguments[3]?y.overlayAnimation=arguments[3]:m=arguments[3]);else{for(var b in f)y[b]=f[b];void 0!=arguments[1]&&(m=arguments[1])}var w,k,C="",T=null==y.icon&&("text"==y.type||"input"==y.type),E=null!=y.inputType?y.inputType:"input"==y.type?"text":null,B=null==y.inputValue?"":y.inputValue,D=null==y.inputPlaceholder?"":y.inputPlaceholder,L=n(),I=new Promise(function(n,i){w=n,k=i,y.overlay&&(C+='
'),C+='
',C+='
',C+=T?'
':e()+'
',C+='
',C+='
'+y.title+"
",null!=y.text&&(C+='
'+(y.html?y.text:v(y.text))+"
"),null!=E&&(C+='
'+d()+'
'),C+="
",C+="
",C+="
",C+=L,C+="
",l(),g.insertAdjacentHTML("beforeend",C),g.classList.add("noscroll"),a(),1==y.keyResponse&&document.addEventListener("keydown",u);var o=document.getElementById("x0p-input");null!=E&&o.focus(),null!=y.autoClose&&(h=setTimeout(function(){r("timeout")},y.autoClose))});return I},x0popup.setDefault=x0p.setDefault=function(){var t=arguments[0];for(var e in t)x0pDefaultConfig[e]=t[e]},"object"==typeof module&&(module.exports=x0popup); -------------------------------------------------------------------------------- /public/_redirects: -------------------------------------------------------------------------------- 1 | 2 | /* /index.html 200 -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/masai-course/Kalaam/585215226cdc5728761b64f85a236fa8672c6ec3/public/favicon.ico -------------------------------------------------------------------------------- /public/img/icons/android-chrome-192x192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/masai-course/Kalaam/585215226cdc5728761b64f85a236fa8672c6ec3/public/img/icons/android-chrome-192x192.png -------------------------------------------------------------------------------- /public/img/icons/android-chrome-512x512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/masai-course/Kalaam/585215226cdc5728761b64f85a236fa8672c6ec3/public/img/icons/android-chrome-512x512.png -------------------------------------------------------------------------------- /public/img/icons/android-chrome-maskable-192x192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/masai-course/Kalaam/585215226cdc5728761b64f85a236fa8672c6ec3/public/img/icons/android-chrome-maskable-192x192.png -------------------------------------------------------------------------------- /public/img/icons/android-chrome-maskable-512x512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/masai-course/Kalaam/585215226cdc5728761b64f85a236fa8672c6ec3/public/img/icons/android-chrome-maskable-512x512.png -------------------------------------------------------------------------------- /public/img/icons/android-icon-144x144.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/masai-course/Kalaam/585215226cdc5728761b64f85a236fa8672c6ec3/public/img/icons/android-icon-144x144.png -------------------------------------------------------------------------------- /public/img/icons/android-icon-36x36.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/masai-course/Kalaam/585215226cdc5728761b64f85a236fa8672c6ec3/public/img/icons/android-icon-36x36.png -------------------------------------------------------------------------------- /public/img/icons/android-icon-48x48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/masai-course/Kalaam/585215226cdc5728761b64f85a236fa8672c6ec3/public/img/icons/android-icon-48x48.png -------------------------------------------------------------------------------- /public/img/icons/android-icon-72x72.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/masai-course/Kalaam/585215226cdc5728761b64f85a236fa8672c6ec3/public/img/icons/android-icon-72x72.png -------------------------------------------------------------------------------- /public/img/icons/android-icon-96x96.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/masai-course/Kalaam/585215226cdc5728761b64f85a236fa8672c6ec3/public/img/icons/android-icon-96x96.png -------------------------------------------------------------------------------- /public/img/icons/apple-icon-114x114.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/masai-course/Kalaam/585215226cdc5728761b64f85a236fa8672c6ec3/public/img/icons/apple-icon-114x114.png -------------------------------------------------------------------------------- /public/img/icons/apple-icon-144x144.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/masai-course/Kalaam/585215226cdc5728761b64f85a236fa8672c6ec3/public/img/icons/apple-icon-144x144.png -------------------------------------------------------------------------------- /public/img/icons/apple-icon-57x57.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/masai-course/Kalaam/585215226cdc5728761b64f85a236fa8672c6ec3/public/img/icons/apple-icon-57x57.png -------------------------------------------------------------------------------- /public/img/icons/apple-icon-72x72.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/masai-course/Kalaam/585215226cdc5728761b64f85a236fa8672c6ec3/public/img/icons/apple-icon-72x72.png -------------------------------------------------------------------------------- /public/img/icons/apple-icon-precomposed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/masai-course/Kalaam/585215226cdc5728761b64f85a236fa8672c6ec3/public/img/icons/apple-icon-precomposed.png -------------------------------------------------------------------------------- /public/img/icons/apple-touch-icon-120x120.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/masai-course/Kalaam/585215226cdc5728761b64f85a236fa8672c6ec3/public/img/icons/apple-touch-icon-120x120.png -------------------------------------------------------------------------------- /public/img/icons/apple-touch-icon-152x152.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/masai-course/Kalaam/585215226cdc5728761b64f85a236fa8672c6ec3/public/img/icons/apple-touch-icon-152x152.png -------------------------------------------------------------------------------- /public/img/icons/apple-touch-icon-180x180.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/masai-course/Kalaam/585215226cdc5728761b64f85a236fa8672c6ec3/public/img/icons/apple-touch-icon-180x180.png -------------------------------------------------------------------------------- /public/img/icons/apple-touch-icon-60x60.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/masai-course/Kalaam/585215226cdc5728761b64f85a236fa8672c6ec3/public/img/icons/apple-touch-icon-60x60.png -------------------------------------------------------------------------------- /public/img/icons/apple-touch-icon-76x76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/masai-course/Kalaam/585215226cdc5728761b64f85a236fa8672c6ec3/public/img/icons/apple-touch-icon-76x76.png -------------------------------------------------------------------------------- /public/img/icons/apple-touch-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/masai-course/Kalaam/585215226cdc5728761b64f85a236fa8672c6ec3/public/img/icons/apple-touch-icon.png -------------------------------------------------------------------------------- /public/img/icons/favicon-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/masai-course/Kalaam/585215226cdc5728761b64f85a236fa8672c6ec3/public/img/icons/favicon-16x16.png -------------------------------------------------------------------------------- /public/img/icons/favicon-32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/masai-course/Kalaam/585215226cdc5728761b64f85a236fa8672c6ec3/public/img/icons/favicon-32x32.png -------------------------------------------------------------------------------- /public/img/icons/favicon-96x96.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/masai-course/Kalaam/585215226cdc5728761b64f85a236fa8672c6ec3/public/img/icons/favicon-96x96.png -------------------------------------------------------------------------------- /public/img/icons/icon-128x128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/masai-course/Kalaam/585215226cdc5728761b64f85a236fa8672c6ec3/public/img/icons/icon-128x128.png -------------------------------------------------------------------------------- /public/img/icons/icon-144x144.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/masai-course/Kalaam/585215226cdc5728761b64f85a236fa8672c6ec3/public/img/icons/icon-144x144.png -------------------------------------------------------------------------------- /public/img/icons/icon-152x152.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/masai-course/Kalaam/585215226cdc5728761b64f85a236fa8672c6ec3/public/img/icons/icon-152x152.png -------------------------------------------------------------------------------- /public/img/icons/icon-192x192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/masai-course/Kalaam/585215226cdc5728761b64f85a236fa8672c6ec3/public/img/icons/icon-192x192.png -------------------------------------------------------------------------------- /public/img/icons/icon-384x384.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/masai-course/Kalaam/585215226cdc5728761b64f85a236fa8672c6ec3/public/img/icons/icon-384x384.png -------------------------------------------------------------------------------- /public/img/icons/icon-72x72.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/masai-course/Kalaam/585215226cdc5728761b64f85a236fa8672c6ec3/public/img/icons/icon-72x72.png -------------------------------------------------------------------------------- /public/img/icons/icon-96x96.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/masai-course/Kalaam/585215226cdc5728761b64f85a236fa8672c6ec3/public/img/icons/icon-96x96.png -------------------------------------------------------------------------------- /public/img/icons/ms-icon-310x310.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/masai-course/Kalaam/585215226cdc5728761b64f85a236fa8672c6ec3/public/img/icons/ms-icon-310x310.png -------------------------------------------------------------------------------- /public/img/icons/ms-icon-70x70.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/masai-course/Kalaam/585215226cdc5728761b64f85a236fa8672c6ec3/public/img/icons/ms-icon-70x70.png -------------------------------------------------------------------------------- /public/img/icons/msapplication-icon-144x144.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/masai-course/Kalaam/585215226cdc5728761b64f85a236fa8672c6ec3/public/img/icons/msapplication-icon-144x144.png -------------------------------------------------------------------------------- /public/img/icons/mstile-150x150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/masai-course/Kalaam/585215226cdc5728761b64f85a236fa8672c6ec3/public/img/icons/mstile-150x150.png -------------------------------------------------------------------------------- /public/img/icons/safari-pinned-tab.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 7 | 8 | Created by potrace 1.11, written by Peter Selinger 2001-2013 9 | 10 | 12 | 148 | 149 | 150 | -------------------------------------------------------------------------------- /public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | कलाम: Programming Language in Hindi 30 | 31 | 33 | 34 | 35 | 36 | 37 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 52 | 53 | 56 |
57 | 58 | 59 | 60 | 61 | 62 | 66 | 67 | 68 | 69 | 105 | -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | User-agent: * 2 | Disallow: 3 | -------------------------------------------------------------------------------- /quasar.conf.js: -------------------------------------------------------------------------------- 1 | framework: { 2 | components: ['QBtn', 'QIcon'] 3 | } -------------------------------------------------------------------------------- /src/App.vue: -------------------------------------------------------------------------------- 1 | 9 | 10 | 11 | 47 | 48 | 270 | -------------------------------------------------------------------------------- /src/assets/Linkedin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/masai-course/Kalaam/585215226cdc5728761b64f85a236fa8672c6ec3/src/assets/Linkedin.png -------------------------------------------------------------------------------- /src/assets/Logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/masai-course/Kalaam/585215226cdc5728761b64f85a236fa8672c6ec3/src/assets/Logo.png -------------------------------------------------------------------------------- /src/assets/LogoBlack.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/masai-course/Kalaam/585215226cdc5728761b64f85a236fa8672c6ec3/src/assets/LogoBlack.png -------------------------------------------------------------------------------- /src/assets/LogoWhite.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/masai-course/Kalaam/585215226cdc5728761b64f85a236fa8672c6ec3/src/assets/LogoWhite.png -------------------------------------------------------------------------------- /src/assets/LogoWhite.svg: -------------------------------------------------------------------------------- 1 | Kalam Logo ( BLACK BG )OC -------------------------------------------------------------------------------- /src/assets/Logoori.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/masai-course/Kalaam/585215226cdc5728761b64f85a236fa8672c6ec3/src/assets/Logoori.png -------------------------------------------------------------------------------- /src/assets/git.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/masai-course/Kalaam/585215226cdc5728761b64f85a236fa8672c6ec3/src/assets/git.png -------------------------------------------------------------------------------- /src/assets/instagram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/masai-course/Kalaam/585215226cdc5728761b64f85a236fa8672c6ec3/src/assets/instagram.png -------------------------------------------------------------------------------- /src/assets/swanand.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/masai-course/Kalaam/585215226cdc5728761b64f85a236fa8672c6ec3/src/assets/swanand.png -------------------------------------------------------------------------------- /src/assets/wave.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/masai-course/Kalaam/585215226cdc5728761b64f85a236fa8672c6ec3/src/assets/wave.png -------------------------------------------------------------------------------- /src/assets/wave.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/assets/wave5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/masai-course/Kalaam/585215226cdc5728761b64f85a236fa8672c6ec3/src/assets/wave5.png -------------------------------------------------------------------------------- /src/assets/waveMobile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/masai-course/Kalaam/585215226cdc5728761b64f85a236fa8672c6ec3/src/assets/waveMobile.png -------------------------------------------------------------------------------- /src/assets/youtube.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/masai-course/Kalaam/585215226cdc5728761b64f85a236fa8672c6ec3/src/assets/youtube.webp -------------------------------------------------------------------------------- /src/components/Header.vue: -------------------------------------------------------------------------------- 1 | 55 | 56 | 57 | 123 | 124 | 420 | -------------------------------------------------------------------------------- /src/components/monokai.css: -------------------------------------------------------------------------------- 1 | /* Based on Sublime Text's Monokai theme */ 2 | 3 | .cm-s-monokai.CodeMirror { background: #191C27; color: #f8f8f2; } 4 | .cm-s-monokai div.CodeMirror-selected { background: #49483E; } 5 | .cm-s-monokai .CodeMirror-line::selection, .cm-s-monokai .CodeMirror-line > span::selection, .cm-s-monokai .CodeMirror-line > span > span::selection { background: rgba(73, 72, 62, .99); } 6 | .cm-s-monokai .CodeMirror-line::-moz-selection, .cm-s-monokai .CodeMirror-line > span::-moz-selection, .cm-s-monokai .CodeMirror-line > span > span::-moz-selection { background: rgba(73, 72, 62, .99); } 7 | .cm-s-monokai .CodeMirror-gutters { background: rgb(0, 0, 0); border-right: 0px; } 8 | .cm-s-monokai .CodeMirror-guttermarker { color: white; } 9 | .cm-s-monokai .CodeMirror-guttermarker-subtle { color: #d0d0d0; } 10 | .cm-s-monokai .CodeMirror-linenumber { color: #d0d0d0; } 11 | .cm-s-monokai .CodeMirror-cursor { border-left: 1px solid #f8f8f0; } 12 | 13 | .cm-s-monokai span.cm-comment { color: #75715e; } 14 | .cm-s-monokai span.cm-atom { color: #ae81ff; } 15 | .cm-s-monokai span.cm-number { color: #f4a261; } 16 | 17 | .cm-s-monokai span.cm-comment.cm-attribute { color: #97b757; } 18 | .cm-s-monokai span.cm-comment.cm-def { color: #bc9262; } 19 | .cm-s-monokai span.cm-comment.cm-tag { color: #bc6283; } 20 | .cm-s-monokai span.cm-comment.cm-type { color: #5998a6; } 21 | 22 | .cm-s-monokai span.cm-property, .cm-s-monokai span.cm-attribute { color: #a6e22e; } 23 | .cm-s-monokai span.cm-keyword { color: #fffb00; } 24 | .cm-s-monokai span.cm-builtin { color: #66d9ef; } 25 | .cm-s-monokai span.cm-string { color: #beffb3; } 26 | 27 | .cm-s-monokai span.cm-variable { color: #72d6d5; } 28 | .cm-s-monokai span.cm-variable-2 { color: #ffffff; } 29 | .cm-s-monokai span.cm-variable-3, .cm-s-monokai span.cm-type { color: #66d9ef; } 30 | .cm-s-monokai span.cm-def { color: #fd971f; } 31 | .cm-s-monokai span.cm-bracket { color: #f11a1a; } 32 | .cm-s-monokai span.cm-tag { color: #f92672; } 33 | .cm-s-monokai span.cm-header { color: #ae81ff; } 34 | .cm-s-monokai span.cm-link { color: #ae81ff; } 35 | .cm-s-monokai span.cm-error { background: #f92672; color: #f8f8f0; } 36 | 37 | .cm-s-monokai .CodeMirror-activeline-background { background: #585858; } 38 | .cm-s-monokai .CodeMirror-matchingbracket { 39 | text-decoration: underline; 40 | color: rgb(3, 218, 14) !important; 41 | } 42 | -------------------------------------------------------------------------------- /src/exampleCodes/bintodec.js: -------------------------------------------------------------------------------- 1 | const tW = (strings) => { 2 | return strings 3 | .map((s) => s.replace(/\s+/g, '\n')) 4 | .join('') 5 | .trim(); 6 | }; 7 | 8 | export const bintodec = tW` 9 | Binary=1111 10 | 11 | DecimalValue=0 12 | 13 | length=Binary.संख्या() 14 | 15 | दुहराओ x को Binary मे 16 | 17 | { 18 | 19 | length=length-1 20 | 21 | BinaryCharacter=Binary[x] 22 | 23 | value=BinaryCharacter*2**length 24 | 25 | DecimalValue=DecimalValue+value 26 | 27 | } 28 | 29 | दिखाए(DecimalValue) 30 | 31 | 32 | 33 | 34 | `; 35 | -------------------------------------------------------------------------------- /src/exampleCodes/calculatorEx1.js: -------------------------------------------------------------------------------- 1 | const tW = (strings) => { 2 | return strings 3 | .map((s) => s.replace(/\s+/g, '\n')) 4 | .join('') 5 | .trim(); 6 | }; 7 | 8 | export const calculator = tW`FirstValue=10 9 | SecondValue=20 10 | Operation='+' 11 | दिखाए('FirstValue is '+FirstValue) 12 | दिखाए('SecondValue is '+SecondValue) 13 | अगर(Operation=='+') 14 | { 15 | output=FirstValue+SecondValue 16 | } 17 | अगर(Operation=='-') 18 | { 19 | output=FirstValue-SecondValue 20 | } 21 | 22 | अगर(Operation=='*') 23 | { 24 | output=FirstValue*SecondValue 25 | } 26 | अगर(Operation=='/') 27 | { 28 | output=FirstValue/SecondValue 29 | } 30 | दिखाए("Output is" + output)`; 31 | -------------------------------------------------------------------------------- /src/exampleCodes/checkUndefined1.js: -------------------------------------------------------------------------------- 1 | const tW = (strings) => { 2 | return strings 3 | .map((s) => s.replace(/\s+/g, '\n')) 4 | .join('') 5 | .trim(); 6 | }; 7 | 8 | export const undefined1 = tW` 9 | a=10 10 | 11 | c=a+b 12 | 13 | दिखाए(c) 14 | 15 | 16 | 17 | `; 18 | -------------------------------------------------------------------------------- /src/exampleCodes/checkUndefined2.js: -------------------------------------------------------------------------------- 1 | const tW = (strings) => { 2 | return strings 3 | .map((s) => s.replace(/\s+/g, '\n')) 4 | .join('') 5 | .trim(); 6 | }; 7 | 8 | export const undefined2 = tW` 9 | 10 | a=10 11 | 12 | 13 | c=b 14 | 15 | दिखाए(c) 16 | 17 | 18 | 19 | 20 | 21 | `; 22 | -------------------------------------------------------------------------------- /src/exampleCodes/condition1.js: -------------------------------------------------------------------------------- 1 | const tW = (strings) => { 2 | return strings 3 | .map((s) => s.replace(/\s+/g, '\n')) 4 | .join('') 5 | .trim(); 6 | }; 7 | 8 | export const condition1 = tW`language='kalam' 9 | country='dcvdvdv' 10 | 11 | 12 | अगर(language=='kalam' || country=='india') 13 | { 14 | 15 | 16 | 17 | दिखाए('That works too.') 18 | 19 | 20 | } 21 | `; 22 | -------------------------------------------------------------------------------- /src/exampleCodes/example2.js: -------------------------------------------------------------------------------- 1 | const tW = (strings) => { return strings.map((s) => s.replace(/\s+/g, '\n')).join('').trim(); }; 2 | 3 | export const example2 = tW`YourSign='Test Sign' 4 | line="|" 5 | space=" " 6 | Extra=" " 7 | दुहराओ x को (1,15) मे 8 | { 9 | Road=space+line+space+space+space+YourSign+space+space+space+line+space 10 | space=space+Extra 11 | दिखाए(Road) 12 | }`; -------------------------------------------------------------------------------- /src/exampleCodes/executionstack1.js: -------------------------------------------------------------------------------- 1 | const tW = (strings) => { 2 | return strings 3 | .map((s) => s.replace(/\s+/g, '\n')) 4 | .join('') 5 | .trim(); 6 | }; 7 | 8 | export const executionstack1 = tW` 9 | 10 | x=11 11 | 12 | y=11 13 | 14 | ऑपरेशन='+' 15 | 16 | अगर(ऑपरेशन=='+') 17 | 18 | { 19 | 20 | नतीजा=x+y 21 | 22 | 23 | } 24 | 25 | अगर(ऑपरेशन=='-') 26 | 27 | { 28 | 29 | नतीजा=x-y 30 | 31 | 32 | } 33 | 34 | अगर(ऑपरेशन=='*') 35 | 36 | { 37 | 38 | नतीजा=x*y 39 | 40 | 41 | } 42 | 43 | अगर(ऑपरेशन=='/') 44 | 45 | { 46 | 47 | नतीजा=x/y 48 | 49 | 50 | } 51 | 52 | 53 | दिखाए( x + ऑपरेशन + y + '=' + नतीजा)`; 54 | -------------------------------------------------------------------------------- /src/exampleCodes/factorialof.js: -------------------------------------------------------------------------------- 1 | const tW = (strings) => { 2 | return strings 3 | .map((s) => s.replace(/\s+/g, '\n')) 4 | .join('') 5 | .trim(); 6 | }; 7 | 8 | export const factorialOf = tW` 9 | factorialOf=5 10 | f=1 11 | count=1 12 | 13 | अगर(factorialOf == 0 || factorialOf < 0){ 14 | दिखाए("Invalid Input") 15 | } 16 | 17 | जबतक(count < factorialOf+1){ 18 | f=f*count 19 | count=count+1 20 | } 21 | 22 | दिखाए("Factorial of" + factorialOf + " is " + f) 23 | 24 | 25 | 26 | `; 27 | -------------------------------------------------------------------------------- /src/exampleCodes/fibonacci.js: -------------------------------------------------------------------------------- 1 | const tW = (strings) => { 2 | return strings 3 | .map((s) => s.replace(/\s+/g, '\n')) 4 | .join('') 5 | .trim(); 6 | }; 7 | 8 | export const fibonacci = tW`Fibonacci=[] 9 | दुहराओ a को (0,10) मे 10 | { 11 | अगर (a<3) 12 | { 13 | Fibonacci[a]=a 14 | } 15 | अगर (a>1) 16 | { 17 | x=Fibonacci[a-2] 18 | y=Fibonacci[a-1] 19 | Fibonacci[a]=x+y 20 | } 21 | } 22 | 23 | दिखाए(Fibonacci) 24 | } 25 | 26 | 27 | `; 28 | -------------------------------------------------------------------------------- /src/exampleCodes/forloop.js: -------------------------------------------------------------------------------- 1 | const tW = (strings) => { 2 | return strings 3 | .map((s) => s.replace(/\s+/g, '\n')) 4 | .join('') 5 | .trim(); 6 | }; 7 | 8 | export const forloop = tW` 9 | दुहराओ x को (0,10) मे 10 | 11 | { 12 | 13 | value= x*5 14 | 15 | दिखाए(value) 16 | 17 | } 18 | `; 19 | -------------------------------------------------------------------------------- /src/exampleCodes/forloop2.js: -------------------------------------------------------------------------------- 1 | const tW = (strings) => { 2 | return strings 3 | .map((s) => s.replace(/\s+/g, '\n')) 4 | .join('') 5 | .trim(); 6 | }; 7 | 8 | export const forloop2 = tW` 9 | नाम="SWANAND" 10 | 11 | दुहराओ x को नाम मे 12 | 13 | { 14 | 15 | अक्षर=नाम[x] 16 | 17 | दिखाए(x + अक्षर) 18 | 19 | 20 | } 21 | 22 | `; 23 | -------------------------------------------------------------------------------- /src/exampleCodes/formname.js: -------------------------------------------------------------------------------- 1 | const tW = (strings) => { 2 | return strings 3 | .map((s) => s.replace(/\s+/g, '\n')) 4 | .join('') 5 | .trim(); 6 | }; 7 | 8 | export const formname = tW` 9 | नाम='test' 10 | 11 | नतीजा="" 12 | 13 | दुहराओ x को नाम मे 14 | 15 | { 16 | 17 | अक्षर=नाम[x] 18 | 19 | नतीजा=नतीजा+अक्षर 20 | 21 | दिखाए(नतीजा) 22 | 23 | 24 | } 25 | 26 | 27 | `; 28 | -------------------------------------------------------------------------------- /src/exampleCodes/function1.js: -------------------------------------------------------------------------------- 1 | const tW = (strings) => { 2 | return strings 3 | .map((s) => s.replace(/\s+/g, '\n')) 4 | .join('') 5 | .trim(); 6 | }; 7 | 8 | export const function1 = tW`FirstName='Sachin' 9 | 10 | LastName='Tendulkar' 11 | 12 | 13 | रचना PrintFullName(First,Last) 14 | 15 | { 16 | 17 | दिखाए(First + Last) 18 | 19 | 20 | 21 | } 22 | 23 | 24 | PrintFullName(FirstName,LastName) 25 | 26 | 27 | `; 28 | -------------------------------------------------------------------------------- /src/exampleCodes/function2.js: -------------------------------------------------------------------------------- 1 | const tW = (strings) => { 2 | return strings 3 | .map((s) => s.replace(/\s+/g, '\n')) 4 | .join('') 5 | .trim(); 6 | }; 7 | 8 | export const function2 = tW` 9 | रचना printname(count) 10 | { 11 | 12 | जबतक(count<20) 13 | 14 | { 15 | 16 | count=count+1 17 | 18 | दिखाए(count) 19 | 20 | } 21 | 22 | 23 | } 24 | 25 | 26 | 27 | 28 | printname(10) 29 | 30 | 31 | 32 | `; 33 | -------------------------------------------------------------------------------- /src/exampleCodes/kalaamData.js: -------------------------------------------------------------------------------- 1 | import Keyword from '../../src/lib/Compiler/constants'; 2 | 3 | export default function Data(code) { 4 | return { 5 | code: code, 6 | checked:'', 7 | output: '', 8 | cm: '', 9 | error: [], 10 | OperationObjects: [], 11 | linebylineOutput: '', 12 | TimeTaken: '', 13 | flag:false, 14 | inputIndexes: [], 15 | isError: '', 16 | ExecutionStack:[], 17 | ExecutionStackLinebyLine:'', 18 | LastConditionValue: [], 19 | LineByLineCode: [], 20 | CurrentLine:0, 21 | Keyword:Keyword, 22 | }; 23 | } -------------------------------------------------------------------------------- /src/exampleCodes/multical.js: -------------------------------------------------------------------------------- 1 | const tW = (strings) => { 2 | return strings 3 | .map((s) => s.replace(/\s+/g, '\n')) 4 | .join('') 5 | .trim(); 6 | }; 7 | 8 | export const multical = tW` 9 | a=10 10 | b=10 11 | 12 | c=(a+b)/2 + (a+b)*2 13 | 14 | दिखाए(c) 15 | 16 | 17 | 18 | `; 19 | -------------------------------------------------------------------------------- /src/exampleCodes/primenumber.js: -------------------------------------------------------------------------------- 1 | const tW = (strings) => { 2 | return strings 3 | .map((s) => s.replace(/\s+/g, '\n')) 4 | .join('') 5 | .trim(); 6 | }; 7 | 8 | export const primenumber = tW` 9 | 10 | num=11 11 | 12 | prime=[] 13 | 14 | दुहराओ b को (2,num) मे 15 | 16 | { 17 | 18 | Remainder=num%b 19 | 20 | अगर(Remainder==0) 21 | 22 | { 23 | 24 | prime.पुश(b) 25 | 26 | } 27 | 28 | } 29 | 30 | 31 | length=prime.संख्या() 32 | 33 | अगर(length==1 && num>1) 34 | 35 | { 36 | 37 | दिखाए(num + "is a Prime Number") 38 | 39 | } 40 | `; 41 | -------------------------------------------------------------------------------- /src/exampleCodes/reverseEx3.js: -------------------------------------------------------------------------------- 1 | const tW = (strings) => { return strings.map((s) => s.replace(/\s+/g, '\n')).join('').trim(); }; 2 | 3 | export const reverse = tW` 4 | Name='TestString' 5 | ReverseString='' 6 | दिखाए ('Input String-'+ Name) 7 | length=Name.संख्या() 8 | दुहराओ b को Name मे 9 | { 10 | ReverseString=ReverseString+Name[length-1] 11 | length=length-1 12 | } 13 | दिखाए ('Reversed String-'+ ReverseString)`; -------------------------------------------------------------------------------- /src/exampleCodes/whileloop.js: -------------------------------------------------------------------------------- 1 | const tW = (strings) => { 2 | return strings 3 | .map((s) => s.replace(/\s+/g, '\n')) 4 | .join('') 5 | .trim(); 6 | }; 7 | 8 | export const whileloop = tW` 9 | 10 | count=0 11 | 12 | 13 | जबतक(count<10) 14 | { 15 | 16 | दिखाए(count) 17 | 18 | 19 | count=count+1 20 | 21 | 22 | } 23 | 24 | 25 | 26 | `; 27 | -------------------------------------------------------------------------------- /src/lib.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/masai-course/Kalaam/585215226cdc5728761b64f85a236fa8672c6ec3/src/lib.zip -------------------------------------------------------------------------------- /src/lib/Compiler/constants.js: -------------------------------------------------------------------------------- 1 | let ActiveLanguage = localStorage.getItem('ActiveLangugae'); 2 | //console.log("ActiveLangugae: ", ActiveLanguage); 3 | 4 | if (ActiveLanguage == null) { 5 | ActiveLanguage = 'Hindi'; 6 | } 7 | 8 | //console.log('ActiveLangugae: ', ActiveLanguage); 9 | 10 | var ActiveLangugaeKeywords = ''; 11 | 12 | var KalaamKeywords = { 13 | Hindi: { 14 | Print: 'दिखाए', //Still have to change this manually where REGEX are implemented 15 | Input: 'इनपुट', 16 | If: 'अगर', 17 | For: 'दुहराओ', 18 | While: 'जबतक', 19 | Length: 'संख्या', 20 | Push: 'पुश', 21 | Function: 'रचना', 22 | Langugae: 'Hindi', 23 | }, 24 | 25 | Marathi: { 26 | Print: 'दाखवा', //Still have to change this manually where REGEX are implemented 27 | Input: 'इनपुट', 28 | If: 'जर', 29 | For: 'दुहराओ', 30 | While: 'जोपर्यंत', 31 | Length: 'संख्या', 32 | Push: 'पुश', 33 | Function: 'रचना', 34 | Langugae: 'Marathi', 35 | }, 36 | }; 37 | 38 | if (ActiveLanguage == 'Hindi') { 39 | ActiveLangugaeKeywords = KalaamKeywords.Hindi; 40 | } 41 | 42 | if (ActiveLanguage == 'Marathi') { 43 | ActiveLangugaeKeywords = KalaamKeywords.Marathi; 44 | } 45 | 46 | //console.log('ActiveLangugaeKeywords: ', ActiveLangugaeKeywords); 47 | 48 | export { ActiveLangugaeKeywords, KalaamKeywords, }; 49 | -------------------------------------------------------------------------------- /src/lib/HelperLibrary/main.js: -------------------------------------------------------------------------------- 1 | Array.prototype.nextElement = function(i) { 2 | return this[i + 1]; 3 | }; 4 | Array.prototype.prevElement = function(i) { 5 | return this[i - 1]; 6 | }; 7 | -------------------------------------------------------------------------------- /src/lib/Interpretor(temp)/HelperLibrary/main.js: -------------------------------------------------------------------------------- 1 | Array.prototype.nextElement = function(i) { 2 | return this[i + 1]; 3 | }; 4 | Array.prototype.prevElement = function(i) { 5 | return this[i - 1]; 6 | }; 7 | -------------------------------------------------------------------------------- /src/lib/Interpretor(temp)/PushTokens/main.js: -------------------------------------------------------------------------------- 1 | import { RemoveBrackets, operatorType, } from '../Scripts/Helpers'; 2 | import { ActiveLangugaeKeywords, } from '../../constants'; 3 | //ANCHOR - Functions to push token with type and value into tokens array for further parsing 4 | 5 | function PushVariable(v, tokens) { 6 | tokens.push(v); 7 | } 8 | 9 | function PushString(value, tokens) { 10 | tokens.push({ 11 | type: 'string', 12 | value: value, 13 | }); 14 | } 15 | 16 | function PushVariableValue(value, tokens) { 17 | tokens.push({ 18 | type: 'value', 19 | value: value, 20 | }); 21 | } 22 | 23 | function PushNumber(value, tokens) { 24 | tokens.push({ 25 | type: 'value', 26 | value: value, 27 | }); 28 | } 29 | 30 | function PushOperator(value, tokens) { 31 | let subtype = operatorType(value); 32 | 33 | tokens.push({ 34 | type: 'operator', 35 | value, 36 | subtype, 37 | }); 38 | } 39 | 40 | function PushKeyword(value, tokens) { 41 | value = value.replace('+', ' + '); 42 | let subtype = value === ActiveLangugaeKeywords.Print ? 'print' : 'default'; 43 | 44 | tokens.push({ 45 | type: 'keyword', 46 | value: value, 47 | subtype, 48 | }); 49 | } 50 | function PushConditionalKeyword(value, tokens) { 51 | tokens.push({ 52 | type: 'conditionalkeyword', 53 | value: value, 54 | }); 55 | } 56 | 57 | function PushEmptyArrayInit(tokens, data, i) { 58 | tokens.push({ 59 | type: 'EmptyArrayInit', 60 | value: data[i - 1], 61 | //skipping = 62 | }); 63 | } 64 | 65 | function PushForLoop(value, tokens) { 66 | tokens.push({ 67 | type: 'ForLoopStart', 68 | value: value, 69 | }); 70 | } 71 | 72 | function PushInput(value, tokens, cleaned_sourcedata, i) { 73 | let lastchar = value.charAt(value.length - 1); 74 | 75 | value = lastchar == ',' ? (value = value + cleaned_sourcedata[i + 1]) : value; 76 | 77 | value = RemoveBrackets(value); 78 | 79 | value = value.replace('इनपुट', ''); 80 | 81 | tokens.push({ 82 | type: 'AcceptInput', 83 | value: ' ', 84 | AcceptAs: value, 85 | }); 86 | } 87 | 88 | function PushWhileLoop(value, tokens) { 89 | tokens.push({ 90 | type: 'WhileLoopStart', 91 | value: value, 92 | }); 93 | } 94 | 95 | function PushWhileLoopCondition(value, tokens) { 96 | tokens.push({ 97 | type: 'WhileLoopCondition', 98 | value: value, 99 | }); 100 | } 101 | 102 | function PushForLoopAruguments(element, cleaned_sourcedata, i, tokens) { 103 | //This values will be fixed even though for loop definations change 104 | let iterator = cleaned_sourcedata[i + 1]; 105 | let value = cleaned_sourcedata[i + 3]; 106 | 107 | if (value.includes('(') && value.includes(',')) { 108 | let Range = RemoveBrackets(value).split(','); 109 | let iterationStart = Range[0]; 110 | let iterationEnd = Range[1]; 111 | 112 | // let k = i + 5; 113 | 114 | PushArgs(iterator, value, iterationStart, iterationEnd); 115 | 116 | //run a function to collect arguments 117 | } else { 118 | let Range = RemoveBrackets(cleaned_sourcedata[i + 5]).split(','); 119 | 120 | let iterationStart = Range[0]; 121 | let iterationEnd = Range[1]; 122 | 123 | //let k = i + 6; 124 | 125 | PushArgs(iterator, value, iterationStart, iterationEnd); 126 | } 127 | 128 | //to get (2,9) into start=2 and end=9 129 | 130 | //run a function to store sourcedata 131 | 132 | function PushArgs(iterator, value, iterationStart, iterationEnd) { 133 | tokens.push({ 134 | type: 'ForLoopArguments', 135 | iterator: iterator, 136 | value: value, 137 | iterationStart: iterationStart, 138 | iterationEnd: iterationEnd, 139 | }); 140 | } 141 | } 142 | 143 | function PushCondition(value, tokens) { 144 | tokens.push({ 145 | type: 'condition', 146 | value: value, 147 | }); 148 | } 149 | 150 | function PushToArray(value, tokens) { 151 | tokens.push({ 152 | type: 'PushToArray', 153 | value: value, 154 | }); 155 | } 156 | 157 | function PushExpression(value, tokens) { 158 | tokens.push({ 159 | type: 'expression', 160 | value: value, 161 | }); 162 | } 163 | 164 | function PushNativeOperation(value, tokens) { 165 | tokens.push({ 166 | type: 'NativeOperation', 167 | value: value, 168 | }); 169 | } 170 | 171 | 172 | 173 | 174 | function PushFunctionData(value, tokens, sourcedata, i) { 175 | let functionName = sourcedata[i + 1]; 176 | let functionNameSplit = functionName.split('('); 177 | let functionArguments = RemoveBrackets(functionNameSplit[1]); 178 | // 179 | functionArguments = functionArguments.split(','); 180 | 181 | tokens.push({ 182 | type: 'function', 183 | value: functionNameSplit[0], 184 | arguments: functionArguments, 185 | FunctionInvocation: false, 186 | FunctionStack: [], 187 | }); 188 | } 189 | 190 | function PushFunctionExecution(value, tokens, sourcedata, i, passedValues) { 191 | let functionName = value; 192 | let functionNameSplit = functionName.split('('); 193 | let functionArguments = RemoveBrackets(functionNameSplit[1]); 194 | // 195 | functionArguments = functionArguments.split(','); 196 | 197 | tokens.push({ 198 | type: 'functionExecution', 199 | value: functionNameSplit[0], 200 | arguments: functionArguments, 201 | FunctionInvocation: true, 202 | passedValues: passedValues, 203 | }); 204 | } 205 | 206 | function PushArray(value, tokens) { 207 | if (value.includes('(') && value.includes(')')) { 208 | value = RemoveBrackets(value); 209 | 210 | value = value.replace(']', ''); 211 | 212 | let Split = value.split('['); 213 | 214 | let IndexInput = Split[1]; 215 | 216 | value = value + ']'; 217 | 218 | tokens.push({ 219 | type: 'Array', 220 | value: value, 221 | IndexInput: IndexInput, 222 | }); 223 | } else { 224 | tokens.push({ 225 | type: 'Array', 226 | value: value, 227 | }); 228 | } 229 | } 230 | 231 | function PushCalculation(value, tokens, cleaned_sourcedata, i, multiCal) { 232 | //not allowing values like Numbers[a] 233 | //revisit this 234 | 235 | if (!(!/\d+/.test(cleaned_sourcedata[i - 2]) && cleaned_sourcedata[i - 2].includes('['))) { 236 | // 237 | 238 | tokens.push({ 239 | type: 'Calculation', 240 | value: value, 241 | multiCal, 242 | }); 243 | } 244 | } 245 | 246 | function PushRealTimePrintOperation(value, tokens) { 247 | tokens.push({ 248 | type: 'value', 249 | value: value, 250 | mode: 'RealTimePrint', 251 | }); 252 | } 253 | 254 | function PushStringandValueOperation(value, tokens) { 255 | tokens.push({ 256 | type: 'value', 257 | value: value, 258 | mode: 'StringandValue', 259 | }); 260 | } 261 | 262 | export { 263 | PushVariableValue, 264 | PushNativeOperation, 265 | PushToArray, 266 | PushFunctionExecution, 267 | PushFunctionData, 268 | PushInput, 269 | PushArray, 270 | PushEmptyArrayInit, 271 | PushCalculation, 272 | PushConditionalKeyword, 273 | PushCondition, 274 | PushWhileLoop, 275 | PushWhileLoopCondition, 276 | PushForLoop, 277 | PushForLoopAruguments, 278 | PushExpression, 279 | PushKeyword, 280 | PushNumber, 281 | PushOperator, 282 | PushRealTimePrintOperation, 283 | PushString, 284 | PushStringandValueOperation, 285 | PushVariable, 286 | }; 287 | -------------------------------------------------------------------------------- /src/lib/Interpretor(temp)/Scripts/BuildOperations.js: -------------------------------------------------------------------------------- 1 | 2 | function RemoveBrackets(element){ 3 | 4 | let a = element.replace('(', ''); 5 | let b = a.replace(')', ''); 6 | let c = b.replace('}', ''); 7 | let d = c.replace('{', ''); 8 | 9 | return d; 10 | 11 | } 12 | 13 | 14 | //This are all build operations. 15 | //They are used to unify a string, a condition or array. 16 | 17 | //Cleaned_sourcedata stores data in tokens, i.e individual words . 18 | 19 | //To peform operations we have to get them in one piece, here is where we do that 20 | 21 | 22 | export function BuildString() { 23 | 24 | 25 | return function(element,i,cleaned_sourcedata){ 26 | 27 | 28 | var foundString = ''; 29 | 30 | //the flag is introduced to remove spaces introduced in strings. e.g " swanand kadam" 31 | var flag=0; 32 | 33 | let k = i; 34 | 35 | 36 | 37 | for ( k; k < cleaned_sourcedata.length; k++) { 38 | 39 | let item = cleaned_sourcedata[k - 1].charAt(cleaned_sourcedata[k - 1].length - 1); 40 | 41 | 42 | if (item == '"' || item == '\'') 43 | 44 | { 45 | break; 46 | } 47 | if(flag==1){ 48 | 49 | foundString = foundString + ' ' + cleaned_sourcedata[k]; 50 | 51 | } 52 | 53 | if(flag==0){ 54 | 55 | foundString = cleaned_sourcedata[k]; 56 | flag=1; 57 | 58 | } 59 | 60 | 61 | 62 | } 63 | return foundString; 64 | 65 | 66 | 67 | }; 68 | } 69 | 70 | export function BuildArray() { 71 | 72 | 73 | return function(element,i,cleaned_sourcedata){ 74 | 75 | var foundArray = ''; 76 | 77 | //the flag is introduced to remove spaces introduced in Arrays. e.g " swanand kadam" 78 | var flag=0; 79 | 80 | let k = i; 81 | 82 | 83 | 84 | for ( k; k < cleaned_sourcedata.length; k++) { 85 | 86 | let item = cleaned_sourcedata[k - 1].charAt(cleaned_sourcedata[k - 1].length - 1); 87 | 88 | 89 | 90 | if (item == ']') 91 | 92 | { 93 | break; 94 | } 95 | if(flag==1){ 96 | 97 | foundArray = foundArray + ' ' + cleaned_sourcedata[k]; 98 | 99 | 100 | } 101 | 102 | if(flag==0){ 103 | 104 | foundArray = cleaned_sourcedata[k]; 105 | flag=1; 106 | 107 | 108 | } 109 | 110 | 111 | 112 | 113 | } 114 | 115 | 116 | return foundArray; 117 | 118 | }; 119 | 120 | 121 | } 122 | 123 | export function BuildCondition() { 124 | 125 | 126 | return function(element,i,cleaned_sourcedata){ 127 | 128 | var foundString = ''; 129 | 130 | let k = i+1; // +1 to skip if, else etc and acquire condition 131 | 132 | 133 | 134 | for ( k; k < cleaned_sourcedata.length; k++) { 135 | 136 | // let item = cleaned_sourcedata[k - 1].charAt(cleaned_sourcedata[k - 1].length - 1); 137 | 138 | 139 | if (cleaned_sourcedata[k] == '{' || cleaned_sourcedata[k] == '){' || cleaned_sourcedata[k] == ') {' ) 140 | 141 | { 142 | break; 143 | } else { 144 | 145 | foundString = foundString + ' ' + cleaned_sourcedata[k]; 146 | 147 | } 148 | 149 | 150 | } 151 | 152 | foundString=RemoveBrackets(foundString); 153 | 154 | foundString=foundString.replace(' ', ''); 155 | 156 | return foundString; 157 | 158 | 159 | 160 | }; 161 | } 162 | 163 | 164 | 165 | -------------------------------------------------------------------------------- /src/lib/Interpretor(temp)/Scripts/DataCleaning.js: -------------------------------------------------------------------------------- 1 | function SourceDataReplaceforEasyParsing(data) 2 | 3 | { 4 | 5 | 6 | 7 | data = data.replace(/చూపించు/g, ' చూపించు '); 8 | data = data.replace(/दाखवा/g, ' दाखवा '); 9 | data = data.replace(/\( /g, '('); 10 | // data = data.replace(/\)/g, ' )'); 11 | // data = data.replace(/\+ /g, '+'); 12 | data = data.replace(/\= "/g, '="'); 13 | data = data.replace(/\= '/g, '=\''); 14 | 15 | 16 | 17 | 18 | data = data.replace(/\जबतक/g, 'जबतक '); 19 | data = data.replace(/\जोपर्यंत/g, 'जोपर्यंत '); 20 | data = data.replace(/\अन्यथा{/g, 'अन्यथा {'); 21 | 22 | data = data.replace(/\[ /g, '['); 23 | data = data.replace(/\)}/g, ') }'); 24 | data = data.replace(/\){/g, ') {'); 25 | data = data.replace(/\}}/g, '} }'); 26 | data = data.replace(/\को/g, 'को '); 27 | data = data.replace(/\मे{/g, 'मे {'); 28 | data = data.replace(/\अगर/g, 'अगर '); 29 | data = data.replace(/\जर/g, 'जर '); 30 | data = data.replace(/(?:\r\n|\r|\n)/g, ' '); 31 | // data = data.replace(/\==/g, ' == '); 32 | 33 | //preparing data for easy parsing by handling new lines, enters etc. 34 | data = data.replace(/(;|\n|\r|' '| '| ")/gm, '').split(' '); 35 | 36 | return data; 37 | 38 | 39 | } 40 | 41 | 42 | 43 | 44 | 45 | 46 | export { SourceDataReplaceforEasyParsing, }; -------------------------------------------------------------------------------- /src/lib/Interpretor(temp)/Scripts/Handlers.js: -------------------------------------------------------------------------------- 1 | import { RemoveQuotes, } from '../Scripts/Helpers'; 2 | import { ActiveLangugaeKeywords, } from '../../constants'; 3 | import { IsReservedKeyword, } from '../Scripts/main'; 4 | import { HandleBlocks, } from '../Scripts/main'; 5 | function isNumber(element) { 6 | return /^[0-9]*$/gm.test(element); 7 | } 8 | function handleOutput(value, kalaam) { 9 | kalaam.output += value + '\n'; 10 | } 11 | 12 | function handleHygiene(el) { 13 | let restricted = [ 14 | ActiveLangugaeKeywords.If, 15 | 'दुहराओ', 16 | ActiveLangugaeKeywords.While, 17 | ActiveLangugaeKeywords.Print, 18 | 'इनपुट', 19 | 'रचना', 20 | 'को', 21 | 'मे', 22 | ]; 23 | for (const val in el) { 24 | let result = restricted.includes(el[val]) ? 'fail' : 'pass'; 25 | return result; 26 | } 27 | } 28 | 29 | function handleVariable(element, tokens, cleaned_sourcedata, i, nextEl, prevEl) { 30 | let token; 31 | element = RemoveQuotes(element); 32 | 33 | let Datatype = isNumber(element) && element != '' ? 'Number' : 'String'; 34 | 35 | if (nextEl === '=' || prevEl === '=') { 36 | token = { 37 | type: 'variable', 38 | value: element, 39 | Datatype: Datatype, 40 | }; 41 | 42 | return token; 43 | } 44 | } 45 | 46 | function handleRealtimePrint(cleaned_sourcedata, i) { 47 | let foundString = ''; 48 | 49 | let k = i; 50 | 51 | let skip = 0; 52 | 53 | var flag = 0; 54 | 55 | for (k; k < cleaned_sourcedata.length; k++) { 56 | let element = cleaned_sourcedata[k]; 57 | let conditionEnd = element.charAt(element.length - 1) + element.charAt(element.length - 2); 58 | 59 | if (IsReservedKeyword(element)) { 60 | break; 61 | } 62 | 63 | if (conditionEnd == ')"' || element.charAt(element.length - 1) == ')') { 64 | foundString = foundString + ' ' + cleaned_sourcedata[k]; 65 | break; 66 | } else if (flag == 1) { 67 | foundString = foundString + ' ' + cleaned_sourcedata[k]; 68 | } else if (flag == 0) { 69 | foundString = cleaned_sourcedata[k]; 70 | 71 | flag = 1; 72 | } 73 | 74 | skip = skip + 1; 75 | } 76 | 77 | return { foundString, skip, }; 78 | } 79 | 80 | function prepareFunction(mutable_tokens, j) { 81 | //We are preparing the required data to execute a function call later in the prgroam 82 | 83 | //functionsourcedata includes all the tokens from tokens array which belongs to a particular function 84 | 85 | //We find self range or a function block through HandleBlocks function 86 | 87 | let functionSourceData = []; 88 | 89 | let result = HandleBlocks(mutable_tokens, j + 1, functionSourceData); 90 | 91 | functionSourceData = result.StoreResult; 92 | 93 | //To identify function context in tokens array 94 | 95 | functionSourceData.forEach((el) => { 96 | el.context = 'function'; 97 | }); 98 | 99 | return { functionSourceData, }; 100 | } 101 | 102 | export { handleOutput, handleVariable, handleHygiene, handleRealtimePrint, prepareFunction, }; 103 | -------------------------------------------------------------------------------- /src/lib/Interpretor(temp)/Scripts/Helpers.js: -------------------------------------------------------------------------------- 1 | function RemoveQuotes(e) { 2 | e = e.replace(/"/g, ''); 3 | e = e.replace(/'/g, ''); 4 | 5 | return e; 6 | } 7 | function earlyCleaning(c) { 8 | //Since html reads '>' and '<' as '>' and '<' respectively, we need to replace it back to the desired way. 9 | 10 | c = c.replace(/</g, '<'); 11 | 12 | c = c.replace(/>/g, '>'); 13 | 14 | c = c.replace(/&/g, '&'); 15 | return c; 16 | } 17 | function RemoveBrackets(e) { 18 | let a = e.replace(/\(/g, ''); 19 | let b = a.replace(/\)/g, ''); 20 | let c = b.replace('}', ''); 21 | let d = c.replace('{', ''); 22 | 23 | return d; 24 | } 25 | 26 | function operatorType(t) { 27 | return t === '=' 28 | ? 'assignment' 29 | : t === '+' 30 | ? 'addition' 31 | : t === '-' 32 | ? 'subtraction' 33 | : t === '*' 34 | ? 'multiplication' 35 | : t === '/' 36 | ? 'division' 37 | : t === '}' 38 | ? 'close_bracket' 39 | : t === '{' 40 | ? 'open_bracket' 41 | : 'unknown'; 42 | } 43 | 44 | //handy count function 45 | 46 | function Count(item, element) { 47 | let count = 0; 48 | 49 | for (let i = 0; i < element.length; i++) { 50 | if (element.charAt(i) == item && element.charAt(i + 1) == item) { 51 | count += 1; 52 | } 53 | } 54 | 55 | return count; 56 | } 57 | 58 | export { earlyCleaning, RemoveQuotes, RemoveBrackets, Count, operatorType, }; 59 | -------------------------------------------------------------------------------- /src/lib/Interpretor(temp)/Scripts/HindiChars.js: -------------------------------------------------------------------------------- 1 | 2 | // eslint-disable-next-line no-misleading-character-class 3 | var regex = /(?:^|\s)[\u0900\u0901\u0902\u0903\u0904\u0905\u0906\u0907\u0908\u0909\u090a\u090b\u090c\u090d\u090e\u090f\u0910\u0911\u0912\u0913\u0914\u0915\u0916\u0917\u0918\u0919\u091a\u091b\u091c\u091d\u091e\u091f\u0920\u0921\u0922\u0923\u0924\u0925\u0926\u0927\u0928\u0929\u092a\u092b\u092c\u092d\u092e\u092f\u0930\u0931\u0932\u0933\u0934\u0935\u0936\u0937\u0938\u0939\u093a\u093b\u093c\u093d\u093e\u093f\u0940\u0941\u0942\u0943\u0944\u0945\u0946\u0947\u0948\u0949\u094a\u094b\u094c\u094d\u094e\u094f\u0950\u0951\u0952\u0953\u0954\u0955\u0956\u0957\u0958\u0959\u095a\u095b\u095c\u095d\u095e\u095f\u0960\u0961\u0962\u0963\u0964\u0965\u0966\u0967\u0968\u0969\u096a\u096b\u096c\u096d\u096e\u096f\u0970\u0971\u0972\u0973\u0974\u0975\u0976\u0977\u0978\u0979\u097a\u097b\u097c\u097d\u097e\u097f]+?(?:\s|$)/g; 4 | 5 | 6 | export default regex; -------------------------------------------------------------------------------- /src/lib/Interpretor(temp)/Scripts/finders.js: -------------------------------------------------------------------------------- 1 | import { GetcleanedExpression, } from '../Scripts/main'; 2 | 3 | function findtokenPositioninCode(source, mycode, shoudlclean) { 4 | mycode = shoudlclean ? GetcleanedExpression(mycode) : mycode; 5 | 6 | for (let x = 0; x < source.length; x++) { 7 | source[x] = shoudlclean ? GetcleanedExpression(source[x]) : source[x]; 8 | 9 | if (source[x].includes(mycode)) { 10 | return x + 1; 11 | } 12 | } 13 | } 14 | 15 | export { findtokenPositioninCode, }; 16 | -------------------------------------------------------------------------------- /src/lib/Interpretor(temp)/Scripts/testers.js: -------------------------------------------------------------------------------- 1 | function isInterpretableType(t) { 2 | let non_types = ['variable', 'Array', 'close_bracket', 'open_bracket', 'value',]; 3 | 4 | if (non_types.includes(t)) { 5 | return false; 6 | } else { 7 | return true; 8 | } 9 | } 10 | 11 | export { isInterpretableType, }; 12 | -------------------------------------------------------------------------------- /src/lib/Interpretor(temp)/TypeCheck/AdvancedTypeChecking.js: -------------------------------------------------------------------------------- 1 | 2 | 3 | export function isPureEval(){ 4 | 5 | 6 | return function(element){ 7 | 8 | if(/^([-+]?[0-9]*\.?[0-9]+[\/\+\-\*])+([-+]?[0-9]*\.?[0-9]+)*$/gm.test(element)) 9 | { 10 | 11 | return true; 12 | 13 | } 14 | }; 15 | 16 | } 17 | 18 | 19 | 20 | 21 | //if parser encounters anything like (" or (, then that's a realtime print. 22 | //buildstring will be applied now to create a string and push it into tokens 23 | 24 | export function isRealTimePrintMultipleString (){ 25 | 26 | 27 | return function(element){ 28 | 29 | 30 | let conditionStart=element.charAt(0); 31 | let lastChar=element.charAt(element.length-1); 32 | 33 | 34 | 35 | //THE Principle condition to proceed building a string after identifyting it as a potential realtimestring 36 | 37 | if(((conditionStart=='(' && lastChar!=')') || (element.includes('("') || element.includes('(\'') ))) 38 | { 39 | 40 | 41 | 42 | return true; 43 | 44 | } 45 | 46 | }; 47 | } 48 | 49 | 50 | export function isStringandValue (){ 51 | 52 | return function(element){ 53 | 54 | let x=element; 55 | 56 | 57 | 58 | if(x.includes('"')&&x.includes('+')) 59 | { 60 | 61 | 62 | return true; 63 | } 64 | 65 | 66 | 67 | }; 68 | } 69 | 70 | 71 | 72 | export function isCalculation() { 73 | 74 | return function(element){ 75 | 76 | if ((element.includes('+') || element.includes('%') || element.includes('-') || element.includes('*') || element.includes('/')) && !element.includes('[') && ((element.includes('(')&& element.includes(')')) || (!element.includes('(')&& !element.includes(')')) ) && element.charAt(element.length-1)!='+' && (element.charAt(0)!='/' || element.charAt(0)!='*' )) { 77 | 78 | return true; 79 | } 80 | 81 | }; 82 | } 83 | 84 | export function isDirectPrintArithmetic(){ 85 | 86 | return function(token){ 87 | if( ( token.includes('+') || token.includes('-') || token.includes('*') || token.includes('/') ) ) 88 | { 89 | 90 | return true; 91 | } 92 | 93 | }; 94 | } -------------------------------------------------------------------------------- /src/lib/Interpretor(temp)/TypeCheck/TypeChecking.js: -------------------------------------------------------------------------------- 1 | import { ActiveLangugaeKeywords, } from '../../constants'; 2 | 3 | const Keywords = [ 4 | ActiveLangugaeKeywords.If, 5 | 'दुहराओ', 6 | ActiveLangugaeKeywords.While, 7 | ActiveLangugaeKeywords.Print, 8 | 'इनपुट', 9 | 'रचना', 10 | 'को', 11 | 'मे', 12 | ]; 13 | 14 | // var PrintKeywordRegex = "^" + "(" + ActiveLangugaeKeywords.Print + ")*$" 15 | // PrintKeywordRegex = new RegExp(PrintKeywordRegex) 16 | 17 | const NativeOperations = ['संख्या',]; 18 | 19 | function RemoveBrackets(element) { 20 | const a = element.replace('(', ''); 21 | const b = a.replace(')', ''); 22 | const c = b.replace('}', ''); 23 | const d = c.replace('{', ''); 24 | 25 | return d; 26 | } 27 | 28 | function isArrayOperation(element) { 29 | // To find Patterns like Array[2], Array[index] etc 30 | 31 | element = RemoveBrackets(element); 32 | 33 | if (element.charAt(element.length - 1) == ']' && element.includes('[') && element.charAt(0) != '[') { 34 | return true; 35 | } 36 | } 37 | 38 | export function isVariable() { 39 | return function (element) { 40 | const HindiRegex = /(?:^|\s)[\u0900-\u097F]+?(?:\s|$)/g; 41 | 42 | return /^[a-z]+$/i.test(element) || (HindiRegex.test(element) && !Keywords.includes(element)); 43 | }; 44 | } 45 | export function isNumber() { 46 | return function (element) { 47 | return /^[0-9]*$/gm.test(element); 48 | }; 49 | } 50 | 51 | export function isOperator() { 52 | return function (element) { 53 | return /^(=|}|{)*$/gm.test(element); 54 | }; 55 | } 56 | 57 | export function isInput() { 58 | return function (element) { 59 | return element.includes('इनपुट'); 60 | }; 61 | } 62 | 63 | export function isPrintOperation() { 64 | return function (element) { 65 | return element.includes(ActiveLangugaeKeywords.Print); 66 | }; 67 | } 68 | 69 | export function isConditionalKeyword() { 70 | return function (element) { 71 | return element == ActiveLangugaeKeywords.If || element == ActiveLangugaeKeywords.While || element == 'अन्यथा'; 72 | }; 73 | } 74 | 75 | export function isForLoop() { 76 | return function (element) { 77 | return element == 'दुहराओ'; 78 | }; 79 | } 80 | 81 | export function isWhileLoop() { 82 | return function (element) { 83 | return element == ActiveLangugaeKeywords.While; 84 | }; 85 | } 86 | 87 | export function isFunction() { 88 | return function (element) { 89 | return element == 'रचना'; 90 | }; 91 | } 92 | 93 | // needs work 94 | export function isExpression() { 95 | return function (element) { 96 | return /\(([^)]+)\)/.test(element) || element.includes('()'); 97 | }; 98 | } 99 | 100 | export function isArray() { 101 | return function (element) { 102 | return element.charAt(0) == '['; 103 | }; 104 | } 105 | 106 | export function isSetArrayIndexValue() { 107 | return function (element, data, i) { 108 | element = RemoveBrackets(element); 109 | 110 | if (isArrayOperation(element) && data[i + 1] == '=') { 111 | return true; 112 | } if (isArrayOperation(element) && (data[i + 1] == '=' || data[i - 1] == '=')) { 113 | return false; 114 | } 115 | }; 116 | } 117 | 118 | export function isEmptyArrayInit() { 119 | return function (element, data, i) { 120 | return element == '=' && data[i + 1] == '[]'; 121 | }; 122 | } 123 | 124 | export function isinvalidString() { 125 | return function (element) { 126 | return ( 127 | element == '"' 128 | || element == '\'' 129 | || element == '*' 130 | || element == '$' 131 | || element == '/' 132 | || element == '@' 133 | || element == '|' 134 | || element == '/' 135 | || element == '?' 136 | || element == '#' 137 | || (element.charAt(0) == '\'' && element.charAt(element.length - 1) == '\'') 138 | || (element.charAt(0) == '"' && element.charAt(element.length - 1) == '"') 139 | ); 140 | }; 141 | } 142 | 143 | export function isString() { 144 | return function (element) { 145 | return element.charAt(0) == '\'' || (element.charAt(0) == '"' && !element.includes(ActiveLangugaeKeywords.Print)); 146 | }; 147 | } 148 | 149 | export function isNativeOperation() { 150 | return function (element) { 151 | let flag = false; 152 | 153 | NativeOperations.forEach((el) => { 154 | if (element.includes(el)) { 155 | flag = true; 156 | } 157 | }); 158 | 159 | return flag; 160 | }; 161 | } 162 | 163 | export function isFunctionCall() { 164 | return function (element, tokens, cleaned_sourcedata, i) { 165 | if (!Keywords.includes(cleaned_sourcedata[i - 1])) { 166 | const CheckFunctionExpression = element.split('('); 167 | 168 | const token = tokens.find((el) => el.type == 'function' && el.value == CheckFunctionExpression[0]); 169 | 170 | return token != undefined; 171 | } 172 | }; 173 | } 174 | -------------------------------------------------------------------------------- /src/lib/Interpretor(temp)/scanner/main.js: -------------------------------------------------------------------------------- 1 | //To check variable types: Number, String, Array etc. 2 | 3 | import * as TypeCheck from '../TypeCheck/TypeChecking'; 4 | 5 | //To check other operations like MultiString, Arithmetic Operation etc. 6 | import * as AdvancedTypeCheck from '../TypeCheck/AdvancedTypeChecking'; 7 | 8 | //SECTION - Checking for type of characters. TypeCheck is an object which consists all self functions. Check Line 102 9 | 10 | const isVariable = TypeCheck.isVariable(); 11 | 12 | const isNumber = TypeCheck.isNumber(); 13 | 14 | const isOperator = TypeCheck.isOperator(); 15 | 16 | const isPrintOperation = TypeCheck.isPrintOperation(); 17 | const isConditionalKeyword = TypeCheck.isConditionalKeyword(); 18 | const isForLoop = TypeCheck.isForLoop(); 19 | const isFunction = TypeCheck.isFunction(); 20 | const isFunctionCall = TypeCheck.isFunctionCall(); 21 | const isNativeOperation = TypeCheck.isNativeOperation(); 22 | 23 | //needs work 24 | const isExpression = TypeCheck.isExpression(); 25 | 26 | const isArray = TypeCheck.isArray(); 27 | const isInput = TypeCheck.isInput(); 28 | 29 | const isSetArrayIndexValue = TypeCheck.isSetArrayIndexValue(); 30 | 31 | // const isEmptyArrayInit = TypeCheck.isEmptyArrayInit() 32 | 33 | const isString = TypeCheck.isString(); 34 | const isinvalidString = TypeCheck.isinvalidString(); 35 | 36 | 37 | //if parser encounters anything like (" or (, then that's a realtime print. 38 | 39 | //buildstring will be applied now to create a string and push it into tokens. Buildstring is used to combine string tokens like 40 | //['hello', 'Kalaam', 'developers', "!"] into 'hello kalaam developers!'. 41 | 42 | //It's becausRc=e sourcecode is an array of tokens and each token is an individual word in a program. 43 | 44 | //It's recommended to look at sourcecode of every program to understand how it converts plain text into array of individual words. 45 | 46 | const isRealTimePrintMultipleString = AdvancedTypeCheck.isRealTimePrintMultipleString(); 47 | 48 | //const isStringandValue = AdvancedTypeCheck.isStringandValue() 49 | 50 | const isCalculation = AdvancedTypeCheck.isCalculation(); 51 | 52 | function Scanner(sourcecode, i, tokens) { 53 | var el = sourcecode[i]; 54 | 55 | var type = isVariable(el) 56 | ? 'VARIABLE' 57 | : isNumber(el) 58 | ? 'NUMBER' 59 | : isinvalidString(el) 60 | ? 'EMPTY_STRING' 61 | : isInput(el) 62 | ? 'INPUT' 63 | : isOperator(el) 64 | ? 'OPERATOR' 65 | : isPrintOperation(el, sourcecode, i) 66 | ? 'PRINT' 67 | : isFunction(el) 68 | ? 'FUNCTION' 69 | : isArray(el) 70 | ? 'ARRAY' 71 | : isSetArrayIndexValue(el, sourcecode, i) 72 | ? 'SET_ARRAY_INDEX' 73 | : isSetArrayIndexValue(el, sourcecode, i) == false 74 | ? 'GET_ARRAY_INDEX' 75 | : isConditionalKeyword(el) 76 | ? 'CONDITIONAL_KEYWORD' 77 | : el.includes('पुश') 78 | ? 'PUSH_TO_ARRAY' 79 | : isForLoop(el) 80 | ? 'FOR_LOOP' 81 | : isCalculation(el) 82 | ? 'CALCULATION' 83 | : isRealTimePrintMultipleString(el) 84 | ? 'REALTIME_PRINT' 85 | : isString(el) 86 | ? 'STRING' 87 | : isFunctionCall(el, tokens, sourcecode, i) 88 | ? 'FUNCTION_CALL' 89 | : isNativeOperation(el) 90 | ? 'NATIVE_OPERATION' 91 | : isExpression(el) && el.includes('[') && el.includes(']') 92 | ? 'ARRAY_PUSH' 93 | : 'UNKNOWN'; 94 | 95 | return type; 96 | } 97 | 98 | export default Scanner; 99 | 100 | /*\\ 101 | else if isExpression(el) && !isCalculation(el) && !el.includes("[") && !el.includes("]") && (!isConditionalKeyword(sourcecode[i - 1])) && (sourcecode[i - 1] != "मे" && sourcecode[i - 1] != "रचना")? 102 | 103 | 104 | 105 | let CheckFunctionExpression = el.split("(") 106 | 107 | let passedValues = RemoveBrackets(CheckFunctionExpression[1]) 108 | passedValues = passedValues.split(",") 109 | token = tokens.find(el => el.value == CheckFunctionExpression[0]) 110 | 111 | 112 | if (token != undefined && sourcecode[i-1]!='दिखाए'? 113 | 114 | PushFunctionExecution(el, tokens, sourcecode, i, passedValues) 115 | 116 | } 117 | else { 118 | 119 | PushExpression(el, tokens) 120 | 121 | } 122 | 123 | } 124 | */ 125 | -------------------------------------------------------------------------------- /src/lib/PushTokens/main.js: -------------------------------------------------------------------------------- 1 | import { RemoveBrackets, operatorType, } from '../Scripts/Helpers'; 2 | import { ActiveLangugaeKeywords, } from '../Compiler/constants'; 3 | //ANCHOR - Functions to push token with type and value into tokens array for further parsing 4 | 5 | function PushVariable(v, tokens) { 6 | tokens.push(v); 7 | } 8 | 9 | function PushString(value, tokens) { 10 | tokens.push({ 11 | type: 'string', 12 | value: value, 13 | }); 14 | } 15 | 16 | function PushVariableValue(value, tokens) { 17 | tokens.push({ 18 | type: 'value', 19 | value: value, 20 | }); 21 | } 22 | 23 | function PushNumber(value, tokens) { 24 | tokens.push({ 25 | type: 'value', 26 | value: value, 27 | }); 28 | } 29 | 30 | function PushOperator(value, tokens) { 31 | let subtype = operatorType(value); 32 | 33 | tokens.push({ 34 | type: 'operator', 35 | value, 36 | subtype, 37 | }); 38 | } 39 | 40 | function PushKeyword(value, tokens) { 41 | value = value.replace('+', ' + '); 42 | let subtype = value === ActiveLangugaeKeywords.Print ? 'print' : 'default'; 43 | 44 | tokens.push({ 45 | type: 'keyword', 46 | value: value, 47 | subtype, 48 | }); 49 | } 50 | function PushConditionalKeyword(value, tokens) { 51 | tokens.push({ 52 | type: 'conditionalkeyword', 53 | value: value, 54 | }); 55 | } 56 | 57 | function PushEmptyArrayInit(tokens, data, i) { 58 | tokens.push({ 59 | type: 'EmptyArrayInit', 60 | value: data[i - 1], 61 | //skipping = 62 | }); 63 | } 64 | 65 | function PushForLoop(value, tokens) { 66 | tokens.push({ 67 | type: 'ForLoopStart', 68 | value: value, 69 | }); 70 | } 71 | 72 | function PushInput(value, tokens, cleaned_sourcedata, i) { 73 | let lastchar = value.charAt(value.length - 1); 74 | 75 | value = lastchar == ',' ? (value = value + cleaned_sourcedata[i + 1]) : value; 76 | 77 | value = RemoveBrackets(value); 78 | 79 | value = value.replace('इनपुट', ''); 80 | 81 | tokens.push({ 82 | type: 'AcceptInput', 83 | value: ' ', 84 | AcceptAs: value, 85 | }); 86 | } 87 | 88 | function PushWhileLoop(value, tokens) { 89 | tokens.push({ 90 | type: 'WhileLoopStart', 91 | value: value, 92 | }); 93 | } 94 | 95 | function PushWhileLoopCondition(value, tokens) { 96 | tokens.push({ 97 | type: 'WhileLoopCondition', 98 | value: value, 99 | }); 100 | } 101 | 102 | function PushForLoopAruguments(element, cleaned_sourcedata, i, tokens) { 103 | //This values will be fixed even though for loop definations change 104 | let iterator = cleaned_sourcedata[i + 1]; 105 | let value = cleaned_sourcedata[i + 3]; 106 | 107 | if (value.includes('(') && value.includes(',')) { 108 | let Range = RemoveBrackets(value).split(','); 109 | let iterationStart = Range[0]; 110 | let iterationEnd = Range[1]; 111 | 112 | // let k = i + 5; 113 | 114 | PushArgs(iterator, value, iterationStart, iterationEnd); 115 | 116 | //run a function to collect arguments 117 | } else { 118 | let Range = RemoveBrackets(cleaned_sourcedata[i + 5]).split(','); 119 | 120 | let iterationStart = Range[0]; 121 | let iterationEnd = Range[1]; 122 | 123 | //let k = i + 6; 124 | 125 | PushArgs(iterator, value, iterationStart, iterationEnd); 126 | } 127 | 128 | //to get (2,9) into start=2 and end=9 129 | 130 | //run a function to store sourcedata 131 | 132 | function PushArgs(iterator, value, iterationStart, iterationEnd) { 133 | tokens.push({ 134 | type: 'ForLoopArguments', 135 | iterator: iterator, 136 | value: value, 137 | iterationStart: iterationStart, 138 | iterationEnd: iterationEnd, 139 | }); 140 | } 141 | } 142 | 143 | function PushCondition(value, tokens) { 144 | tokens.push({ 145 | type: 'condition', 146 | value: value, 147 | }); 148 | } 149 | 150 | function PushToArray(value, tokens) { 151 | tokens.push({ 152 | type: 'PushToArray', 153 | value: value, 154 | }); 155 | } 156 | 157 | function PushExpression(value, tokens) { 158 | tokens.push({ 159 | type: 'expression', 160 | value: value, 161 | }); 162 | } 163 | 164 | function PushNativeOperation(value, tokens) { 165 | tokens.push({ 166 | type: 'NativeOperation', 167 | value: value, 168 | }); 169 | } 170 | 171 | 172 | 173 | 174 | function PushFunctionData(value, tokens, sourcedata, i) { 175 | let functionName = sourcedata[i + 1]; 176 | let functionNameSplit = functionName.split('('); 177 | let functionArguments = RemoveBrackets(functionNameSplit[1]); 178 | // 179 | functionArguments = functionArguments.split(','); 180 | 181 | tokens.push({ 182 | type: 'function', 183 | value: functionNameSplit[0], 184 | arguments: functionArguments, 185 | FunctionInvocation: false, 186 | FunctionStack: [], 187 | }); 188 | } 189 | 190 | function PushFunctionExecution(value, tokens, sourcedata, i, passedValues) { 191 | let functionName = value; 192 | let functionNameSplit = functionName.split('('); 193 | let functionArguments = RemoveBrackets(functionNameSplit[1]); 194 | // 195 | functionArguments = functionArguments.split(','); 196 | 197 | tokens.push({ 198 | type: 'functionExecution', 199 | value: functionNameSplit[0], 200 | arguments: functionArguments, 201 | FunctionInvocation: true, 202 | passedValues: passedValues, 203 | }); 204 | } 205 | 206 | function PushArray(value, tokens) { 207 | if (value.includes('(') && value.includes(')')) { 208 | value = RemoveBrackets(value); 209 | 210 | value = value.replace(']', ''); 211 | 212 | let Split = value.split('['); 213 | 214 | let IndexInput = Split[1]; 215 | 216 | value = value + ']'; 217 | 218 | tokens.push({ 219 | type: 'Array', 220 | value: value, 221 | IndexInput: IndexInput, 222 | }); 223 | } else { 224 | tokens.push({ 225 | type: 'Array', 226 | value: value, 227 | }); 228 | } 229 | } 230 | 231 | function PushCalculation(value, tokens, cleaned_sourcedata, i, multiCal) { 232 | //not allowing values like Numbers[a] 233 | //revisit this 234 | 235 | if (!(!/\d+/.test(cleaned_sourcedata[i - 2]) && cleaned_sourcedata[i - 2].includes('['))) { 236 | // 237 | 238 | tokens.push({ 239 | type: 'Calculation', 240 | value: value, 241 | multiCal, 242 | }); 243 | } 244 | } 245 | 246 | function PushRealTimePrintOperation(value, tokens) { 247 | tokens.push({ 248 | type: 'value', 249 | value: value, 250 | mode: 'RealTimePrint', 251 | }); 252 | } 253 | 254 | function PushStringandValueOperation(value, tokens) { 255 | tokens.push({ 256 | type: 'value', 257 | value: value, 258 | mode: 'StringandValue', 259 | }); 260 | } 261 | 262 | export { 263 | PushVariableValue, 264 | PushNativeOperation, 265 | PushToArray, 266 | PushFunctionExecution, 267 | PushFunctionData, 268 | PushInput, 269 | PushArray, 270 | PushEmptyArrayInit, 271 | PushCalculation, 272 | PushConditionalKeyword, 273 | PushCondition, 274 | PushWhileLoop, 275 | PushWhileLoopCondition, 276 | PushForLoop, 277 | PushForLoopAruguments, 278 | PushExpression, 279 | PushKeyword, 280 | PushNumber, 281 | PushOperator, 282 | PushRealTimePrintOperation, 283 | PushString, 284 | PushStringandValueOperation, 285 | PushVariable, 286 | }; 287 | -------------------------------------------------------------------------------- /src/lib/Scripts/BuildOperations.js: -------------------------------------------------------------------------------- 1 | 2 | function RemoveBrackets(element){ 3 | 4 | let a = element.replace('(', ''); 5 | let b = a.replace(')', ''); 6 | let c = b.replace('}', ''); 7 | let d = c.replace('{', ''); 8 | 9 | return d; 10 | 11 | } 12 | 13 | 14 | //This are all build operations. 15 | //They are used to unify a string, a condition or array. 16 | 17 | //Cleaned_sourcedata stores data in tokens, i.e individual words . 18 | 19 | //To peform operations we have to get them in one piece, here is where we do that 20 | 21 | 22 | export function BuildString() { 23 | 24 | 25 | return function(element,i,cleaned_sourcedata){ 26 | 27 | 28 | var foundString = ''; 29 | 30 | //the flag is introduced to remove spaces introduced in strings. e.g " swanand kadam" 31 | var flag=0; 32 | 33 | let k = i; 34 | 35 | 36 | 37 | for ( k; k < cleaned_sourcedata.length; k++) { 38 | 39 | let item = cleaned_sourcedata[k - 1].charAt(cleaned_sourcedata[k - 1].length - 1); 40 | 41 | 42 | if (item == '"' || item == '\'') 43 | 44 | { 45 | break; 46 | } 47 | if(flag==1){ 48 | 49 | foundString = foundString + ' ' + cleaned_sourcedata[k]; 50 | 51 | } 52 | 53 | if(flag==0){ 54 | 55 | foundString = cleaned_sourcedata[k]; 56 | flag=1; 57 | 58 | } 59 | 60 | 61 | 62 | } 63 | return foundString; 64 | 65 | 66 | 67 | }; 68 | } 69 | 70 | export function BuildArray() { 71 | 72 | 73 | return function(element,i,cleaned_sourcedata){ 74 | 75 | var foundArray = ''; 76 | 77 | //the flag is introduced to remove spaces introduced in Arrays. e.g " swanand kadam" 78 | var flag=0; 79 | 80 | let k = i; 81 | 82 | 83 | 84 | for ( k; k < cleaned_sourcedata.length; k++) { 85 | 86 | let item = cleaned_sourcedata[k - 1].charAt(cleaned_sourcedata[k - 1].length - 1); 87 | 88 | 89 | 90 | if (item == ']') 91 | 92 | { 93 | break; 94 | } 95 | if(flag==1){ 96 | 97 | foundArray = foundArray + ' ' + cleaned_sourcedata[k]; 98 | 99 | 100 | } 101 | 102 | if(flag==0){ 103 | 104 | foundArray = cleaned_sourcedata[k]; 105 | flag=1; 106 | 107 | 108 | } 109 | 110 | 111 | 112 | 113 | } 114 | 115 | 116 | return foundArray; 117 | 118 | }; 119 | 120 | 121 | } 122 | 123 | export function BuildCondition() { 124 | 125 | 126 | return function(element,i,cleaned_sourcedata){ 127 | 128 | var foundString = ''; 129 | 130 | let k = i+1; // +1 to skip if, else etc and acquire condition 131 | 132 | 133 | 134 | for ( k; k < cleaned_sourcedata.length; k++) { 135 | 136 | // let item = cleaned_sourcedata[k - 1].charAt(cleaned_sourcedata[k - 1].length - 1); 137 | 138 | 139 | if (cleaned_sourcedata[k] == '{' || cleaned_sourcedata[k] == '){' || cleaned_sourcedata[k] == ') {' ) 140 | 141 | { 142 | break; 143 | } else { 144 | 145 | foundString = foundString + ' ' + cleaned_sourcedata[k]; 146 | 147 | } 148 | 149 | 150 | } 151 | 152 | foundString=RemoveBrackets(foundString); 153 | 154 | foundString=foundString.replace(' ', ''); 155 | 156 | return foundString; 157 | 158 | 159 | 160 | }; 161 | } 162 | 163 | 164 | 165 | -------------------------------------------------------------------------------- /src/lib/Scripts/DataCleaning.js: -------------------------------------------------------------------------------- 1 | function SourceDataReplaceforEasyParsing(data) 2 | 3 | { 4 | 5 | 6 | 7 | data = data.replace(/दिखाए/g, ' दिखाए '); 8 | data = data.replace(/दाखवा/g, ' दाखवा '); 9 | data = data.replace(/\( /g, '('); 10 | // data = data.replace(/\)/g, ' )'); 11 | // data = data.replace(/\+ /g, '+'); 12 | data = data.replace(/\= "/g, '="'); 13 | data = data.replace(/\= '/g, '=\''); 14 | 15 | 16 | 17 | 18 | data = data.replace(/\जबतक/g, 'जबतक '); 19 | data = data.replace(/\जोपर्यंत/g, 'जोपर्यंत '); 20 | data = data.replace(/\अन्यथा{/g, 'अन्यथा {'); 21 | 22 | data = data.replace(/\[ /g, '['); 23 | data = data.replace(/\)}/g, ') }'); 24 | data = data.replace(/\){/g, ') {'); 25 | data = data.replace(/\}}/g, '} }'); 26 | data = data.replace(/\को/g, 'को '); 27 | data = data.replace(/\मे{/g, 'मे {'); 28 | data = data.replace(/\अगर/g, 'अगर '); 29 | data = data.replace(/\जर/g, 'जर '); 30 | data = data.replace(/(?:\r\n|\r|\n)/g, ' '); 31 | // data = data.replace(/\==/g, ' == '); 32 | 33 | //preparing data for easy parsing by handling new lines, enters etc. 34 | data = data.replace(/(;|\n|\r|' '| '| ")/gm, '').split(' '); 35 | 36 | return data; 37 | 38 | 39 | } 40 | 41 | 42 | 43 | 44 | 45 | 46 | export { SourceDataReplaceforEasyParsing, }; -------------------------------------------------------------------------------- /src/lib/Scripts/Handlers.js: -------------------------------------------------------------------------------- 1 | import { RemoveQuotes, } from '../Scripts/Helpers'; 2 | import { ActiveLangugaeKeywords, } from '../Compiler/constants'; 3 | import { IsReservedKeyword, } from '../Scripts/main'; 4 | import { HandleBlocks, } from '../Scripts/main'; 5 | function isNumber(element) { 6 | return /^[0-9]*$/gm.test(element); 7 | } 8 | function handleOutput(value, kalaam) { 9 | kalaam.output += value + '\n'; 10 | } 11 | 12 | function handleHygiene(el) { 13 | let restricted = [ 14 | ActiveLangugaeKeywords.If, 15 | 'दुहराओ', 16 | ActiveLangugaeKeywords.While, 17 | ActiveLangugaeKeywords.Print, 18 | 'इनपुट', 19 | 'रचना', 20 | 'को', 21 | 'मे', 22 | ]; 23 | for (const val in el) { 24 | let result = restricted.includes(el[val]) ? 'fail' : 'pass'; 25 | return result; 26 | } 27 | } 28 | 29 | function handleVariable(element, tokens, cleaned_sourcedata, i, nextEl, prevEl) { 30 | let token; 31 | element = RemoveQuotes(element); 32 | 33 | let Datatype = isNumber(element) && element != '' ? 'Number' : 'String'; 34 | 35 | if (nextEl === '=' || prevEl === '=') { 36 | token = { 37 | type: 'variable', 38 | value: element, 39 | Datatype: Datatype, 40 | }; 41 | 42 | return token; 43 | } 44 | } 45 | 46 | function handleRealtimePrint(cleaned_sourcedata, i) { 47 | let foundString = ''; 48 | 49 | let k = i; 50 | 51 | let skip = 0; 52 | 53 | var flag = 0; 54 | 55 | for (k; k < cleaned_sourcedata.length; k++) { 56 | let element = cleaned_sourcedata[k]; 57 | let conditionEnd = element.charAt(element.length - 1) + element.charAt(element.length - 2); 58 | 59 | if (IsReservedKeyword(element)) { 60 | break; 61 | } 62 | 63 | if (conditionEnd == ')"' || element.charAt(element.length - 1) == ')') { 64 | foundString = foundString + ' ' + cleaned_sourcedata[k]; 65 | break; 66 | } else if (flag == 1) { 67 | foundString = foundString + ' ' + cleaned_sourcedata[k]; 68 | } else if (flag == 0) { 69 | foundString = cleaned_sourcedata[k]; 70 | 71 | flag = 1; 72 | } 73 | 74 | skip = skip + 1; 75 | } 76 | 77 | return { foundString, skip, }; 78 | } 79 | 80 | function prepareFunction(mutable_tokens, j) { 81 | //We are preparing the required data to execute a function call later in the prgroam 82 | 83 | //functionsourcedata includes all the tokens from tokens array which belongs to a particular function 84 | 85 | //We find self range or a function block through HandleBlocks function 86 | 87 | let functionSourceData = []; 88 | 89 | let result = HandleBlocks(mutable_tokens, j + 1, functionSourceData); 90 | 91 | functionSourceData = result.StoreResult; 92 | 93 | //To identify function context in tokens array 94 | 95 | functionSourceData.forEach((el) => { 96 | el.context = 'function'; 97 | }); 98 | 99 | return { functionSourceData, }; 100 | } 101 | 102 | export { handleOutput, handleVariable, handleHygiene, handleRealtimePrint, prepareFunction, }; 103 | -------------------------------------------------------------------------------- /src/lib/Scripts/Helpers.js: -------------------------------------------------------------------------------- 1 | function RemoveQuotes(e) { 2 | e = e.replace(/"/g, ''); 3 | e = e.replace(/'/g, ''); 4 | 5 | return e; 6 | } 7 | function earlyCleaning(c) { 8 | //Since html reads '>' and '<' as '>' and '<' respectively, we need to replace it back to the desired way. 9 | 10 | c = c.replace(/</g, '<'); 11 | 12 | c = c.replace(/>/g, '>'); 13 | 14 | c = c.replace(/&/g, '&'); 15 | return c; 16 | } 17 | function RemoveBrackets(e) { 18 | let a = e.replace(/\(/g, ''); 19 | let b = a.replace(/\)/g, ''); 20 | let c = b.replace('}', ''); 21 | let d = c.replace('{', ''); 22 | 23 | return d; 24 | } 25 | 26 | function operatorType(t) { 27 | return t === '=' 28 | ? 'assignment' 29 | : t === '+' 30 | ? 'addition' 31 | : t === '-' 32 | ? 'subtraction' 33 | : t === '*' 34 | ? 'multiplication' 35 | : t === '/' 36 | ? 'division' 37 | : t === '}' 38 | ? 'close_bracket' 39 | : t === '{' 40 | ? 'open_bracket' 41 | : 'unknown'; 42 | } 43 | 44 | //handy count function 45 | 46 | function Count(item, element) { 47 | let count = 0; 48 | 49 | for (let i = 0; i < element.length; i++) { 50 | if (element.charAt(i) == item && element.charAt(i + 1) == item) { 51 | count += 1; 52 | } 53 | } 54 | 55 | return count; 56 | } 57 | 58 | export { earlyCleaning, RemoveQuotes, RemoveBrackets, Count, operatorType, }; 59 | -------------------------------------------------------------------------------- /src/lib/Scripts/HindiChars.js: -------------------------------------------------------------------------------- 1 | 2 | // eslint-disable-next-line no-misleading-character-class 3 | var regex = /(?:^|\s)[\u0900\u0901\u0902\u0903\u0904\u0905\u0906\u0907\u0908\u0909\u090a\u090b\u090c\u090d\u090e\u090f\u0910\u0911\u0912\u0913\u0914\u0915\u0916\u0917\u0918\u0919\u091a\u091b\u091c\u091d\u091e\u091f\u0920\u0921\u0922\u0923\u0924\u0925\u0926\u0927\u0928\u0929\u092a\u092b\u092c\u092d\u092e\u092f\u0930\u0931\u0932\u0933\u0934\u0935\u0936\u0937\u0938\u0939\u093a\u093b\u093c\u093d\u093e\u093f\u0940\u0941\u0942\u0943\u0944\u0945\u0946\u0947\u0948\u0949\u094a\u094b\u094c\u094d\u094e\u094f\u0950\u0951\u0952\u0953\u0954\u0955\u0956\u0957\u0958\u0959\u095a\u095b\u095c\u095d\u095e\u095f\u0960\u0961\u0962\u0963\u0964\u0965\u0966\u0967\u0968\u0969\u096a\u096b\u096c\u096d\u096e\u096f\u0970\u0971\u0972\u0973\u0974\u0975\u0976\u0977\u0978\u0979\u097a\u097b\u097c\u097d\u097e\u097f]+?(?:\s|$)/g; 4 | 5 | 6 | export default regex; -------------------------------------------------------------------------------- /src/lib/Scripts/finders.js: -------------------------------------------------------------------------------- 1 | import { GetcleanedExpression, } from '../Scripts/main'; 2 | 3 | function findtokenPositioninCode(source, mycode, shoudlclean) { 4 | mycode = shoudlclean ? GetcleanedExpression(mycode) : mycode; 5 | 6 | for (let x = 0; x < source.length; x++) { 7 | source[x] = shoudlclean ? GetcleanedExpression(source[x]) : source[x]; 8 | 9 | if (source[x].includes(mycode)) { 10 | return x + 1; 11 | } 12 | } 13 | } 14 | 15 | export { findtokenPositioninCode, }; 16 | -------------------------------------------------------------------------------- /src/lib/Scripts/testers.js: -------------------------------------------------------------------------------- 1 | function isInterpretableType(t) { 2 | let non_types = ['variable', 'Array', 'close_bracket', 'open_bracket', 'value',]; 3 | 4 | if (non_types.includes(t)) { 5 | return false; 6 | } else { 7 | return true; 8 | } 9 | } 10 | 11 | export { isInterpretableType, }; 12 | -------------------------------------------------------------------------------- /src/lib/TypeCheck/AdvancedTypeChecking.js: -------------------------------------------------------------------------------- 1 | 2 | 3 | export function isPureEval(){ 4 | 5 | 6 | return function(element){ 7 | 8 | if(/^([-+]?[0-9]*\.?[0-9]+[\/\+\-\*])+([-+]?[0-9]*\.?[0-9]+)*$/gm.test(element)) 9 | { 10 | 11 | return true; 12 | 13 | } 14 | }; 15 | 16 | } 17 | 18 | 19 | 20 | 21 | //if parser encounters anything like (" or (, then that's a realtime print. 22 | //buildstring will be applied now to create a string and push it into tokens 23 | 24 | export function isRealTimePrintMultipleString (){ 25 | 26 | 27 | return function(element){ 28 | 29 | 30 | let conditionStart=element.charAt(0); 31 | let lastChar=element.charAt(element.length-1); 32 | 33 | 34 | 35 | //THE Principle condition to proceed building a string after identifyting it as a potential realtimestring 36 | 37 | if(((conditionStart=='(' && lastChar!=')') || (element.includes('("') || element.includes('(\'') ))) 38 | { 39 | 40 | 41 | 42 | return true; 43 | 44 | } 45 | 46 | }; 47 | } 48 | 49 | 50 | export function isStringandValue (){ 51 | 52 | return function(element){ 53 | 54 | let x=element; 55 | 56 | 57 | 58 | if(x.includes('"')&&x.includes('+')) 59 | { 60 | 61 | 62 | return true; 63 | } 64 | 65 | 66 | 67 | }; 68 | } 69 | 70 | 71 | 72 | export function isCalculation() { 73 | 74 | return function(element){ 75 | 76 | if ((element.includes('+') || element.includes('%') || element.includes('-') || element.includes('*') || element.includes('/')) && !element.includes('[') && ((element.includes('(')&& element.includes(')')) || (!element.includes('(')&& !element.includes(')')) ) && element.charAt(element.length-1)!='+' && (element.charAt(0)!='/' || element.charAt(0)!='*' )) { 77 | 78 | return true; 79 | } 80 | 81 | }; 82 | } 83 | 84 | export function isDirectPrintArithmetic(){ 85 | 86 | return function(token){ 87 | if( ( token.includes('+') || token.includes('-') || token.includes('*') || token.includes('/') ) ) 88 | { 89 | 90 | return true; 91 | } 92 | 93 | }; 94 | } -------------------------------------------------------------------------------- /src/lib/TypeCheck/TypeChecking.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable indent */ 2 | import { ActiveLangugaeKeywords } from '../Compiler/constants'; 3 | 4 | const Keywords = [ 5 | ActiveLangugaeKeywords.If, 6 | 'दुहराओ', 7 | ActiveLangugaeKeywords.While, 8 | ActiveLangugaeKeywords.Print, 9 | 'इनपुट', 10 | 'रचना', 11 | 'को', 12 | 'मे', 13 | ]; 14 | 15 | // var PrintKeywordRegex = "^" + "(" + ActiveLangugaeKeywords.Print + ")*$" 16 | // PrintKeywordRegex = new RegExp(PrintKeywordRegex) 17 | 18 | const NativeOperations = ['संख्या']; 19 | 20 | function RemoveBrackets(element) { 21 | const a = element.replace('(', ''); 22 | const b = a.replace(')', ''); 23 | const c = b.replace('}', ''); 24 | const d = c.replace('{', ''); 25 | 26 | return d; 27 | } 28 | 29 | function isArrayOperation(element) { 30 | // To find Patterns like Array[2], Array[index] etc 31 | 32 | element = RemoveBrackets(element); 33 | 34 | if (element.charAt(element.length - 1) == ']' && element.includes('[') && element.charAt(0) != '[') { 35 | return true; 36 | } 37 | } 38 | 39 | export function isVariable() { 40 | return function(element) { 41 | const HindiRegex = /(?:^|\s)[\u0900-\u097F]+?(?:\s|$)/g; 42 | 43 | return /^[a-z]+$/i.test(element) || (HindiRegex.test(element) && !Keywords.includes(element)); 44 | }; 45 | } 46 | export function isNumber() { 47 | return function(element) { 48 | return /^[0-9]*$/gm.test(element); 49 | }; 50 | } 51 | 52 | export function isOperator() { 53 | return function(element) { 54 | return /^(=|}|{)*$/gm.test(element); 55 | }; 56 | } 57 | 58 | export function isInput() { 59 | return function(element) { 60 | return element.includes('इनपुट'); 61 | }; 62 | } 63 | 64 | export function isPrintOperation() { 65 | return function(element) { 66 | return element.includes(ActiveLangugaeKeywords.Print); 67 | }; 68 | } 69 | 70 | export function isConditionalKeyword() { 71 | return function(element) { 72 | return element == ActiveLangugaeKeywords.If || element == ActiveLangugaeKeywords.While || element == 'अन्यथा'; 73 | }; 74 | } 75 | 76 | export function isForLoop() { 77 | return function(element) { 78 | return element == 'दुहराओ'; 79 | }; 80 | } 81 | 82 | export function isWhileLoop() { 83 | return function(element) { 84 | return element == ActiveLangugaeKeywords.While; 85 | }; 86 | } 87 | 88 | export function isFunction() { 89 | return function(element) { 90 | return element == 'रचना'; 91 | }; 92 | } 93 | 94 | // needs work 95 | export function isExpression() { 96 | return function(element) { 97 | return /\(([^)]+)\)/.test(element) || element.includes('()'); 98 | }; 99 | } 100 | 101 | export function isArray() { 102 | return function(element) { 103 | return element.charAt(0) == '['; 104 | }; 105 | } 106 | 107 | export function isSetArrayIndexValue() { 108 | return function(element, data, i) { 109 | element = RemoveBrackets(element); 110 | 111 | if (isArrayOperation(element) && data[i + 1] == '=') { 112 | return true; 113 | } 114 | if (isArrayOperation(element) && (data[i + 1] == '=' || data[i - 1] == '=')) { 115 | return false; 116 | } 117 | }; 118 | } 119 | 120 | export function isEmptyArrayInit() { 121 | return function(element, data, i) { 122 | return element == '=' && data[i + 1] == '[]'; 123 | }; 124 | } 125 | 126 | export function isinvalidString() { 127 | return function(element) { 128 | return ( 129 | element == '"' || 130 | element == "'" || 131 | element == '*' || 132 | element == '$' || 133 | element == '/' || 134 | element == '@' || 135 | element == '|' || 136 | element == '/' || 137 | element == '?' || 138 | element == '#' || 139 | (element.charAt(0) == "'" && element.charAt(element.length - 1) == "'") || 140 | (element.charAt(0) == '"' && element.charAt(element.length - 1) == '"') 141 | ); 142 | }; 143 | } 144 | 145 | export function isString() { 146 | return function(element) { 147 | return element.charAt(0) == "'" || (element.charAt(0) == '"' && !element.includes(ActiveLangugaeKeywords.Print)); 148 | }; 149 | } 150 | 151 | export function isNativeOperation() { 152 | return function(element) { 153 | let flag = false; 154 | 155 | NativeOperations.forEach((el) => { 156 | if (element.includes(el)) { 157 | flag = true; 158 | } 159 | }); 160 | 161 | return flag; 162 | }; 163 | } 164 | 165 | export function isFunctionCall() { 166 | return function(element, tokens, cleaned_sourcedata, i) { 167 | if (!Keywords.includes(cleaned_sourcedata[i - 1])) { 168 | const CheckFunctionExpression = element.split('('); 169 | 170 | const token = tokens.find((el) => el.type == 'function' && el.value == CheckFunctionExpression[0]); 171 | 172 | return token != undefined; 173 | } 174 | }; 175 | } 176 | -------------------------------------------------------------------------------- /src/lib/constants.js: -------------------------------------------------------------------------------- 1 | let ActiveLanguage = localStorage.getItem('ActiveLangugae'); 2 | //console.log("ActiveLangugae: ", ActiveLanguage); 3 | 4 | if (ActiveLanguage == null) { 5 | ActiveLanguage = 'Hindi'; 6 | } 7 | 8 | //console.log('ActiveLangugae: ', ActiveLanguage); 9 | 10 | var ActiveLangugaeKeywords = ''; 11 | 12 | var KalaamKeywords = { 13 | Hindi: { 14 | Print: 'दिखाए', //Still have to change this manually where REGEX are implemented 15 | Input: 'इनपुट', 16 | If: 'अगर', 17 | For: 'दुहराओ', 18 | While: 'जबतक', 19 | Length: 'संख्या', 20 | Push: 'पुश', 21 | Function: 'रचना', 22 | Langugae: 'Hindi', 23 | }, 24 | 25 | Marathi: { 26 | Print: 'दाखवा', //Still have to change this manually where REGEX are implemented 27 | Input: 'इनपुट', 28 | If: 'जर', 29 | For: 'दुहराओ', 30 | While: 'जोपर्यंत', 31 | Length: 'संख्या', 32 | Push: 'पुश', 33 | Function: 'रचना', 34 | Langugae: 'Marathi', 35 | }, 36 | }; 37 | 38 | if (ActiveLanguage == 'Hindi') { 39 | ActiveLangugaeKeywords = KalaamKeywords.Hindi; 40 | } 41 | 42 | if (ActiveLanguage == 'Marathi') { 43 | ActiveLangugaeKeywords = KalaamKeywords.Marathi; 44 | } 45 | 46 | //console.log('ActiveLangugaeKeywords: ', ActiveLangugaeKeywords); 47 | 48 | export { ActiveLangugaeKeywords, KalaamKeywords, }; 49 | -------------------------------------------------------------------------------- /src/lib/scanner/main.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable indent */ 2 | //To check variable types: Number, String, Array etc. 3 | 4 | import * as TypeCheck from '../TypeCheck/TypeChecking'; 5 | 6 | //To check other operations like MultiString, Arithmetic Operation etc. 7 | import * as AdvancedTypeCheck from '../TypeCheck/AdvancedTypeChecking'; 8 | 9 | //SECTION - Checking for type of characters. TypeCheck is an object which consists all self functions. Check Line 102 10 | 11 | const isVariable = TypeCheck.isVariable(); 12 | 13 | const isNumber = TypeCheck.isNumber(); 14 | 15 | const isOperator = TypeCheck.isOperator(); 16 | 17 | const isPrintOperation = TypeCheck.isPrintOperation(); 18 | const isConditionalKeyword = TypeCheck.isConditionalKeyword(); 19 | const isForLoop = TypeCheck.isForLoop(); 20 | const isFunction = TypeCheck.isFunction(); 21 | const isFunctionCall = TypeCheck.isFunctionCall(); 22 | const isNativeOperation = TypeCheck.isNativeOperation(); 23 | 24 | //needs work 25 | const isExpression = TypeCheck.isExpression(); 26 | 27 | const isArray = TypeCheck.isArray(); 28 | const isInput = TypeCheck.isInput(); 29 | 30 | const isSetArrayIndexValue = TypeCheck.isSetArrayIndexValue(); 31 | 32 | // const isEmptyArrayInit = TypeCheck.isEmptyArrayInit() 33 | 34 | const isString = TypeCheck.isString(); 35 | const isinvalidString = TypeCheck.isinvalidString(); 36 | 37 | //if parser encounters anything like (" or (, then that's a realtime print. 38 | 39 | //buildstring will be applied now to create a string and push it into tokens. Buildstring is used to combine string tokens like 40 | //['hello', 'Kalaam', 'developers', "!"] into 'hello kalaam developers!'. 41 | 42 | //It's becausRc=e sourcecode is an array of tokens and each token is an individual word in a program. 43 | 44 | //It's recommended to look at sourcecode of every program to understand how it converts plain text into array of individual words. 45 | 46 | const isRealTimePrintMultipleString = AdvancedTypeCheck.isRealTimePrintMultipleString(); 47 | 48 | //const isStringandValue = AdvancedTypeCheck.isStringandValue() 49 | 50 | const isCalculation = AdvancedTypeCheck.isCalculation(); 51 | 52 | function Scanner(sourcecode, i, tokens) { 53 | var el = sourcecode[i]; 54 | 55 | var type = isVariable(el) 56 | ? 'VARIABLE' 57 | : isNumber(el) 58 | ? 'NUMBER' 59 | : isinvalidString(el) 60 | ? 'EMPTY_STRING' 61 | : isInput(el) 62 | ? 'INPUT' 63 | : isOperator(el) 64 | ? 'OPERATOR' 65 | : isPrintOperation(el, sourcecode, i) 66 | ? 'PRINT' 67 | : isFunction(el) 68 | ? 'FUNCTION' 69 | : isArray(el) 70 | ? 'ARRAY' 71 | : isSetArrayIndexValue(el, sourcecode, i) 72 | ? 'SET_ARRAY_INDEX' 73 | : isSetArrayIndexValue(el, sourcecode, i) == false 74 | ? 'GET_ARRAY_INDEX' 75 | : isConditionalKeyword(el) 76 | ? 'CONDITIONAL_KEYWORD' 77 | : el.includes('पुश') 78 | ? 'PUSH_TO_ARRAY' 79 | : isForLoop(el) 80 | ? 'FOR_LOOP' 81 | : isCalculation(el) 82 | ? 'CALCULATION' 83 | : isRealTimePrintMultipleString(el) 84 | ? 'REALTIME_PRINT' 85 | : isString(el) 86 | ? 'STRING' 87 | : isFunctionCall(el, tokens, sourcecode, i) 88 | ? 'FUNCTION_CALL' 89 | : isNativeOperation(el) 90 | ? 'NATIVE_OPERATION' 91 | : isExpression(el) && el.includes('[') && el.includes(']') 92 | ? 'ARRAY_PUSH' 93 | : 'UNKNOWN'; 94 | 95 | return type; 96 | } 97 | 98 | export default Scanner; 99 | 100 | /*\\ 101 | else if isExpression(el) && !isCalculation(el) && !el.includes("[") && !el.includes("]") && (!isConditionalKeyword(sourcecode[i - 1])) && (sourcecode[i - 1] != "मे" && sourcecode[i - 1] != "रचना")? 102 | 103 | 104 | 105 | let CheckFunctionExpression = el.split("(") 106 | 107 | let passedValues = RemoveBrackets(CheckFunctionExpression[1]) 108 | passedValues = passedValues.split(",") 109 | token = tokens.find(el => el.value == CheckFunctionExpression[0]) 110 | 111 | 112 | if (token != undefined && sourcecode[i-1]!='दिखाए'? 113 | 114 | PushFunctionExecution(el, tokens, sourcecode, i, passedValues) 115 | 116 | } 117 | else { 118 | 119 | PushExpression(el, tokens) 120 | 121 | } 122 | 123 | } 124 | */ 125 | -------------------------------------------------------------------------------- /src/main.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue'; 2 | import App from './App.vue'; 3 | import './registerServiceWorker'; 4 | import store from './store'; 5 | import VueRouter from 'vue-router'; 6 | import router from './router'; 7 | import './quasar'; 8 | 9 | 10 | 11 | 12 | Vue.config.productionTip = false; 13 | 14 | new Vue({ 15 | store, 16 | VueRouter, 17 | router, 18 | render: h => h(App), 19 | }).$mount('#app'); -------------------------------------------------------------------------------- /src/quasar.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue'; 2 | 3 | import './styles/quasar.sass'; 4 | import '@quasar/extras/material-icons/material-icons.css'; 5 | import { Quasar, } from 'quasar'; 6 | 7 | Vue.use(Quasar, { 8 | config: {}, 9 | components: { /* not needed if importStrategy is not 'manual' */ }, 10 | directives: { /* not needed if importStrategy is not 'manual' */ }, 11 | plugins: { 12 | }, 13 | }); -------------------------------------------------------------------------------- /src/registerServiceWorker.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable no-console */ 2 | 3 | /*We are not using service workers foor now 4 | 5 | import { register, } from "register-service-worker"; 6 | 7 | if (process.env.NODE_ENV === "production") { 8 | register(`${process.env.BASE_URL}sw.js`, { 9 | ready () { 10 | console.log( 11 | "App is being served from cache by a service worker.\n" + 12 | "For more details, visit https://goo.gl/AFskqB" 13 | ); 14 | }, 15 | registered () { 16 | console.log("Service worker has been registered."); 17 | }, 18 | cached () { 19 | console.log("Content has been cached for offline use."); 20 | }, 21 | updatefound () { 22 | 23 | 24 | 25 | console.log("New content is downloading."); 26 | }, 27 | updated () { 28 | 29 | console.log("New content is available; please refresh."); 30 | }, 31 | offline () { 32 | console.log("No internet connection found. App is running in offline mode."); 33 | }, 34 | error (error) { 35 | console.error("Error during service worker registration:", error); 36 | }, 37 | }); 38 | } 39 | 40 | 41 | */ -------------------------------------------------------------------------------- /src/router/index.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue'; 2 | import VueRouter from 'vue-router'; 3 | import Home from '../views/Home.vue'; 4 | 5 | 6 | Vue.use(VueRouter); 7 | 8 | const routes = [{ 9 | path: '/', 10 | name: 'Home', 11 | component: Home, 12 | }, 13 | { 14 | path: '/about', 15 | name: 'About', 16 | // route level code-splitting 17 | // this generates a separate chunk (about.[hash].js) for this route 18 | // which is lazy-loaded when the route is visited. 19 | component: () => 20 | import ( /* webpackChunkName: "about" */ '../views/About.vue'), 21 | }, 22 | { 23 | path: '/documentation', 24 | name: 'Documentation', 25 | // route level code-splitting 26 | // this generates a separate chunk (Documentation.[hash].js) for this route 27 | // which is lazy-loaded when the route is visited. 28 | component: () => 29 | import ( /* webpackChunkName: "Documentation" */ '../views/Documentation.vue'), 30 | }, 31 | { 32 | path: '/Practice', 33 | name: 'Practise', 34 | // route level code-splitting 35 | // this generates a separate chunk (Practise.[hash].js) for this route 36 | // which is lazy-loaded when the route is visited. 37 | component: () => 38 | import ( /* webpackChunkName: "Practise" */ '../views/Practise.vue'), 39 | }, 40 | { 41 | path: '/FourOhFour', 42 | name: 'FourOhFour', 43 | // route level code-splitting 44 | // this generates a separate chunk (FourOhFour.[hash].js) for this route 45 | // which is lazy-loaded when the route is visited. 46 | component: () => 47 | import ( /* webpackChunkName: "FourOhFour" */ '../views/FourOhFour.vue'), 48 | }, 49 | 50 | /* { 51 | path: "/Support", 52 | name: "Support", 53 | // route level code-splitting 54 | // this generates a separate chunk (Support.[hash].js) for this route 55 | // which is lazy-loaded when the route is visited. 56 | component: () => import(/* webpackChunkName: "Support" "../views/Support.vue"), 57 | }, 58 | */ 59 | 60 | { 61 | path: '/Examples', 62 | name: 'Examples', 63 | // route level code-splitting 64 | // this generates a separate chunk (Examples.[hash].js) for this route 65 | // which is lazy-loaded when the route is visited. 66 | component: () => 67 | import ( /* webpackChunkName: "Examples" */ '../views/Examples.vue'), 68 | }, 69 | 70 | ]; 71 | 72 | const router = new VueRouter({ 73 | mode: 'history', 74 | //base: process.env.BASE_URL, 75 | routes, 76 | }); 77 | 78 | export default router; -------------------------------------------------------------------------------- /src/store/index.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue'; 2 | import Vuex from 'vuex'; 3 | 4 | Vue.use(Vuex); 5 | 6 | export default new Vuex.Store({ 7 | state: { 8 | 9 | CurrentCode: '', 10 | LearningOn: false, 11 | PractiseOn: true, 12 | ActiveLanguage: '', 13 | }, 14 | mutations: { 15 | 16 | changeMode(state) { 17 | 18 | if (state.LearningOn == true) 19 | 20 | { 21 | 22 | state.PractiseOn = true; 23 | state.LearningOn = false; 24 | 25 | 26 | 27 | } else if (state.PractiseOn == true) { 28 | state.LearningOn = true; 29 | state.PractiseOn = false; 30 | 31 | 32 | } 33 | 34 | 35 | }, 36 | changeActiveLanguage(state, payload) { 37 | 38 | 39 | state.ActiveLanguage = payload; 40 | 41 | 42 | }, 43 | 44 | 45 | 46 | }, 47 | actions: { 48 | 49 | 50 | 51 | }, 52 | modules: {}, 53 | }); -------------------------------------------------------------------------------- /src/styles/quasar.sass: -------------------------------------------------------------------------------- 1 | @import './quasar.variables.sass' 2 | @import '~quasar-styl' 3 | // @import '~quasar-addon-styl' 4 | -------------------------------------------------------------------------------- /src/styles/quasar.variables.sass: -------------------------------------------------------------------------------- 1 | // It's highly recommended to change the default colors 2 | // to match your app's branding. 3 | 4 | $primary : #027BE3 5 | $secondary : #26A69A 6 | $accent : #9C27B0 7 | 8 | $dark : #1D1D1D 9 | 10 | $positive : #21BA45 11 | $negative : #C10015 12 | $info : #31CCEC 13 | $warning : #F2C037 14 | 15 | @import '~quasar-variables-styl' 16 | -------------------------------------------------------------------------------- /src/views/About.vue: -------------------------------------------------------------------------------- 1 | 106 | 107 | 130 | 131 | 318 | -------------------------------------------------------------------------------- /src/views/Examples.vue: -------------------------------------------------------------------------------- 1 | 784 | 785 | 842 | 843 | 844 | 845 | 962 | -------------------------------------------------------------------------------- /src/views/FourOhFour.vue: -------------------------------------------------------------------------------- 1 | ; -------------------------------------------------------------------------------- /src/views/Home.vue: -------------------------------------------------------------------------------- 1 | 92 | 93 | 174 | 175 | 176 | -------------------------------------------------------------------------------- /src/views/Support.vue: -------------------------------------------------------------------------------- 1 | 51 | 52 | 78 | 79 | 80 | -------------------------------------------------------------------------------- /test/examples/(Example2).test.js: -------------------------------------------------------------------------------- 1 | import Compile from "../../src/lib/Compiler/main"; 2 | import { example2 } from "../../src/exampleCodes/example2"; 3 | import Data from "../../src/exampleCodes/kalaamData"; 4 | 5 | test("compiles example2 sample code from examples", () => { 6 | const expected = [ 7 | " | Test Sign | ", 8 | " | Test Sign | ", 9 | " | Test Sign | ", 10 | " | Test Sign | ", 11 | " | Test Sign | ", 12 | " | Test Sign | ", 13 | " | Test Sign | ", 14 | " | Test Sign | ", 15 | " | Test Sign | ", 16 | " | Test Sign | ", 17 | " | Test Sign | ", 18 | " | Test Sign | ", 19 | " | Test Sign | ", 20 | " | Test Sign | ", 21 | " | Test Sign | ", 22 | ]; 23 | var { linebylineOutput } = Compile(example2); 24 | expect(linebylineOutput).toStrictEqual(expected); 25 | }); 26 | -------------------------------------------------------------------------------- /test/examples/bintodec.test.js: -------------------------------------------------------------------------------- 1 | import Compile from "../../src/lib/Compiler/main"; 2 | import { bintodec } from "../../src/exampleCodes/bintodec"; 3 | 4 | test("Checks Undefined error", () => { 5 | const expected = ["15"]; 6 | var { linebylineOutput } = Compile(bintodec); 7 | expect(linebylineOutput).toStrictEqual(expected); 8 | }); 9 | -------------------------------------------------------------------------------- /test/examples/calculator(Example1).test.js: -------------------------------------------------------------------------------- 1 | import Compile from "../../src/lib/Compiler/main"; 2 | import { calculator } from "../../src/exampleCodes/calculatorEx1"; 3 | import Data from "../../src/exampleCodes/kalaamData"; 4 | 5 | test("compiles calculator sample code from examples", () => { 6 | const expected = ["FirstValue is 10", "SecondValue is 20", "Output is 30"]; 7 | var { linebylineOutput } = Compile(calculator); 8 | expect(linebylineOutput).toStrictEqual(expected); 9 | }); 10 | -------------------------------------------------------------------------------- /test/examples/checkUndefined1.test.js: -------------------------------------------------------------------------------- 1 | import Compile from '../../src/lib/Compiler/main'; 2 | import { undefined1 } from '../../src/exampleCodes/checkUndefined1'; 3 | 4 | test('Checks Undefined error', () => { 5 | const expected = ['ReferenceError: b is not defined']; 6 | var { linebylineOutput } = Compile(undefined1); 7 | expect(linebylineOutput).toStrictEqual(expected); 8 | }); 9 | -------------------------------------------------------------------------------- /test/examples/checkUndefined2.test.js: -------------------------------------------------------------------------------- 1 | import Compile from '../../src/lib/Compiler/main'; 2 | import { undefined2 } from '../../src/exampleCodes/checkundefined2'; 3 | 4 | test('Checks Undefined error', () => { 5 | const expected = ['Cannot set c to undefined : b is undefined ']; 6 | var { linebylineOutput } = Compile(undefined2); 7 | expect(linebylineOutput).toStrictEqual(expected); 8 | }); 9 | -------------------------------------------------------------------------------- /test/examples/condition1.test.js: -------------------------------------------------------------------------------- 1 | import Compile from '../../src/lib/Compiler/main'; 2 | import { condition1 } from '../../src/exampleCodes/condition1'; 3 | import Data from '../../src/exampleCodes/kalaamData'; 4 | 5 | test('Testing For loop', () => { 6 | const expected = ['That works too.']; 7 | var { linebylineOutput } = Compile(condition1); 8 | expect(linebylineOutput).toStrictEqual(expected); 9 | }); 10 | -------------------------------------------------------------------------------- /test/examples/executionstack1.test.js: -------------------------------------------------------------------------------- 1 | import Compile from '../../src/lib/Compiler/main'; 2 | import { executionstack1 } from '../../src/exampleCodes/executionstack1'; 3 | import Data from '../../src/exampleCodes/kalaamData'; 4 | 5 | test('checks execution stack', () => { 6 | const expected = [ 7 | ' Computer ने, "x" को, "11" ये VALUE दे कर अपने Memory में दर्ज(Store) करवाया है |', 8 | ' Computer ने, "y" को, "11" ये VALUE दे कर अपने Memory में दर्ज(Store) करवाया है |', 9 | ' Computer ने, "ऑपरेशन" को, "+" ये VALUE दे कर अपने Memory में दर्ज(Store) करवाया है |', 10 | "कंडीशन ऑपरेशन=='+' , TRUE(सत्य) होने के कारन COMPUTER आगे के कोड को रन करेगा ", 11 | ' Computer सबसे पहले जाँच करता है की क्या, "x+y" को सुलझाने(Solve) करने की ज़रुरत है?\n' + 12 | ' अगर हा, तो Computer "x+y" को Solve करके, "नतीजा" के नाम से Memory में दर्ज(Store)कर देगा | \n' + 13 | ' यहापर , "x+y" की कीमत (Value) , "22" आती है |\n' + 14 | ' इसलिए, Computer "नतीजा" को "22" ये VALUE दे कर अपने Memory में दर्ज(Store) कर देता है |', 15 | "कंडीशन ऑपरेशन=='-' , FALSE(गलत) होने के कारन COMPUTER आगे के कोड को रन नहीं करेगा ", 16 | "कंडीशन ऑपरेशन=='*' , FALSE(गलत) होने के कारन COMPUTER आगे के कोड को रन नहीं करेगा ", 17 | "कंडीशन ऑपरेशन=='/' , FALSE(गलत) होने के कारन COMPUTER आगे के कोड को रन नहीं करेगा ", 18 | ]; 19 | var { ExecutionStack } = Compile(executionstack1); 20 | let stack = []; 21 | 22 | ExecutionStack.forEach((el) => { 23 | stack.push(el.message); 24 | }); 25 | 26 | expect(stack).toStrictEqual(expected); 27 | }); 28 | -------------------------------------------------------------------------------- /test/examples/factorialof.test.js: -------------------------------------------------------------------------------- 1 | import Compile from '../../src/lib/Compiler/main'; 2 | import { factorialOf } from '../../src/exampleCodes/factorialOf'; 3 | 4 | test('Checks factorial', () => { 5 | const expected = ['Factorial of 5 is 120']; 6 | var { linebylineOutput } = Compile(factorialOf); 7 | expect(linebylineOutput).toStrictEqual(expected); 8 | }); 9 | -------------------------------------------------------------------------------- /test/examples/fibonacci.test.js: -------------------------------------------------------------------------------- 1 | import Compile from '../../src/lib/Compiler/main'; 2 | import { fibonacci } from '../../src/exampleCodes/fibonacci'; 3 | import Data from '../../src/exampleCodes/kalaamData'; 4 | 5 | test('Testing For loop', () => { 6 | const expected = ['[0,1,1,2,3,5,8,13,21,34,55]']; 7 | // const fibonaccidata = Data(fibonacci); 8 | var { linebylineOutput } = Compile(fibonacci); 9 | expect(linebylineOutput).toStrictEqual(expected); 10 | }); 11 | -------------------------------------------------------------------------------- /test/examples/forloop.test.js: -------------------------------------------------------------------------------- 1 | import Compile from '../../src/lib/Compiler/main'; 2 | import { forloop } from '../../src/exampleCodes/forloop'; 3 | import Data from '../../src/exampleCodes/kalaamData'; 4 | 5 | test('Testing For loop', () => { 6 | const expected = ['0', '5', '10', '15', '20', '25', '30', '35', '40', '45', '50']; 7 | var { linebylineOutput } = Compile(forloop); 8 | expect(linebylineOutput).toStrictEqual(expected); 9 | }); 10 | -------------------------------------------------------------------------------- /test/examples/forloop2.test.js: -------------------------------------------------------------------------------- 1 | import Compile from "../../src/lib/Compiler/main"; 2 | import { forloop2 } from "../../src/exampleCodes/forloop2"; 3 | import Data from "../../src/exampleCodes/kalaamData"; 4 | 5 | test("Testing For loop", () => { 6 | const expected = ["0 S", "1 W", "2 A", "3 N", "4 A", "5 N", "6 D"]; 7 | var { linebylineOutput } = Compile(forloop2); 8 | expect(linebylineOutput).toStrictEqual(expected); 9 | }); 10 | -------------------------------------------------------------------------------- /test/examples/formname.test.js: -------------------------------------------------------------------------------- 1 | import Compile from '../../src/lib/Compiler/main'; 2 | import { formname } from '../../src/exampleCodes/formname'; 3 | 4 | test('Testing For loop', () => { 5 | const expected = ['t', 'te', 'tes', 'test']; 6 | // const formnamedata = Data(formname); 7 | var { linebylineOutput } = Compile(formname); 8 | expect(linebylineOutput).toStrictEqual(expected); 9 | }); 10 | -------------------------------------------------------------------------------- /test/examples/function1.test.js: -------------------------------------------------------------------------------- 1 | import Compile from '../../src/lib/Compiler/main'; 2 | import { function1 } from '../../src/exampleCodes/function1'; 3 | import Data from '../../src/exampleCodes/kalaamData'; 4 | 5 | test('function testing', () => { 6 | const expected = ['Sachin Tendulkar']; 7 | var { linebylineOutput } = Compile(function1); 8 | expect(linebylineOutput).toStrictEqual(expected); 9 | }); 10 | -------------------------------------------------------------------------------- /test/examples/function2.test.js: -------------------------------------------------------------------------------- 1 | import Compile from "../../src/lib/Compiler/main"; 2 | import { function2 } from "../../src/exampleCodes/function2"; 3 | 4 | test("function testing", () => { 5 | const expected = ["11", "12", "13", "14", "15", "16", "17", "18", "19", "20"]; 6 | var { linebylineOutput } = Compile(function2); 7 | expect(linebylineOutput).toStrictEqual(expected); 8 | }); 9 | -------------------------------------------------------------------------------- /test/examples/multical.test.js: -------------------------------------------------------------------------------- 1 | import Compile from '../../src/lib/Compiler/main'; 2 | import { multical } from '../../src/exampleCodes/multical'; 3 | import Data from '../../src/exampleCodes/kalaamData'; 4 | 5 | test('Testing multi calculation', () => { 6 | const expected = ['50']; 7 | var { linebylineOutput } = Compile(multical); 8 | expect(linebylineOutput).toStrictEqual(expected); 9 | }); 10 | -------------------------------------------------------------------------------- /test/examples/prime.test.js: -------------------------------------------------------------------------------- 1 | import Compile from '../../src/lib/Compiler/main'; 2 | import { primenumber } from '../../src/exampleCodes/primenumber'; 3 | import Data from '../../src/exampleCodes/kalaamData'; 4 | 5 | test('Testing prime number', () => { 6 | const expected = ['11 is a Prime Number']; 7 | var { linebylineOutput } = Compile(primenumber); 8 | expect(linebylineOutput).toStrictEqual(expected); 9 | }); 10 | -------------------------------------------------------------------------------- /test/examples/reverse(Example3).test.js: -------------------------------------------------------------------------------- 1 | import Compile from '../../src/lib/Compiler/main'; 2 | import { reverse } from '../../src/exampleCodes/reverseEx3'; 3 | import Data from '../../src/exampleCodes/kalaamData'; 4 | 5 | test('compiles reverse sample code from examples', () => { 6 | const expected = ['Input String- TestString', 'Reversed String- gnirtStseT']; 7 | var { linebylineOutput } = Compile(reverse); 8 | expect(linebylineOutput).toStrictEqual(expected); 9 | }); 10 | -------------------------------------------------------------------------------- /test/examples/whileloop.test.js: -------------------------------------------------------------------------------- 1 | import Compile from '../../src/lib/Compiler/main'; 2 | import { whileloop } from '../../src/exampleCodes/whileloop'; 3 | import Data from '../../src/exampleCodes/kalaamData'; 4 | 5 | test('Testing while loop', () => { 6 | const expected = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']; 7 | var { linebylineOutput } = Compile(whileloop); 8 | expect(linebylineOutput).toStrictEqual(expected); 9 | }); 10 | -------------------------------------------------------------------------------- /vue.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | "transpileDependencies": [ 3 | "vuetify", 4 | "pwa" 5 | ] 6 | 7 | /* pwa: { 8 | name: 'Kalaam', 9 | themeColor: '#F8E71C', 10 | background_color: '#FFFFFF', 11 | workboxPluginMode: 'InjectManifest', 12 | workboxOptions: { 13 | swSrc: 'public/service-worker.js', 14 | exclude: [ 15 | /\.map$/, 16 | /\._redirects$/, 17 | '_redirects' 18 | ], 19 | excludeChunks: [ 20 | '_redirects' 21 | ] 22 | }, 23 | msTileColor: '#FFFFFF' 24 | } 25 | */, 26 | 27 | pluginOptions: { 28 | quasar: { 29 | importStrategy: 'kebab', 30 | rtlSupport: false 31 | } 32 | }, 33 | 34 | transpileDependencies: [ 35 | 'vuetify', 36 | 'pwa', 37 | 'quasar' 38 | ] 39 | } 40 | --------------------------------------------------------------------------------