I am looking for a package which can display a static dependency tree of code from a single Mathematica notebook or from a list of Mma notebooks. (Of course, to prevent such a tool from producing tons of output, it would be helpful, if one could first generate a list of all symbols of the form _f[___] and also restrict the output to functions stemming from some given contexts, e.g. by providing a list of symbols to be tree-diagrammed at all).

In 1989 a company named Powerline Inc. provided a DOS-program Tree Diagrammer. It created a dependency tree of callers and callees from all code files contained in a list of files. The result was a printed list plus optionally an index telling me which name appeares on which lines on which page in the printed diagram. Of course the text form of the tree diagram could be written to a file instead of a printer.

This documetation tool worked quite well for Basic, dBase, C, Fortran, Modula2 and Pascal, I frequently used it for Modula2, Pascal and for C. The same company also offered a program called Source Print to indent code in those languages according to the code structure and which also generated a cross reference table across all files in the analysis.

Tree Diagrammer could not handle procedure variables, i.e. variables which are assigned procedure entry points to be called called later. Sometimes such constructs are used in system programs. Mma can handle procedure variables, e.g you ca do things like this:

f[x_] := x^2
g = f;

which gives you 9, because f is called.

When I have developed some notebooks or packages grown over time, I often come across the question: - How (through which other symbols) can all symbols from a given list of symbols become invoked?
- Where in my code are those places?

Does anyone know about something close to this working for Mathematica code?

  • $\begingroup$ Is your question a duplicate of (4343)? $\endgroup$ – Mr.Wizard Mar 23 '17 at 4:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.