I wanted a lightweight, tiny parser to be included in one of my other libraries. esprima and other parsers are great, but had more power than I need and were way too large to be included in a library that I wanted to keep relatively small.
First, install Grunt. While in the jsep project directory, run:
npm install .grunt
The jsep built files will be in the build/ directory.
npm install jsep. Then, in your source file:
var jsep = ;var parse_tree = ;
// Add a custom ^ binary operator with precedence 10jsep;// Add a custom @ unary operatorjsep;// Remove a binary operatorjsep;// Remove a unary operatorjsep;
jsep is under the MIT license. See LICENSE file.
Some parts of the latest version of jsep were adapted from the esprima parser.