This topic contains 3 replies, has 2 voices, and was last updated by
September 7, 2017 at 1:06 pm #79012
I'm trying to parse the PowerShell code in a PowerShell project, in order to generate a graph visualization over the 'function hierarchy / call-graph hierarchy' of the PowerShell code. This would be of great help in documenting and understanding the code in a PowerShell project.
I've considered various ways to go at the problem. Where I'm currently at is: I'm going to parse PowerShell code with PowerShell code that looks at the AST and then generate the graph visualization with graphviz. The challenge is how to avoid endless loops and other similar issues when parsing the code. I'm thinking of using the theory of 'directed acyclic graph' (https://en.wikipedia.org/wiki/Directed_acyclic_graph). Thinking that implementing this in code will make it possible to stop parsing 'x' code if it would result in a cyclic loop.....
So, I'm seeking your guidance on if this is a proper approach. Also, if someone here has experience in doing this, or something similar, advice would be greatly appreciated 🙂
I hope I have made myself understandable and I'm looking forward to read your comments and ideas.
Thank you very much.
September 7, 2017 at 1:37 pm #79019
September 11, 2017 at 7:53 am #79226
Hi @max-kozlov (Max Kozlov) and others,
Thank you very much for replying. That module will definitely help. I can use that to parse the AST, so I don't have to code that part myself. However, I still need to continue traversing each function call inside a module file while ensuring/holding it up against the overall gathered data, in order to ensure, that I don't get into cyclic endless cases.
Any ideas on that?
September 17, 2017 at 10:18 am #79943
Anyone else with a suggestion? Thank you.
The topic ‘Generating a graph visualization by parsing a PowerShell project.’ is closed to new replies.