0

I need to parse some javascript code and print a tree of function declarations and calls (and nothing else).

Something like this:

function test3()

function test()
  declares 
    function test2()
      calls test3()
  calls test2()

What is the fastest and easies way to do this ? I have multiple functions and files.

I've tried using Antlr, spent 2 days and finally gave up, it's too complicated for me.

Any help will be appreciated.

  • 1
    try this reference, https://stackoverflow.com/questions/10182387/how-to-generate-call-graphs-for-given-javascript[enter link description here](https://stackoverflow.com/questions/10182387/how-to-generate-call-graphs-for-given-javascript) – sathish kumar Feb 26 '19 at 11:54

1 Answers1

0

Esprima is a JavaScript parser that allows you to get the information you're looking for.

Joao Pereira
  • 573
  • 4
  • 16