ZEP(Zhong's ES Parser) is a ECMAScript parser implemented in C++ aimed at excellent performance and scalability.
ZEP contains a cli tool and a C++ library.
With cli tool you can parse ES file in command line.
With C++ library you can use ZEP to parse ES source code in your project.
Parse a ES file as a script:
zep --entry=./test.jsParse a ES file as a module:
zep --entry=./test.js --es-moduleDump AST as a file:
zep --entry=./test.js >> ast.jsonHelp:
zep --helpPlease install jemalloc and boost on your mac:
brew install jemalloc boostZEP is built with CMake, so it can be easily integrated to your project.
add_subdirectory(ZEP)
target_include_directories(${PROJECT_NAME} ./ZEP/src)
target_link_libraries(${PROJECT_NAME} zep)ParserCommon::Config config = ParserCommon::Config::Default();
Parser parser(src, config);
auto script = parser.ParseScript();
// or
auto module = parser.ParseModule();
ZEP(release version)'s parsing performance would be nearly 1x faster than other ES parsers implemented in ES(Running on Node.js).
And ZEP's performance is equal to other ES parser implemented in Rust with jemalloc.
The json output of ZEP would as same as esprima. So I think maybe ZEP can be a faster alternative to some ES parsers.
And the WASM version is in the roadmap. The web version of ZEP would be released ASAP.
ZEP can only run on macOS currently. The Linux version would be released as soon as possible. Windows version is in the roadmap, which is considered low priority.