一种C源代码逆向流程图分层重构的方法
A Method of Hierarchical Reconfiguration of Flow Chart Reversing from C Source Code
摘要: 源程序理解在白盒测试以及高校教师批改学生源程序作业代码时发挥着至关重要的作用。然而,人工通过查看一行行风格可能迥异的代码,自主在脑中构筑相应流程再进行测试或评判,是非常低效的。本文提出了一种C源代码逆向流程图分层重构的方法,实现了源代码的可视化,利用分层的抽象性逐步降低源代码的复杂性和缩小源代码的规模,依据源代码结构分类给出了各模块图形的定义,并基于分层法的思想逆向分析源代码,开发了C源代码到多层流程图的自动转化程序,最后通过具体的实例操作,实践了从C源代码到多层程序流程图的自动生成过程。这种源代码逆向分层重构的程序流程图,能很好的显示出来程序的业务逻辑和流程,实现了源代码的可视化,这为白盒测试人员以及源程序作业批改教师等人员,进行高效的程序理解提供了方便。
Abstract: Source-code understanding plays a vital role in white box testing and in correcting students’ source code. However, it is very inefficient to manually build a corresponding process in the brain by testing a line of code that may be very different in style. In this paper, a method of hierarchical reconfiguration of flow graph reversing from C source code is proposed, which realizes the visua-lization of source code, reduces the complexity of source code and reduces the size of source code by stratified abstractness. According to the classification of source code, the definition of each figure of module is given, and the source is analyzed based on the thought of stratification. The automatic transformation program of C source code to multi-layer flow chart is developed. Finally, the automatic generation process from C source code to multi-layer program flow chart is practiced through specific instance operation. The program flow chart of the reconfiguration of the source code can show the business logic and process of the program well, and realize the visualization of the source code. This provides the convenience for the white box testers and the teachers of the C language who must correct programming assignments.
文章引用:冀付军, 王子涛. 一种C源代码逆向流程图分层重构的方法[J]. 软件工程与应用, 2018, 7(3): 168-176. https://doi.org/10.12677/SEA.2018.73020

参考文献

[1] Yue, Y.X. (2012) Developing a Comprehensive Teaching Evaluation System for Foundation Courses with Enhanced Validity and Reliability. Educational Technology Research and Development, 605, 55-60.
[2] Wang, L.-M., Wang, G.-N., Zhou, M.-Y., et al. (2012) Research and Implementation of Algorithm from Program Flowchart to Code. Journal of Xidian University, 39, 80-92.
[3] Martin, C.C., et al. (2004) RAPTOR: Introducing Programming to Non-Majors with Flowcharts. Journal of Computing Science in Colleges, 19, 52-60.
[4] Kains, C. and Somkiat, W. (2006) Visual Programming Using Flowchart. Communication Technologies, Bangkok, ISCIT’06, 1062-1065.
[5] Drazen, L. and Ivan, F. (2011) A Visual Programming Language for Drawing and Executing Flowcharts. Proceedings of the 34th International Convention, Opatija, 23-27 May 2011, 1679-1684.
[6] 严代彪, 王树宗. 一种源程序到程序流程图的自动生成算法[J]. 微计算机信息, 2003(7): 83-65.
[7] 朱云, 曾晓勤, 朱宁, 刘禹锋. 基于图文法的程序流程图与源代码自动转换[J]. 计算机工程与科学, 2015, 37(5): 937-945.
[8] 许秀林, 李蕴华. 基于图元装接模式由程序流程图自动生成源代码[J]. 软件工程, 2016, 19(11): 4-10.
[9] 许晓春, 杜晓晨, 梅琳, 徐永森. 一种改进的程序流程图——层次流程图HFG [J]. 南京大学学报(自然科学版), 2002, 38(2): 158-165.