1

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?

0

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

2 Comments

acorn requires a node environment to run (npm install), do you know of any javascript parser i can use client-side in-browser (e.g let import parser from 'parser-url' )
@chris Sorry, I do not(

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.