<?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">izvestswsu</journal-id><journal-title-group><journal-title xml:lang="ru">Известия Юго-Западного государственного университета</journal-title><trans-title-group xml:lang="en"><trans-title>Proceedings of the Southwest State University</trans-title></trans-title-group></journal-title-group><issn pub-type="ppub">2223-1560</issn><issn pub-type="epub">2686-6757</issn><publisher><publisher-name>ЮЗГУ</publisher-name></publisher></journal-meta><article-meta><article-id pub-id-type="doi">10.21869/2223-1560-2025-29-3-99-112</article-id><article-id custom-type="elpub" pub-id-type="custom">izvestswsu-1500</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>ИНФОРМАТИКА, ВЫЧИСЛИТЕЛЬНАЯ ТЕХНИКА И УПРАВЛЕНИЕ</subject></subj-group><subj-group subj-group-type="section-heading" xml:lang="en"><subject>COMPUTER SCIENCE, COMPUTER ENGINEERING AND CONTROL</subject></subj-group></article-categories><title-group><article-title>Модель и реализация компилятора функционального языка Common LISP</article-title><trans-title-group xml:lang="en"><trans-title>Modeling and implementation of Common LISP functional language compiler</trans-title></trans-title-group></title-group><contrib-group><contrib contrib-type="author" corresp="yes"><contrib-id contrib-id-type="orcid">https://orcid.org/0009-0009-8739-2695</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>Chaplygin</surname><given-names>A. A.</given-names></name></name-alternatives><bio xml:lang="ru"><p>Чаплыгин Александр Александрович - кандидат технических наук, доцент, доцент кафедры программной инженерии.</p><p>ул. 50 лет Октября, д. 94, Курск 305040</p></bio><bio xml:lang="en"><p>Aleksandr А. Chaplygin - Cand. of Sci. (Engineering), Associate Professor, Associate Professor of the Software Engineering Department, Southwest State University.</p><p>50 Let Oktyabrya str. 94, Kursk 305040</p></bio><email xlink:type="simple">alex_chaplygin@mail.ru</email><xref ref-type="aff" rid="aff-1"/></contrib></contrib-group><aff-alternatives id="aff-1"><aff xml:lang="ru"><institution>Юго-Западный государственный университет</institution></aff><aff xml:lang="en"><institution>Southwest State University</institution></aff></aff-alternatives><pub-date pub-type="collection"><year>2025</year></pub-date><pub-date pub-type="epub"><day>29</day><month>11</month><year>2025</year></pub-date><volume>29</volume><issue>3</issue><fpage>99</fpage><lpage>112</lpage><permissions><copyright-statement>Copyright &amp;#x00A9; Чаплыгин А.А., 2025</copyright-statement><copyright-year>2025</copyright-year><copyright-holder xml:lang="ru">Чаплыгин А.А.</copyright-holder><copyright-holder xml:lang="en">Chaplygin A.A.</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://izvestswsu.elpub.ru/jour/article/view/1500">https://izvestswsu.elpub.ru/jour/article/view/1500</self-uri><abstract><p>Цель исследований заключается в создании модели компилятора функционального языка Common Lisp, реализации этой модели и тестировании модели компилятора с помощью целевой виртуальной машины, чтобы увеличить скорость выполнения программ.</p><sec><title>Методы</title><p>Методы. С помощью денотационной семантики была построена формальная модель компилятора функционального языка Common Lisp. Компиляция происходит в несколько этапов. На первом этапе исходный язык преобразуется в промежуточный lambda-язык, в котором все макросы раскрываются, встроенные формы преобразуются в аналогичные выражения, а имена переменных заменяются на локальные, глобальные и глубокие ссылки. На втором этапе выражение на промежуточном языке преобразуется из древовидной структуры в линейный список из примитивных инструкций целевой виртуальной машины.</p></sec><sec><title>Результаты</title><p>Результаты. Полученные в результате компиляции примитивные инструкции кодируются с помощью специального ассемблера в числовой код для выполнения на целевой виртуальной машине. Также в результате компиляции получаются список констант и размер памяти необходимый для работы скомпилированной программы. Целевая виртуальная машина состоит из отделов памяти для кодированной программы, констант, глобальных переменных, стека, списка кадров активации, регистров (аккумулятор, указатель стека, указатель команд, текущий кадр активации). Кадры активации представляют собой объекты-массивы, которые хранят указатель на предыдущий кадр, номер уровня глубины вызовов и локальные аргументы. Сборка мусора происходит с помощью метода пометки и очистки.</p></sec><sec><title>Заключение</title><p>Заключение. В результате работы была построена и реализована модель компилятора функционального языка Common Lisp. По сравнению с интерпретатором скорость работы программы возросла в среднем в 20 раз. Дальнейшее увеличение скорости можно достичь с помощью различных оптимизаций компилятора на разных стадиях. Из простых оптимизаций можно отметить: оптимизацию арифметических выражений, устранение лишних команд, упрощение выражений.</p></sec></abstract><trans-abstract xml:lang="en"><p>Purpose of research is to create a compiler model for the functional language Common Lisp, implement this model, and test the compiler model using a target virtual machine to increase the execution speed of programs.</p><sec><title>Methods</title><p>Methods. A formal compiler model of the functional language Common Lisp was built using denotational semantics. Compilation takes place in several stages. At the first stage, the source language is transformed into an intermediate lambda language in which all macros are expanded, embedded forms are transformed into similar expressions, and variable names are replaced with local, global, and deep references. At the second stage, the expression in the intermediate language is transformed from a tree structure into a linear list of primitive instructions of the target virtual machine.</p></sec><sec><title>Results</title><p>Results. The resulting primitive instructions are encoded using a special assembler into numeric code for execution on the target virtual machine. The compilation also results in a list of constants and the amount of memory required for the compiled program to run. The target virtual machine consists of memory sections for the encoded program, constants, global variables, stack, list of activation frames, registers (accumulator, stack pointer, instruction pointer, current activation frame). Activation frames are array objects that store a pointer to the previous frame, the call depth level number, and local arguments. Garbage collection takes place using the tagging and cleaning method.</p></sec><sec><title>Conclusion</title><p>Conclusion. As a result, a Common Lisp functional language compiler model was built and implemented. Compared to the interpreter, the speed of the program has increased by an average of 20 times. Further speed increases can be achieved by using various compiler optimizations at different stages. Of the simple optimizations, it can be noted: optimization of arithmetic expressions, elimination of unnecessary commands, simplification of expressions.</p></sec></trans-abstract><kwd-group xml:lang="ru"><kwd>компилятор</kwd><kwd>байт-код</kwd><kwd>виртуальная машина</kwd><kwd>функциональный язык</kwd><kwd>Common Lisp</kwd><kwd>денотационная семантика</kwd></kwd-group><kwd-group xml:lang="en"><kwd>compiler</kwd><kwd>bytecode</kwd><kwd>virtual machine</kwd><kwd>functional language</kwd><kwd>Common Lisp</kwd><kwd>denotational semantics</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">Sperber Michael, Dybvig R. Kent, Flatt Matthew, Van Straaten Anton; et al. (August 2007). Revised6 Report on the Algorithmic Language Scheme (R6RS). Scheme Steering Committee. Retrieved 2011-09-13.</mixed-citation><mixed-citation xml:lang="en">Sperber Michael, Dybvig R. Kent, Flatt Matthew, Van Straaten Anton; et al. (August 2007). Revised6 Report on the Algorithmic Language Scheme (R6RS). Scheme Steering Committee. Retrieved 2011-09-13.</mixed-citation></citation-alternatives></ref><ref id="cit2"><label>2</label><citation-alternatives><mixed-citation xml:lang="ru">The Racket Manifesto (PDF) / M. Felleisen, R.B. Findler, M. Flatt, S. Krishnamurthi, E. Barzilay, J. McCarthy, S. Tobin-Hochstadt // Proceedings of the First Summit on Advances in Programming Languages; 2015. P. 113–128.</mixed-citation><mixed-citation xml:lang="en">Felleisen M., Findler R.B., Flatt M., Krishnamurthi S., Barzilay E., McCarthy J., Tobin-Hochstadt S. The Racket Manifesto (PDF). Proceedings of the First Summit on Advances in Programming Languages: 2015. 113–128.</mixed-citation></citation-alternatives></ref><ref id="cit3"><label>3</label><citation-alternatives><mixed-citation xml:lang="ru">Абельсон Х., Сассман Д. Структура и интерпретация компьютерных программ, КДУ, 2022. 608 с.</mixed-citation><mixed-citation xml:lang="en">Abelson H., Sussman D. Structure and interpretation of computer programs. KDU; 2022. 608 p. (In Russ.)</mixed-citation></citation-alternatives></ref><ref id="cit4"><label>4</label><citation-alternatives><mixed-citation xml:lang="ru">Hart Tim, Levin Mike. AI Memo 39-The new compiler (PDF). Archived from the original (PDF) on 2020-12-13. Retrieved 2019-03-18.</mixed-citation><mixed-citation xml:lang="en">Hart Tim; Levin Mike. AI Memo 39-The new compiler (PDF). Archived from the original (PDF) on 2020-12-13. Retrieved 2019-03-18.</mixed-citation></citation-alternatives></ref><ref id="cit5"><label>5</label><citation-alternatives><mixed-citation xml:lang="ru">Krishnamurthi Shriram. Programming Languages: Application and Interpretation. 3-thd edition. - Shriram Krishnamurthi, 2022. 376 p.</mixed-citation><mixed-citation xml:lang="en">Krishnamurthi Shriram. Programming Languages: Application and Interpretation. 3rd ed. Shriram Krishnamurthi, 2022. 376 p.</mixed-citation></citation-alternatives></ref><ref id="cit6"><label>6</label><citation-alternatives><mixed-citation xml:lang="ru">Ершов А. П., Покровский С. Б. Эволюция языков программирования // Проблемы информатики. 2017. № 2(35). С. 70-79. EDN ZOLFPJ.</mixed-citation><mixed-citation xml:lang="en">Ershov A. P., Pokrovsky S. B. Evolution of programming languages. Problemy informatiki = Problems of informatics. 2017; (2): 70-79. (In Russ.). EDN ZOLFPJ.</mixed-citation></citation-alternatives></ref><ref id="cit7"><label>7</label><citation-alternatives><mixed-citation xml:lang="ru">Душкин Р. В. Функциональное программирование на языке Haskell. М.: ДМК Пресс, 2016. 608 с.</mixed-citation><mixed-citation xml:lang="en">Dushkin R.V. Functional programming in Haskell. Moscow: DMK Press; 2016. 608 p. (In Russ.)</mixed-citation></citation-alternatives></ref><ref id="cit8"><label>8</label><citation-alternatives><mixed-citation xml:lang="ru">Романов С. С. Ключевые понятия и особенности объектно-ориентированного программирования // Таврический научный обозреватель. 2016. № 12-2(17). С. 141-146. EDN YFXCCN.</mixed-citation><mixed-citation xml:lang="en">Romanov S. S. Key concepts and features of object-oriented programming. Tavricheskii nauchnyi obozrevatel' = Tavricheskiy scientific observer. 2016; (12-2): 141-146. (In Russ.). EDN YFXCCN.</mixed-citation></citation-alternatives></ref><ref id="cit9"><label>9</label><citation-alternatives><mixed-citation xml:lang="ru">Гонцова А. В. Опыт разработки транслятора с языка Ассемблер RISC-V в машинный код // Обработка информации и математическое моделирование: материалы Всероссийской научно-технической конференции, Новосибирск, 24–25 апреля 2024 года. Новосибирск: Сибирский государственный университет телекоммуникаций и информатики, 2024. С. 85-88. DOI 10.55648/OIMM-2024-1-85. EDN DUZEDV.</mixed-citation><mixed-citation xml:lang="en">Gontsova A. V. Experience in Developing a Translator from RISC-V Assembly Language to Machine Code. In: Obrabotka informatsii i matematicheskoe modelirovanie : materialy Vserossiiskoi nauchno-tekhnicheskoi konferentsii = Information Processing and Mathematical Modeling. Proceedings of the All-Russian Scientific and Technical Conference. 2024. Novosibirsk: Siberian State University of Telecommunications and Informatics; 2024. P. 85–88. (In Russ.). DOI 10.55648/OIMM-2024-1-85. EDN DUZEDV.</mixed-citation></citation-alternatives></ref><ref id="cit10"><label>10</label><citation-alternatives><mixed-citation xml:lang="ru">Наркевич А. С. Структура байт-кода виртуальной машины Java // Информационные технологии: материалы 85-й научно-технической конференции профессорско-преподавательского состава, научных сотрудников и аспирантов (с международным участием), Минск, 01–13 февраля 2021 года. Минск: Белорусский государственный технологический университет, 2021. С. 80-82. EDN VLEPYZ.</mixed-citation><mixed-citation xml:lang="en">Narkevich A. S. The structure of the bytecode of the Java virtual machine. In: Informatsionnye tekhnologii: materialy 85-i nauchno-tekhnicheskoi konferentsii professorsko-prepodavatel'skogo sostava, nauchnykh sotrudnikov i aspirantov (s mezhdunarodnym uchastiem) = Information technologies. Materials of the 85th scientific and technical conference of faculty, researchers and graduate students (with international participation. Minsk: Belarusian State Technological University; 2021. P. 80-82. (In Russ.). EDN VLEPYZ.</mixed-citation></citation-alternatives></ref><ref id="cit11"><label>11</label><citation-alternatives><mixed-citation xml:lang="ru">Альфред В. Ахо, Моника С. Лам, Рави Сети, Джеффри. Компиляторы: принципы, технологии и инструментарий. 2-е изд. М.: Диалектика-Вильямс, 2020. 1184 c.</mixed-citation><mixed-citation xml:lang="en">Alfred V. Aho, Monica S. Lam, Ravi Sethi, Jeffrey. Compilers:Principles, Technologies and Tools. 2nd ed. Moscow: Dialectics-Williams; 2020. 1184 p. (In Russ.)</mixed-citation></citation-alternatives></ref><ref id="cit12"><label>12</label><citation-alternatives><mixed-citation xml:lang="ru">Намаконов Е. С., Подкопаев А. В. Компиляция модели памяти OCaml в Power // Труды Института системного программирования РАН. 2019. Т. 31, № 5. С. 63-78. DOI 10.15514/ISPRAS-2019-31(5)-4. EDN GPHUIK.</mixed-citation><mixed-citation xml:lang="en">Namakonov E. S., A. V. Podkopaev Compilation of the OCaml memory model to Power. Trudy Instituta sistemnogo programmirovaniya RAN = Proceedings of the Institute for System Programming of the Russian Academy of Sciences. 2019; 31(5): 63-78. (In Russ.) DOI 10.15514/ISPRAS-2019-31(5)-4. EDN GPHUIK.</mixed-citation></citation-alternatives></ref><ref id="cit13"><label>13</label><citation-alternatives><mixed-citation xml:lang="ru">Джереми Сик. Основы компиляции: инкрементный подход. СПб.: Питер, 2024. 256 с.</mixed-citation><mixed-citation xml:lang="en">Jeremy Sick. Compilation Basics: An Incremental Approach. St.Peterburg: Peter; 2024. 256 p. (In Russ.)</mixed-citation></citation-alternatives></ref><ref id="cit14"><label>14</label><citation-alternatives><mixed-citation xml:lang="ru">Компиляторы: принципы, технологии и инструментарий / Ахо Альфред В., Лам Миника С., Сети Рави, Ульман Джеффри Д. М.: Диалектика-Вильямс, 2018. 1184 с.</mixed-citation><mixed-citation xml:lang="en">Alfred V. Aho, Monica S. Lam, Ravi Sethi, Jeffrey D. Ullman. Networks. Compilers: principles, technologies and tools. Moscow: Dialectics-Williams; 2018. 1184 p. (In Russ.)</mixed-citation></citation-alternatives></ref><ref id="cit15"><label>15</label><citation-alternatives><mixed-citation xml:lang="ru">Сайбель Питер. Практическое использование Common Lisp. М.: ДМК Пресс, 2017. - 488 с.</mixed-citation><mixed-citation xml:lang="en">Seibel Peter. Practical use of Common Lisp. Moscow: DMK Press; 2017. 488 p. (In Russ.)</mixed-citation></citation-alternatives></ref><ref id="cit16"><label>16</label><citation-alternatives><mixed-citation xml:lang="ru">Грэй Пол. ANSI Common LISP. М.: Символ-Плюс, 2020. 448 с.</mixed-citation><mixed-citation xml:lang="en">Paul Graham. ANSI Common LISP. Moscow: Symvol-Plus; 2020. 448 p. (In Russ.)</mixed-citation></citation-alternatives></ref><ref id="cit17"><label>17</label><citation-alternatives><mixed-citation xml:lang="ru">Чаплыгин А.А. Моделирование интерпретатора функционального языка программирования с возможностями метапрограммирования // Известия Юго-Западного государственного университета. Серия: Управление, вычислительная техника, информатика. Медицинское приборостроение. 2024. Т. 14, № 2. С. 181-193. https://doi.org/10.21869/2223-1536-2024-14-2-181-193</mixed-citation><mixed-citation xml:lang="en">Chaplygin A.A. Modeling of a functional programming language interpreter with metaprogramming capabilities. Izvestiya Yugo-Zapadnogo gosudarstvennogo universiteta. Seriya: Upravlenie, vychislitel'naya tekhnika, informatika. Meditsinskoe priborostroenie = Proceedings of the Southwest State University. Series: Control, Computing Engineering, Information Science. Medical Instruments Engineering. 2024;14(2):181-193. (In Russ.). https://doi.org/10.21869/2223-1536-2024-14-2-181-193</mixed-citation></citation-alternatives></ref><ref id="cit18"><label>18</label><citation-alternatives><mixed-citation xml:lang="ru">Владимиров К. И. Оптимизирующие компиляторы. Структура и алгоритмы. М.: АСТ, 2024. 272с.</mixed-citation><mixed-citation xml:lang="en">Vladimirov K. I. Optimizing compilers. Structure and algorithms. Moscow: AST; 2024. 272 p. (In Russ.)</mixed-citation></citation-alternatives></ref><ref id="cit19"><label>19</label><citation-alternatives><mixed-citation xml:lang="ru">Лопес Бруно Кардос, Аулер Рафаэль. LLVM: инфраструктура для разработки компиляторов. М.: ДМК Пресс, 2015. 342 с.</mixed-citation><mixed-citation xml:lang="en">Lopez Bruno Cardos, Auler Rafael. LLVM: An Infrastructure for Compiler Development. Moscow: DMK Press; 2015. 342 p. (In Russ.)</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>
