Author Topic: Anyone ever crawled through the symbol tags?  (Read 4564 times)

warnerrs

  • Senior Community Member
  • Posts: 114
  • Hero Points: 4
Anyone ever crawled through the symbol tags?
« on: October 29, 2015, 03:11:47 PM »
SystemVerilog lacks many tools that can extract class diagrams from the source. With a little consideration in how you write your SystemVerilog source files, SE does a pretty good job of tagging class relationships. So, I've wondered if I could maybe crawl through SE's tag database and spit out dot files I could generate UML from.

Has anyone written any SlickC that traverse the tag database for a similar purpose? Would you care to share?

Thanks,
Ryan

patrick

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1818
  • Hero Points: 151
Re: Anyone ever crawled through the symbol tags?
« Reply #1 on: October 29, 2015, 06:05:38 PM »
Do you have some tool that you use to generate UML from graphviz dot files, or do you just do it by hand?

warnerrs

  • Senior Community Member
  • Posts: 114
  • Hero Points: 4
Re: Anyone ever crawled through the symbol tags?
« Reply #2 on: October 29, 2015, 07:30:05 PM »
Syntax for the dot files is pretty straight forward. Writing them by hand would get confusing, but they look like they'd be easy to generate. You just need a traversable AST to start from.

Code: [Select]
dot -Tpng input.dot > output.png
Quote from: input.dot
Code: [Select]
digraph hierarchy {
size="5,5"
node[shape=record,style=filled,fillcolor=gray95]
edge[dir=back, arrowtail=empty]


2[label = "{AbstractSuffixTree|+ text\n+ root|...}"]
3[label = "{SimpleSuffixTree|...| + constructTree()\l...}"]
4[label = "{CompactSuffixTree|...| + compactNodes()\l...}"]
5[label = "{SuffixTreeNode|...|+ addSuffix(...)\l...}"]
6[label = "{SuffixTreeEdge|...|+ compactLabel(...)\l...}"]


2->3
2->4
5->5[constraint=false, arrowtail=odiamond]
4->3[constraint=false, arrowtail=odiamond]
2->5[constraint=false, arrowtail=odiamond]
5->6[arrowtail=odiamond]
}

patrick

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1818
  • Hero Points: 151
Re: Anyone ever crawled through the symbol tags?
« Reply #3 on: October 29, 2015, 08:35:05 PM »
Sure.  I've always thought the hardest problem with automated extraction like that is deciding what public methods to include in the diagram. Unless you're lucky enough to have classes with particularly small interfaces, some of the class nodes end up looking like skyscrapers.

I had a .e file for just doing class relationships, where the arrow points to the subclasses that I've hacked up to pull methods and generate something close enough to what you posted to be a starting point. I can only guarantee that it probably won't set your computer on fire.   I've attached the .e file.  Load it from the command line, and then if you run the "graph_classes" command, it will make a graph of all of the classes in the currently open project.
 

warnerrs

  • Senior Community Member
  • Posts: 114
  • Hero Points: 4
Re: Anyone ever crawled through the symbol tags?
« Reply #4 on: October 29, 2015, 09:39:36 PM »
Thanks. I'll have a look at it.

I'll probably have to make it "methodology aware", and make it ignore the non-interesting things. Maybe I can slurp the associated comment blocks, and look for a pragma which I use to indicate whether or not to draw something. I'm really just trying to map out object handles and class inheritance, I don't really want to see any methods.