I want to explain my C# code which traverses a parse tree for code analysis. It is similar to the following but longer:
private void traverse(ParseTreeNode node)
{
if (node.ChildNodes.Count == 0)
{
return;
}
switch (node.Term.Name.ToUpper())
{
case "FILE":
traverse(node.ChildNodes[0]);
return;
case "PROGRAM":
traverse(node.ChildNodes[0]);
return;
//etc.
}
}
What is the most appropriate UML diagram for showing this? Thanks
Continuing the discussion arisen in the comments after dasblinkenlight's answer, I suggest the following activity diagram as a solution:
Activity diagram puts an emphasis on the sequence of steps in a process/algorithm, decisions made on the way, manipulated data and calculations, eventually concurrent tasks, invocations, etc.
There is always some kind of context to activity diagram. In this case it is a method traverse().
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With