Create your own language!
TypeScript ready!
This is smth like ANTLR...
Install
npm i my-language
How to import?
TypeScript
;
JavaScript
const fragment group or any and maybe parser processor = ;
or
;
Example: calculator implementation
If you wanna use JS, just remove types from this example.
Gramma:
// Skippable fragments ; // Common fragments ;;;;;;;; // Logical groups ;;;;;
Parser:
;
Processor handler:
;
Create processor:
;
Test smaple:
console.logcalculatorProcessor.process"10 * ((12 / 2 ** 2) * 5 + 6) - -10";
Results:
[ 220 ]
Have a good work!