8000 GitHub - vincentdchan/jetpack.js at v0.0.1-alpha.0
[go: up one dir, main page]

Skip to content

vincentdchan/jetpack.js

Repository files navigation

Zhong's ECMAScript Parser

ZEP(Zhong's ES Parser) is a ECMAScript parser implemented in C++ aimed at excellent performance and scalability.

Usage

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.

Command line

Parse a ES file as a script:

zep --entry=./test.js

Parse a ES file as a module:

zep --entry=./test.js --es-module

Dump AST as a file:

zep --entry=./test.js >> ast.json

Help:

zep --help

Use ZEP as a library

Please install jemalloc and boost on your mac:

brew install jemalloc boost

ZEP 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)

Example

ParserCommon::Config config = ParserCommon::Config::Default();
Parser parser(src, config);

auto script = parser.ParseScript();
// or
auto module = parser.ParseModule();

Performance

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.

Compatibility

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.

Platform

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.

About

A JavaScript bundler and minifier implemented in C++ aimed at excellent performance.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •  

Languages

0