How to generate all the leaf to leaf path in an AST?

175 Views Asked by At

Given a JS snippet, how to generate all the leaf-to-leaf path from the AST?

Let’s say the code snippet is:

var answer = 6 * 7;

Example AST: https://esprima.org/demo/parse.html

For this code snippet, I have to generate all the paths from leaf to leaf. I can use any parser like esprima, acorn or any other parser.

I am happy to use the python parser as well https://github.com/Kronuz/esprima-python

Any idea, pointers to open source project is welcome.

0

There are 0 best solutions below