Reputation: 196
I have a JavaScript file which I need to parse and find errors in that. To do so I am planning to convert into an Abstract Syntax Tree (AST), so that I can parse through the nodes.
Can anyone suggest to me how to convert JavaScript into AST?
Upvotes: 1
Views: 2320
Reputation: 13772
You can try https://github.com/acornjs/acorn
Some other parsers are mentioned in https://astexplorer.net — try to change the parser settings and follow the link in the upper right corner.
Upvotes: 1