|
This article is cited in 1 scientific paper (total in 1 paper)
Theory of computing
Transformation of C programming language memory model into object-oriented representation of EO language
A. I. Legalova, Y. G. Bugayenkob, N. K. Chuykina, M. V. Shipitsinc, Ya. I. Riabtseva, A. N. Kamenskiya a National Research University Higher School of Economics, 20, Myasnitskaya str., Moscow 101000, Russia
b Huawei Russian Research Institute, 7-9, Smolenskaya sq., Moscow 121099, Russia
c ITMO University, 49 bldg. A, Kronverksky Pr., St. Petersburg 197101, Russia
Abstract:
The paper analyzes the possibilities of transforming C programming language constructs into objects of EO programming language. The key challenge of the method is the transpilation from a system programming language into a language of a higher level of abstraction, which doesn't allow direct manipulations with computer memory. Almost all application and domain-oriented programming languages disable such direct access to memory. Operations that need to be supported in this case include the use of dereferenced pointers, the imposition of data of different types in the same memory area, and different interpretation of the same data which is located in the same memory address space. A decision was made to create additional EO-objects that directly simulate the interaction with computer memory as in C language. These objects encapsulate unreliable data operations which use pointers. An abstract memory object was proposed for simulating the capabilities of C language to provide interaction with computer memory. The memory object is essentially an array of bytes. It is possible to write into memory and read from memory at a given index. The number of bytes read or written depends on which object is being used. The transformation of various C language constructs into EO code is considered at the level of the compilation unit. To study the variants and analyze the results a transpiler was developed that provides necessary transformations. It is implemented on the basis of Clang, which forms an abstract syntax tree. This tree is processed using LibTooling and LibASTMatchers libraries. As a result of compiling a C program, code in EO language is generated. The considered approach turns out to be appropriate for solving different problems. One of such problems is static code analysis. Such solutions make it possible to isolate low-level code fragments into separate program objects, focusing on their study and possible transformations into more reliable code.
Keywords:
program transformation, procedural programming, object-oriented programming, transpilation, compilation, programming languages.
Received: 07.08.2022 Revised: 01.09.2022 Accepted: 02.09.2022
Citation:
A. I. Legalov, Y. G. Bugayenko, N. K. Chuykin, M. V. Shipitsin, Ya. I. Riabtsev, A. N. Kamenskiy, “Transformation of C programming language memory model into object-oriented representation of EO language”, Model. Anal. Inform. Sist., 29:3 (2022), 246–264
Linking options:
https://www.mathnet.ru/eng/mais779 https://www.mathnet.ru/eng/mais/v29/i3/p246
|
Statistics & downloads: |
Abstract page: | 81 | Full-text PDF : | 23 | References: | 13 |
|