Skip to main content
Log in

Transformation of C Programming Language Memory Model into Object-Oriented Representation of EO Language

  • Published:
Automatic Control and Computer Sciences Aims and scope Submit manuscript

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 does not 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.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Notes

  1. https://www.eolang.org

REFERENCES

  1. Bugayenko, Y., Elegant objects. https://www.elegantobjects.org/.

  2. Bugayenko, Y., Elegant Objects, California: Amazon Kindle Direct Publishing, 2016, vol. 1.

    Google Scholar 

  3. Bugayenko, Y., Elegant Objects, California: Amazon Kindle Direct Publishing, 2017, vol. 2.

    Google Scholar 

  4. Bugayenko, Y., EOLANG and φ-calculus, 2021. https://doi.org/10.48550/arXiv.2111.13384

  5. Saleh, H., Zykov, S., and Legalov, A., Eolang: Toward a new Java-based object-oriented programming language, Intelligent Decision Technologies, Czarnowski, I., Howlett, R.J., and Jain, L.C., Eds., Smart Innovation, Systems and Technologies, vol. 238, Signapore: Springer, 2021, pp. 355–363. https://doi.org/10.1007/978-981-16-2765-130

  6. Saleh, H., Attakorah, J., Zykov, S., and Legalov, A., Exploring the Eolang-Java integration and interoperability, Procedia Comput. Sci., 2021, vol. 192, pp. 4560–4569. https://doi.org/10.1016/j.procs.2021.09.234

    Article  Google Scholar 

  7. Kudasov, N. and Sim, V., Formalizing φ-calculus: A purely object-oriented calculus of decorated objects¸, Proc. ECOOP Workshop on Formal Techniques for Java-like Programs (FTfJP 2022), Berlin: 2022.

  8. Polystat project: Polyglot static analyzer for object-oriented programming languages. https://github.com/polystat.

  9. Bugayenko, Y., Reducing programs to objects, 2021. https://doi.org/10.48550/arXiv.2112.11988

  10. Oberon 07 compiler. https://github.com/vladfolts/oberonjs.

  11. Visual interactive simulations for education and science. https://visual.sfu-kras.ru/.

  12. JSSpeccy 3 a ZX Spectrum emulator in the browser. http://jsspeccy.zxdemo.org/.

  13. JSNES: A JavaScript NES emulator. https://jsnes.org/.

  14. JSLinux. https://bellard.org/jslinux/.

  15. Experimental compiler of C to EO. https://github.com/polystat/c2eo.

  16. Clang: A C language family frontend for LLVM. https://clang.llvm.org/.

  17. Tutorial for building tools using LibTooling and LibASTMatchers. https://clang.llvm.org/docs/LibASTMatchersTutorial.html.

Download references

Funding

This work was supported by ongoing institutional funding. No additional grants to carry out or direct this particular research were obtained.

Author information

Authors and Affiliations

Authors

Corresponding authors

Correspondence to A. I. Legalov, Y. G. Bugayenko, N. K. Chuykin, M. V. Shipitsin, Y. I. Riabtsev or A. N. Kamenskiy.

Ethics declarations

The authors of this work declare that they have no conflicts of interest.

Additional information

Publisher’s Note.

Allerton Press remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Legalov, A.I., Bugayenko, Y.G., Chuykin, N.K. et al. Transformation of C Programming Language Memory Model into Object-Oriented Representation of EO Language. Aut. Control Comp. Sci. 57, 803–816 (2023). https://doi.org/10.3103/S0146411623070088

Download citation

  • Received:

  • Revised:

  • Accepted:

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.3103/S0146411623070088

Keywords:

Navigation