<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Publishing DTD v1.3 20210610//EN" "JATS-journalpublishing1-3.dtd">
<article article-type="research-article" dtd-version="1.3" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xml:lang="ru"><front><journal-meta><journal-id journal-id-type="publisher-id">mais</journal-id><journal-title-group><journal-title xml:lang="ru">Моделирование и анализ информационных систем</journal-title><trans-title-group xml:lang="en"><trans-title>Modeling and Analysis of Information Systems</trans-title></trans-title-group></journal-title-group><issn pub-type="ppub">1818-1015</issn><issn pub-type="epub">2313-5417</issn><publisher><publisher-name>Yaroslavl State University</publisher-name></publisher></journal-meta><article-meta><article-id pub-id-type="doi">10.18255/1818-1015-2022-3-246-264</article-id><article-id custom-type="elpub" pub-id-type="custom">mais-1715</article-id><article-categories><subj-group subj-group-type="heading"><subject>Research Article</subject></subj-group><subj-group subj-group-type="section-heading" xml:lang="ru"><subject>Theory of Computing</subject></subj-group></article-categories><title-group><article-title>Трансформация модели памяти языка программирования C в объектно-ориентированное представление на языке EO</article-title><trans-title-group xml:lang="en"><trans-title>Transformation of C Programming Language Memory Model into Object-Oriented Representation of EO Language</trans-title></trans-title-group></title-group><contrib-group><contrib contrib-type="author" corresp="yes"><contrib-id contrib-id-type="orcid">https://orcid.org/0000-0002-5487-0699</contrib-id><name-alternatives><name name-style="eastern" xml:lang="ru"><surname>Легалов</surname><given-names>Александр Иванович</given-names></name><name name-style="western" xml:lang="en"><surname>Legalov</surname><given-names>Alexander I.</given-names></name></name-alternatives><email xlink:type="simple">alegalov@hse.ru</email><xref ref-type="aff" rid="aff-1"/></contrib><contrib contrib-type="author" corresp="yes"><contrib-id contrib-id-type="orcid">https://orcid.org/0000-0001-6370-0678</contrib-id><name-alternatives><name name-style="eastern" xml:lang="ru"><surname>Бугаенко</surname><given-names>Егор Георгиевич</given-names></name><name name-style="western" xml:lang="en"><surname>Bugayenko</surname><given-names>Yegor G.</given-names></name></name-alternatives><email xlink:type="simple">yegor256@huawei.com</email><xref ref-type="aff" rid="aff-2"/></contrib><contrib contrib-type="author" corresp="yes"><contrib-id contrib-id-type="orcid">https://orcid.org/0000-0001-9645-5525</contrib-id><name-alternatives><name name-style="eastern" xml:lang="ru"><surname>Чуйкин</surname><given-names>Николай Константинович</given-names></name><name name-style="western" xml:lang="en"><surname>Chuykin</surname><given-names>Nickolay K.</given-names></name></name-alternatives><email xlink:type="simple">nchuykin@hse.ru</email><xref ref-type="aff" rid="aff-1"/></contrib><contrib contrib-type="author" corresp="yes"><contrib-id contrib-id-type="orcid">https://orcid.org/0000-0002-4957-5695</contrib-id><name-alternatives><name name-style="eastern" xml:lang="ru"><surname>Шипицин</surname><given-names>Максим Владимирович</given-names></name><name name-style="western" xml:lang="en"><surname>Shipitsin</surname><given-names>Maksim V.</given-names></name></name-alternatives><email xlink:type="simple">mvshipitsin@edu.hse.ru</email><xref ref-type="aff" rid="aff-3"/></contrib><contrib contrib-type="author" corresp="yes"><contrib-id contrib-id-type="orcid">https://orcid.org/0000-0001-5530-3752</contrib-id><name-alternatives><name name-style="eastern" xml:lang="ru"><surname>Рябцев</surname><given-names>Ярослав Иванович</given-names></name><name name-style="western" xml:lang="en"><surname>Riabtsev</surname><given-names>Yaroslav I.</given-names></name></name-alternatives><email xlink:type="simple">yairyabtsev@edu.hse.ru</email><xref ref-type="aff" rid="aff-1"/></contrib><contrib contrib-type="author" corresp="yes"><contrib-id contrib-id-type="orcid">https://orcid.org/0000-0001-5197-310X</contrib-id><name-alternatives><name name-style="eastern" xml:lang="ru"><surname>Каменский</surname><given-names>Андрей Николаевич</given-names></name><name name-style="western" xml:lang="en"><surname>Kamenskiy</surname><given-names>Andrey N.</given-names></name></name-alternatives><email xlink:type="simple">ankamenskiy_1@edu.hse.ru</email><xref ref-type="aff" rid="aff-1"/></contrib></contrib-group><aff-alternatives id="aff-1"><aff xml:lang="ru"><institution>НИУ «Высшая школа экономики»</institution><country>Россия</country></aff><aff xml:lang="en"><institution>National Research University Higher School of Economics</institution><country>Russian Federation</country></aff></aff-alternatives><aff-alternatives id="aff-2"><aff xml:lang="ru"><institution>Российский исследовательский институт Huawei</institution><country>Россия</country></aff><aff xml:lang="en"><institution>Huawei Russian Research Institute</institution><country>Russian Federation</country></aff></aff-alternatives><aff-alternatives id="aff-3"><aff xml:lang="ru"><institution>Национальный исследовательский университет ИТМО</institution><country>Россия</country></aff><aff xml:lang="en"><institution>ITMO University</institution><country>Russian Federation</country></aff></aff-alternatives><pub-date pub-type="collection"><year>2022</year></pub-date><pub-date pub-type="epub"><day>25</day><month>09</month><year>2022</year></pub-date><volume>29</volume><issue>3</issue><fpage>246</fpage><lpage>264</lpage><permissions><copyright-statement>Copyright &amp;#x00A9; Легалов А.И., Бугаенко Е.Г., Чуйкин Н.К., Шипицин М.В., Рябцев Я.И., Каменский А.Н., 2022</copyright-statement><copyright-year>2022</copyright-year><copyright-holder xml:lang="ru">Легалов А.И., Бугаенко Е.Г., Чуйкин Н.К., Шипицин М.В., Рябцев Я.И., Каменский А.Н.</copyright-holder><copyright-holder xml:lang="en">Legalov A.I., Bugayenko Y.G., Chuykin N.K., Shipitsin M.V., Riabtsev Y.I., Kamenskiy A.N.</copyright-holder><license xml:lang="ru" license-type="creative-commons-attribution" xlink:href="https://creativecommons.org/licenses/by/4.0/" xlink:type="simple"><license-p>Данная работа распространяется под лицензией Creative Commons Attribution 4.0.</license-p></license><license xml:lang="en" license-type="creative-commons-attribution" xlink:href="https://creativecommons.org/licenses/by/4.0/" xlink:type="simple"><license-p>This work is licensed under a Creative Commons Attribution 4.0 License.</license-p></license></permissions><self-uri xlink:href="https://www.mais-journal.ru/jour/article/view/1715">https://www.mais-journal.ru/jour/article/view/1715</self-uri><abstract><p>В работе проводится анализ возможностей трансформации конструкций языка программирования C в объекты языка программирования EO. Особенностью рассматриваемого подхода является транспиляция из языка системного программирования в язык с более высоким уровнем абстракции, не поддерживающий непосредственные манипуляции с компьютерной памятью. К действиям, которые в этом случае необходимо поддерживать, относится использование разыменованных указателей, наложение данных различного типа на одну и ту же область памяти, а также различная интерпретация одних и тех же данных, расположенных в одном и том же адресном пространстве памяти. Принято решение о создании дополнительных EO-объектов, напрямую имитирующих непосредственную работу с компьютерной памятью в языке C и инкапсулирующих ненадежные операции с данными посредством указателей. Для отображения возможностей языка C, обеспечивающих взаимодействие с компьютерной памятью, предлагается абстрактный объект-память. Он представляет собой массив байт, при работе с которым возможны запись и чтение по заданному индексу. Для исследования вариантов и анализа полученных результатов разработан транспилятор, обеспечивающий необходимые трансформации. Он реализован на основе Clang, который формирует абстрактное синтаксическое дерево. Обработка этого дерева осуществляется с использованием библиотек LibTooling и LibASTMatchers. Рассмотренный подход оказывается целесообразным при решении ряда задач, к одной из которых относится статический анализ кода. Подобные решения позволяют выделить в отдельные программные объекты низкоуровневые фрагменты кода, акцентировав внимание на их изучении и возможных преобразованиях в более надежный код.</p></abstract><trans-abstract xml:lang="en"><p>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.</p></trans-abstract><kwd-group xml:lang="ru"><kwd>трансформация программ</kwd><kwd>процедурное программирование</kwd><kwd>объектно-ориентированное программирование</kwd><kwd>транспиляция</kwd><kwd>компиляция</kwd><kwd>языки программирования</kwd></kwd-group><kwd-group xml:lang="en"><kwd>program transformation</kwd><kwd>procedural programming</kwd><kwd>object-oriented programming</kwd><kwd>transpilation</kwd><kwd>compilation</kwd><kwd>programming languages</kwd></kwd-group></article-meta></front><back><ref-list><title>References</title><ref id="cit1"><label>1</label><citation-alternatives><mixed-citation xml:lang="ru">Y. Bugayenko, Elegant Objects. [Online]. Available: https://www.elegantobjects.org/.</mixed-citation><mixed-citation xml:lang="en">Y. Bugayenko, Elegant Objects. [Online]. Available: https://www.elegantobjects.org/.</mixed-citation></citation-alternatives></ref><ref id="cit2"><label>2</label><citation-alternatives><mixed-citation xml:lang="ru">Y. Bugayenko, Elegant Objects. California, USA: Amazon Kindle Direct Publishing, 2016, vol. 1, isbn: 9781519166913.</mixed-citation><mixed-citation xml:lang="en">Y. Bugayenko, Elegant Objects. California, USA: Amazon Kindle Direct Publishing, 2016, vol. 1, isbn: 9781519166913.</mixed-citation></citation-alternatives></ref><ref id="cit3"><label>3</label><citation-alternatives><mixed-citation xml:lang="ru">Y. Bugayenko, Elegant Objects. California, USA: Amazon Kindle Direct Publishing, 2017, vol. 2, isbn: 9781534908307.</mixed-citation><mixed-citation xml:lang="en">Y. Bugayenko, Elegant Objects. California, USA: Amazon Kindle Direct Publishing, 2017, vol. 2, isbn: 9781534908307.</mixed-citation></citation-alternatives></ref><ref id="cit4"><label>4</label><citation-alternatives><mixed-citation xml:lang="ru">Y. Bugayenko, EOLANG and ψ-calculus, 2021. arXiv: 2111.13384 [cs.PL].</mixed-citation><mixed-citation xml:lang="en">Y. Bugayenko, EOLANG and ψ-calculus, 2021. arXiv: 2111.13384 [cs.PL].</mixed-citation></citation-alternatives></ref><ref id="cit5"><label>5</label><citation-alternatives><mixed-citation xml:lang="ru">H. Saleh, S. Zykov, and A. Legalov, «Eolang: Toward a New Java-Based Object-Oriented Programming Language», in Intelligent Decision Technologies. Smart Innovation, Systems and Technologies, vol. 238, 2021, pp. 355-363. doi: 10.1007/978-981-16-2765-1_30.</mixed-citation><mixed-citation xml:lang="en">H. Saleh, S. Zykov, and A. Legalov, «Eolang: Toward a New Java-Based Object-Oriented Programming Language», in Intelligent Decision Technologies. Smart Innovation, Systems and Technologies, vol. 238, 2021, pp. 355-363. doi: 10.1007/978-981-16-2765-1_30.</mixed-citation></citation-alternatives></ref><ref id="cit6"><label>6</label><citation-alternatives><mixed-citation xml:lang="ru">H. Saleh, J. Attakorah, S. Zykov, and A. Legalov, «Exploring the Eolang-Java Integration and Interoperability», in Procedia Computer Science. Proceedings of the 25th International Conference KES2021: Knowledge-Based and Intelligent Information &amp; Engineering Systems, vol. 192, 2021, pp. 4560-4569. doi: 10.1016/j.procs.2021.09.234.</mixed-citation><mixed-citation xml:lang="en">H. Saleh, J. Attakorah, S. Zykov, and A. Legalov, «Exploring the Eolang-Java Integration and Interoperability», in Procedia Computer Science. Proceedings of the 25th International Conference KES2021: Knowledge-Based and Intelligent Information &amp; Engineering Systems, vol. 192, 2021, pp. 4560-4569. doi: 10.1016/j.procs.2021.09.234.</mixed-citation></citation-alternatives></ref><ref id="cit7"><label>7</label><citation-alternatives><mixed-citation xml:lang="ru">N. Kudasov and V. Sim, «Formalizing &lt;p-calculus: a purely object-oriented calculus of decorated objects», in Proceedings of the ECOOP Workshop on Formal Techniques for Java-like Programs (FTfJP 2022), Berlin, Germany, 2022.</mixed-citation><mixed-citation xml:lang="en">N. Kudasov and V. Sim, «Formalizing &lt;p-calculus: a purely object-oriented calculus of decorated objects», in Proceedings of the ECOOP Workshop on Formal Techniques for Java-like Programs (FTfJP 2022), Berlin, Germany, 2022.</mixed-citation></citation-alternatives></ref><ref id="cit8"><label>8</label><citation-alternatives><mixed-citation xml:lang="ru">Polystat Project: Polyglot Static Analyzer for Object-Oriented Programming Languages. [Online]. Available: https://github.com/polystat.</mixed-citation><mixed-citation xml:lang="en">Polystat Project: Polyglot Static Analyzer for Object-Oriented Programming Languages. [Online]. Available: https://github.com/polystat.</mixed-citation></citation-alternatives></ref><ref id="cit9"><label>9</label><citation-alternatives><mixed-citation xml:lang="ru">Y. Bugayenko, Reducing Programs to Objects, 2021. arXiv: 2112.11988 [cs.PL].</mixed-citation><mixed-citation xml:lang="en">Y. Bugayenko, Reducing Programs to Objects, 2021. arXiv: 2112.11988 [cs.PL].</mixed-citation></citation-alternatives></ref><ref id="cit10"><label>10</label><citation-alternatives><mixed-citation xml:lang="ru">Oberon 07 compiler. [Online]. Available: https://github.com/vladfolts/oberonjs.</mixed-citation><mixed-citation xml:lang="en">Oberon 07 compiler. [Online]. Available: https://github.com/vladfolts/oberonjs.</mixed-citation></citation-alternatives></ref><ref id="cit11"><label>11</label><citation-alternatives><mixed-citation xml:lang="ru">Visual Interactive Simulations for Education and Science. [Online]. Available: https://visual.sfu-kras.ru/.</mixed-citation><mixed-citation xml:lang="en">Visual Interactive Simulations for Education and Science. [Online]. Available: https://visual.sfu-kras.ru/.</mixed-citation></citation-alternatives></ref><ref id="cit12"><label>12</label><citation-alternatives><mixed-citation xml:lang="ru">JSSpeccy 3 a ZX Spectrum emulator in the browser. [Online]. Available: http://jsspeccy.zxdemo.org/.</mixed-citation><mixed-citation xml:lang="en">JSSpeccy 3 a ZX Spectrum emulator in the browser. [Online]. Available: http://jsspeccy.zxdemo.org/.</mixed-citation></citation-alternatives></ref><ref id="cit13"><label>13</label><citation-alternatives><mixed-citation xml:lang="ru">JSNES A JavaScript NES emulator. [Online]. Available: https://jsnes.org/.</mixed-citation><mixed-citation xml:lang="en">JSNES A JavaScript NES emulator. [Online]. Available: https://jsnes.org/.</mixed-citation></citation-alternatives></ref><ref id="cit14"><label>14</label><citation-alternatives><mixed-citation xml:lang="ru">JSLinux. [Online]. Available: https://bellard.org/jslinux/.</mixed-citation><mixed-citation xml:lang="en">JSLinux. [Online]. Available: https://bellard.org/jslinux/.</mixed-citation></citation-alternatives></ref><ref id="cit15"><label>15</label><citation-alternatives><mixed-citation xml:lang="ru">Experimental compiler of C to EO. [Online]. Available: https://github.com/polystat/c2eo.</mixed-citation><mixed-citation xml:lang="en">Experimental compiler of C to EO. [Online]. Available: https://github.com/polystat/c2eo.</mixed-citation></citation-alternatives></ref><ref id="cit16"><label>16</label><citation-alternatives><mixed-citation xml:lang="ru">Clang: a C language family frontend for LLVM. [Online]. Available: https://clang.llvm.org/.</mixed-citation><mixed-citation xml:lang="en">Clang: a C language family frontend for LLVM. [Online]. Available: https://clang.llvm.org/.</mixed-citation></citation-alternatives></ref><ref id="cit17"><label>17</label><citation-alternatives><mixed-citation xml:lang="ru">Tutorial for building tools using LibTooling and LibASTMatchers. [Online]. Available: https://clang.llvm.org/docs/LibASTMatchersTutorial.html.</mixed-citation><mixed-citation xml:lang="en">Tutorial for building tools using LibTooling and LibASTMatchers. [Online]. Available: https://clang.llvm.org/docs/LibASTMatchersTutorial.html.</mixed-citation></citation-alternatives></ref></ref-list><fn-group><fn fn-type="conflict"><p>The authors declare that there are no conflicts of interest present.</p></fn></fn-group></back></article>
