Nauka ta progres transportu (Aug 2021)
Identification of the Program Text and Algorithm Correspondence Based on the Control Graph Constructive-Synthesizing Model
Abstract
Purpose.The main article purpose is to develop and implement the method for identifying the correspondence between the text and the program algorithm represented in the form of a flowchart. As part of the method work conversion of the input data in the graph representation is performed by means of constructive-synthesizing modelling. Methodology. To compare the program text and flowchart, we constructed a mathematical model for converting the program code into a graphical representation on the basis of control structures. To build the model, the apparatus of constructive-synthesizing modeling and its methods were used: specialization, concretization, interpretation and implementation. The graph representation of the text is created taking into account the control operators; the flowcharts are created using a json file containing the description of the diagram elements and their links. To compare the graphs we use the breadth-first search algorithm with the number of identical vertices being counted. To obtain the software implementation of the developed method and models we used the technology of object-oriented programming and CASE-technologies, which are based on the unified modeling language UML. Findings A method is proposed to present the text and the flowchart of the program in a uniform format of the directed graph (control graph) and to evaluate their correspondence by the number of identical vertices. For its formalization and automated usage, we developed constructive-synthesizing models of input data transformers. The program application was developed based on the models and the method. Originality. The methods of constructive-synthesizing modeling in the tasks of processing texts written in artificial languages were further developed. We developed the system of constructors, which transforms text program in C++ into a control graph. Practical value. The results are significant for solving such tasks as assembling program texts for borrowings detection, determining the correspondence of the program algorithms and their software implementations to improve coding skills. The graph representation produced by the developed system of constructors can be used for investigation of influence of optimization and code refactoring on the program complexity using McCabe's metrics.
Keywords