All Projects → evanw → Esprima Cpp

evanw / Esprima Cpp

JavaScript parser in C++ (port of Esprima)

C++ port of Esprima

This is a JavaScript parser with a syntax tree that mostly conforms to the SpiderMonkey parser API. It was a quick port that I did in a couple of hours and doesn't yet support unicode or regular expression validation.

Usage

#include "esprima.h"
#include <iostream>

int main(int argc, char *argv[]) {
  try {
    esprima::Pool pool;
    esprima::Program *program = esprima::parse(pool, "print('hello');");
  } catch (const esprima::ParseError &error) {
    std::cout << "error: " << error.description << std::endl;
  }
  return 0;
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].