需要帮助使用 GLEE 和 C# 绘制控制流图

发布于 2024-08-10 08:19:47 字数 1539 浏览 7 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

橘香 2024-08-17 08:19:47

除非您将控制流图硬连接到您的答案中(作业?),否则绘图并不是这个问题的难点。从您的语言的源代码中提取控制流图是。

您的示例显然不是 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.

儭儭莪哋寶赑 2024-08-17 08:19:47

一旦您解析了源代码,使用 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/

装纯掩盖桑 2024-08-17 08:19:47

看来您也是 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文