I need to obtain the AST of a JS code from C++. I know that Spidermonkey's (unlike V8's generated) ASTs follow a standard that I could use.
Can I pass it a code (string or JS file) from a C++ program and get the AST? If so how?
I need to obtain the AST of a JS code from C++. I know that Spidermonkey's (unlike V8's generated) ASTs follow a standard that I could use.
Can I pass it a code (string or JS file) from a C++ program and get the AST? If so how?
I just answered a similar question here. The short version is:
JS_InitReflect
with your global to instantiate theReflect
object in the global scope (documentation)