LINQ Js is a transpiler which enables the programmers to use LINQ in JavaScript to support the processing of JavaScript objects. It is made more natural and elegant by allowing the programmer to use LINQ statements directly in JavaScript.
Here is an example showing how programming could be simplified by embedding LINQ into JavaScript.
LINQ Js parses LINQ embedded JavaScript program and transpiles only the LINQ statements into syntactically and semantically valid JavaScript statements, while leaving the rest of the JavaScript statements in the program intact.
After parsing the LINQ statements, it substitutes the corresponding data processing logic statements that are defined for JavaScript. For example,
The interaction between the various components of the systems is depicted as shown below -
- The input consists of a JavaScript program embedded with LINQ statements.
- The transpiler module takes the input and does pre – processing on it to check whether keywords of LINQ are used as keywords in the JavaScript language (which is not allowed).
- The lexer processes the input and starts emitting the tokens.
- When the parser receives a token from the lexer, it either emits the token to the standard output or consumes it as part of the LINQ grammar.
- After the parser consumes a LINQ statement, it reads the template file and emits the corresponding JavaScript code, for the LINQ statement that it has parsed.
Thus, the output consists of syntactically and semantically valid JavaScript program.
$brew install flex
$brew install byacc
Run build.bat on Windows and build.sh on Mac or Ubuntu.
The examples for LINQ Js can be found in the inputs directory.