Author Name | Affiliation | Mingcheng Qu | School of Computer Science and Technology, Harbin Institute of Technology, Harbin 150001, China | Naigang Cui | Department of Aerospace Engineering, Harbin Institute of Technology, Harbin 150001, China | Xianghu Wu | School of Computer Science and Technology, Harbin Institute of Technology, Harbin 150001, China | Yongchao Tao | School of Computer Science and Technology, Harbin Institute of Technology, Harbin 150001, China |
|
Abstract: |
Structured flowchart (SFC) and Automatic code generation based on SFC (CG-SFC) have been widely used in software requirements, design and testing phases. Some CG-SFC tools such as Rhapsody have the ability to build flowchart and generate code, but they do not check whether a given flowchart is correct or structural. For unstructured error ‘goto’ statements will be generated randomly. We proposed three algorithms and some error recognition criteria to solve those problems. Structure recognition algorithm can recognize Selection, While/for and do-while structures. Error recognition algorithm incorporating criteria can check all the errors. At last, we develop a CG-SFC system, and compared with existing Rhapsody, it shows that the proposed algorithms are correct and effective. |
Key words: structured flowchart code generation error check feature recognition |
DOI:10.11916/j.issn.1005-9113.15109 |
Clc Number:TP311.5 |
Fund: |
|
Descriptions in Chinese: |
结构化流程图的错误检查和代码生成线性算法 曲明成1,崔乃刚2,吴翔虎1,陶永超1 (1.哈尔滨工业大学 计算机科学与技术学院,哈尔滨150001; 2.哈尔滨工业大学 航天工程系,哈尔滨150001) 创新点说明:提出一种针对结构化流程图的错误检测和代码生成线性算法。该方法可以在结构识别过程中同时检测出流程图中的非结构化错误,并可以生成结构化代码。 研究目的: 现有基于流程图的代码生成算法和工具,不检测流程图中的非结构化错误,将非结构化错误直接生成goto语句。实际应用效果较差。 研究方法: 通过分析结构化流程图中选择和循环结构的基本特征,形成特征识别知识,通过递归算法在递归深入和递归返回时识别结构特征,从而识别出每种判断节点构成的结构和结构退出点。进一步分析基本的非结构化错误的要素,给出多种错误识别准则并融入结构识别算法,完成非结构化错误识别。最后基于识别出的结构信息,对图进行单独一趟深度遍历生成代码。 结果: 通过应用验证和测试,本文算法可以识别出流程图中的各类错误并准确生成代码。与已有工具相比,本文算法不会生成goto语句,且建模过程灵活、简单。 结论: 本文算法是一个纯线性算法,能正确识别出非结构化错误,与已有工具相比建模灵活性更高,可用性更强。 关键词:结构化流程图,代码生成,错误检查,结构特征识别 |