NabdJS is an Arabic programming language created using JavaScript based on the principles of BASIC and the parsing of JavaScript itself.
You can use the live REPL here.
Nabd code goes through 3 stages:
- Parse
- Generate syntax tree
- Evaluate tree
Parsing is done using Parser class. What it does is simple: take program input as string, split it up, and parse each line separately. If a line starts with a known keyword, a respective NodeGenerator will be used to create the respective Syntax Tree node, just like JS.
Generators are simple classes that parse each line using a simple match and determines what to do based on the result. If it's positive then the generator proceeds to creating the node by creating a new instance of the respective Node class available in Declarations.js.
Evaluation is the most cruicial step of the whole process. An ExpressionEvaluator is used to determine the type of node and the respective evaluator to use, after which the virtual eval method is called and passed a scope and the respective expression. If all is well, the scope will be modified respectivly and the evaluation will complete.
There are multiple error types:
- GenericError: The most generic type
- ParsingError: Errors that happen when parsing the code
- EvaluationError: Errors that occur during evaluation
- Documentation is available at kl13nt.github.io/nabdjs/index.html and the git repo.
NabdJS is copyright (c) 2020-present Nabil Tharwat [email protected].
NabdJS is free software, licensed under the GNU GENERAL PUBLIC LICENSE v3 License. See the file LICENSE in this distribution for more details.