一种从源程序代码到标准流程图的转化方法
2019-06-07宋倩



摘 要:流程图可清晰、直观地表示算法执行流程和程序结构,将程序源码直接转化成流程图的方法多样。流程图结构與程序源码紧密相关,但目前缺乏将流程图标准化的统一方法。因此提出一种将程序源代码转换为标准流程图的方法。首先参照ISO 5807:1985标准,定义标准化流程图节点、边类型及其结构;然后提出将基于特定程序语言的流程图转换为标准化流程图定义的方法;最后通过实例具体说明该方法标准化规则。实验结果表明,该方法将源代码转换为标准流程图的操作行之有效。
关键词:源程序代码;流程图;标准流程图定义;流程图标准化方法
DOI:10. 11907/rjdk. 182612
中图分类号:TP301文献标识码:A文章编号:1672-7800(2019)001-0065-04
Abstract: A flow chart clearly and intuitively represents the execution flow and program structure of the corresponding algorithm. Many methods and tools can directly convert the program source code into a flowchart, but the structure of the obtained flowchart is closely related to the program source code, and there is still no unified method to further standardize the flowchart. This paper presents a method for converting program source code into a standard flowchart. Firstly, by referring to the ISO 5807:1985 standard, the nodes, edge types and their structures of the standardized flowchart are defined. Then, the method of converting the flow chart based on the specific programming language into the standardized flowchart definition is given. Finally, the standardization rules of the method are specifically illustrated by examples. The results show that the method is effective to convert source code to standard flowchart.
0 引言
在软件项目开发过程中,程序流程图是软件开发人员必不可少的工具。流程图一般由平面图节点、边和文字标号构成,可以清晰地表示算法执行流程和程序整体结构。在很多复杂的程序设计过程中,通常先用流程图描述算法整体思路,再依据流程图编写出对应的程序代码。此外,在代码分析中,流程图可清晰地展示程序整体结构,用它分析程序结构远方便于直接分析源程序代码本身[1]。现有许多方法和工具可把程序源码直接转化成流程图[2-5]。但是在实际工作中,利用现有工具得到的流程图与源代码紧密相关,有时将程序代码转换成流程图的工作并不需要体现具体的代码语句,为将流程图进一步标准化,也不仅局限于源程序代码的具体内容,目前还没有一个统一的方法。……
