简体   繁体   English

自定义UML生成器

[英]Custom UML generator

I have been working on a proprietary industrial system for some time now, and just recently I was asked to make an UML-diagram of what I have done. 我已经在专有工业系统上工作了一段时间,最近才有人要求我将所做的事情制作成UML图。 However, I have worked on several hundred classes and functions, and do not wish to manually create this diagram. 但是,我已经研究了数百种类和函数,并且不希望手动创建此图。

This system is written in a very exotic language (PLC/Structured Text), not commonly used by programmers. 该系统是用非常陌生的语言(PLC /结构化文本)编写的,程序员通常不使用。 The syntax, I'm told, is somewhat Pascal-like, and all files are saved in a collection of XML's. 有人告诉我,这种语法有点像Pascal,所有文件都保存在XML的集合中。 Each XML represent some kind of object, like functions, "function blocks" (essentially classes), "programs" (sort of like a static function), enums or structs. 每个XML代表某种对象,例如函数,“功能块”(本质上是类),“程序”(类似于静态函数),枚举或结构。

These objects typically have a declaration and an implementation tag within the XML. 这些对象通常在XML中具有声明和实现标签。

Parsing this type of code structure is not a difficult task using some standard XML-parser. 使用某些标准的XML解析器,解析这种类型的代码结构并不是一件容易的事。 Using a simple string matcher, I can classify each object and its relation to other objects. 使用简单的字符串匹配器,我可以对每个对象及其与其他对象的关系进行分类。 For the moment being, I have done this using Python. 目前,我已使用Python完成此操作。

My question is, assuming I know the structure of the code (object relations, etc), is there a tool or a programming library that may generate an UML diagram for me? 我的问题是,假设我知道代码的结构(对象关系等),是否有工具或编程库可以为我生成UML图?

I am thinking something like NetworkX , however this does not seem to be able generate the format I need in a simple manner. 我在想类似NetworkX的东西,但是这似乎无法以简单的方式生成我需要格式

Cheers! 干杯!

It can be made using this website, using something like dot format (it is their specific format). 可以使用本网站制作,使用dot格式(这是其特定格式)之类的方法。

As an example, this code: 例如,此代码:

<img src='http://g.gravizo.com/g?
/**
*Structural Things
*@opt commentname
*@note Notes can
*be extended to
*span multiple lines
*/
class Structural{}

/**
*@opt all
*@note Class
*/
class Counter extends Structural {
        static public int counter;
        public int getCounter%28%29;
}

/**
*@opt shape activeclass
*@opt all
*@note Active Class
*/
class RunningCounter extends Counter{}
'>

gives this: 给出以下内容: 类图图像

If I can suggest Acceleo ? 如果我可以建议Acceleo? It implemnts UML2Text specification and is a tool to build generator from UML diagram and is an Eclipse plugin. 它实现了UML2Text规范,并且是从UML图构建生成器的工具,并且是Eclipse插件。

But your language seems so specific that it should be hard to find an existing generator. 但是您的语言似乎太具体了,以致于很难找到现有的生成器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM