We don’t allow questions seeking recommendations for software libraries, tutorials, tools, books, or other off-site resources. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(4)
除非您将控制流图硬连接到您的答案中(作业?),否则绘图并不是这个问题的难点。从您的语言的源代码中提取控制流图是。
您的示例显然不是 C#(BEGIN?),因此您需要找到一个语言解析器;
您将需要一些东西来进行名称和类型解析(以处理到标签的 GOTO 或命名块的退出),并将流程图构建为图形数据结构。如果您正在处理类似 GCC(一种具有间接 GOTO 的类 C 语言)之类的内容,则需要进行指针分析来确定间接 GOTO 的可能目标。如果您打算处理 C# 或 Java,您可能能够从类文件中提取控件(有很多相同的问题),然后您必须将其映射回源代码。
如果您有很多可用的机制(解析、名称解析、控制流图构建库)来构建控制流图提取器,那么完成这样的任务是最容易的。 DMS 软件重组工具包提供了所有这些基础,以及许多的解析器语言。对于 C、Java 和 COBOL,DMS 还提供直接提取控制流图,处理所有上述问题,甚至还提供数据流图。请参阅示例控制和数据流图。
Unless you hard-wire the control flow graph into your answer (homework?), the graphing isn't the hard part of this problem. Extracting the control flow graph from the source code of your language is.
Your example is clearly not C# (BEGIN?), so you will need to find a language parser;
you will need something to do name and type resolution (to handle GOTOs to labels or exits of named blocks), and construct a flow graph as a graph data structure. If you are processing something like GCC (a C-like language with indirect GOTOs), you'll need pointer analysis to determine possible targets of indirect GOTOs. If you intend to process C#, or Java, you might be able to extract the control from from the class files (having much the same problems) and then you'll have to map that back to the source code.
It is easiest to do such a task if you have a lot of available machinery (parsing, name-resolution, control-flow graph construction library) on which to build your control-flow graph extractor. The DMS Software Reengineering Toolkit provides all these foundations, as well as parsers for many languages. For C, Java and COBOL, DMS also provides the direct extraction of control flow graphs handling all of the above issues and even data flow graphs too. See sample control and data flow graphs.
一旦您解析了源代码,使用 glee 绘制图形是一项非常简单的任务,要使用 glee 制作图形,您可以遵循这个简单的教程:
http://chalaki.com/how-to-program-msagl-glee-to-create-hierarchical-图形布局/519/
In order to draw a graph using glee is a quite easy task once you have parsed your source code, for making graph using glee you can follow this simple tutorial :
http://chalaki.com/how-to-program-msagl-glee-to-create-hierarchical-graph-layouts/519/
看来您也是 C# 新手,考虑到 GLEE 已经近 2 年不可用了(已被 MSAGL 取代,MSAGL 是一种带有示例的付费产品),我认为您可能会发现很难首先找到任何例子,第二,获得支持。看来您现在可以以 99 美元 的价格购买 MSAGL(原价 295 美元) ),可能值得为节省的时间进行投资。
Looks like you are new to C# as well, given that GLEE hasn't been available for nearly 2 years (having been replaced by MSAGL, a paid product which does come with examples) I think you might find it hard to first, find any examples and second, to get any support. It seems you can get MSAGL for $99 at the moment (down from $295), might be worth the investment for the time saved.
http://research.microsoft。 com/en-us/downloads/f1303e46-965f-401a-87c3-34e1331d32c5/default.aspx
下载附带一个 csharp 示例应用程序
http://research.microsoft.com/en-us/downloads/f1303e46-965f-401a-87c3-34e1331d32c5/default.aspx
the download comes with a csharp sample app