<?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">ellibs</journal-id><journal-title-group><journal-title xml:lang="ru">Электронные библиотеки</journal-title><trans-title-group xml:lang="en"><trans-title>Russian Digital Libraries Journal</trans-title></trans-title-group></journal-title-group><issn pub-type="epub">1562-5419</issn><publisher><publisher-name>Казанский (Приволжский) федеральный университет</publisher-name></publisher></journal-meta><article-meta><article-id pub-id-type="doi">10.26907/1562-5419-2024-27-6-857-877</article-id><article-id custom-type="elpub" pub-id-type="custom">ellibs-523</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></article-categories><title-group><article-title>Разработка легковесных парсеров с разной детализацией языка Go</article-title><trans-title-group xml:lang="en"><trans-title>Development of Lightweight Parsers with Different  Go Language Granularity</trans-title></trans-title-group></title-group><contrib-group><contrib contrib-type="author" corresp="yes"><name-alternatives><name name-style="eastern" xml:lang="ru"><surname>Дроздов</surname><given-names>Дмитрий Сергеевич</given-names></name><name name-style="western" xml:lang="en"><surname>Drozdov</surname><given-names>Dmitry Sergeevich</given-names></name></name-alternatives><email xlink:type="simple">ds-drozdov@yandex.ru</email><xref ref-type="aff" rid="aff-1"/></contrib><contrib contrib-type="author" corresp="yes"><name-alternatives><name name-style="eastern" xml:lang="ru"><surname>Михалкович</surname><given-names>Станислав Станиславович</given-names></name><name name-style="western" xml:lang="en"><surname>Mikhalkovich</surname><given-names>Stanislav Stanislavovich</given-names></name></name-alternatives><email xlink:type="simple">miks@sfedu.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>Southern Federal University</institution></aff></aff-alternatives><pub-date pub-type="collection"><year>2024</year></pub-date><pub-date pub-type="epub"><day>11</day><month>02</month><year>2025</year></pub-date><volume>27</volume><issue>6</issue><elocation-id>857–877</elocation-id><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">Drozdov D.S., Mikhalkovich S.S.</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://ellibs.elpub.ru/jour/article/view/523">https://ellibs.elpub.ru/jour/article/view/523</self-uri><abstract><p>Рассмотрен подход к созданию семейства легковесных грамматик для языка Go со специальным символом Any, обозначающим пропускаемую часть программы [<xref ref-type="bibr" rid="cit1">1</xref>]. Дано формальное определение более детализированной грамматики, приведены примеры увеличения детализации правил грамматики. Проведен анализ эффективности семейства построенных легковесных парсеров по памяти и времени работы на семи промышленных репозиториях. Показано, что увеличение детализации грамматики не ведет к существенному росту потребления ресурсов парсером и незначительно колеблется в зависимости от типа репозитория и стиля написания на Go. Кроме того, указаны преимущества использования легковесных грамматик с символом Any по сравнению с полными грамматиками. Представлен пример использования легковесной грамматики для определения сложности кода. Полученные результаты могут быть также применены для оценки доли парсера в общем потреблении ресурсов, например, в задаче привязки к коду и разметки проекта.
</p></abstract><trans-abstract xml:lang="en"><p>We consider an approach to creating a family of lightweight grammars with the Any symbol denoting skipping code parts [<xref ref-type="bibr" rid="cit1">1</xref>]. Definition and examples of increasing the granularity of grammar rules are given. Memory and time efficiency of lightweight parsers is analyzed on seven industrial repositories. It is shown that increasing grammar granularity does not significantly increase parser resource consumption and varies slightly depending on repository type and Go writing style. Furthermore, the advantages of using lightweight grammars with Any over full grammars are summarized. An example of using a lightweight grammar to determine code complexity is presented. In addition, the results can be applied to estimate the parser's share of the total resource consumption, for example in the task of code binding and project markup.
</p></trans-abstract><kwd-group xml:lang="ru"><kwd>легковесная грамматика</kwd><kwd>легковесный парсер</kwd><kwd>язык Go</kwd><kwd>грамматика Go</kwd><kwd>грамматика с символом Any</kwd></kwd-group><kwd-group xml:lang="en"><kwd>lightweight grammar</kwd><kwd>lightweight parser</kwd><kwd>Go language</kwd><kwd>Go grammar</kwd><kwd>grammar with Any symbol</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">Goloveshkin A.V., Mikhalkovich S.S. Tolerant parsing with a special kind of «Any» symbol: the algorithm and practical application // Proc. ISP RAS. 2018. Vol. 30. P. 7–28.</mixed-citation><mixed-citation xml:lang="en">Goloveshkin A.V., Mikhalkovich S.S. Tolerant parsing with a special kind of «Any» symbol: the algorithm and practical application // Proc. ISP RAS. 2018. Vol. 30. P. 7–28.</mixed-citation></citation-alternatives></ref><ref id="cit2"><label>2</label><citation-alternatives><mixed-citation xml:lang="ru">Bodner J. Learning Go. An Idiomatic Approach to Real-World Go Programming. Sebastopol: O’Reilly Media Inc., 2024. 353 p.</mixed-citation><mixed-citation xml:lang="en">Bodner J. Learning Go. An Idiomatic Approach to Real-World Go Programming. Sebastopol: O’Reilly Media Inc., 2024. 353 p.</mixed-citation></citation-alternatives></ref><ref id="cit3"><label>3</label><citation-alternatives><mixed-citation xml:lang="ru">Головешкин А.В., Михалкович С.С. Разметка сквозных функциональностей в коде программы // Труды XXI Всероссийской научной конференции «Научный сервис в сети Интернет», Новороссийск, Россия, 23–28 сентября 2019 г. ИПМ им. М.В. Келдыша: 2019, с. 245–256.</mixed-citation><mixed-citation xml:lang="en">Головешкин А.В., Михалкович С.С. Разметка сквозных функциональностей в коде программы // Труды XXI Всероссийской научной конференции «Научный сервис в сети Интернет», Новороссийск, Россия, 23–28 сентября 2019 г. ИПМ им. М.В. Келдыша: 2019, с. 245–256.</mixed-citation></citation-alternatives></ref><ref id="cit4"><label>4</label><citation-alternatives><mixed-citation xml:lang="ru">Malevannyy M., Mikhalkovich S. Context-based model for concern markup of a source code // Proc. ISP RAS. 2016. Vol. 28. P. 63–78.</mixed-citation><mixed-citation xml:lang="en">Malevannyy M., Mikhalkovich S. Context-based model for concern markup of a source code // Proc. ISP RAS. 2016. Vol. 28. P. 63–78.</mixed-citation></citation-alternatives></ref><ref id="cit5"><label>5</label><citation-alternatives><mixed-citation xml:lang="ru">Moonen L. Generating Robust Parsers Using Island Grammars // Proceedings of the 8th Working Conference on Reverse Engineering, Stuttgart, Germany, Oct. 2 to Oct. 5 2001. IEEE: 2001, P. 13–22.</mixed-citation><mixed-citation xml:lang="en">Moonen L. Generating Robust Parsers Using Island Grammars // Proceedings of the 8th Working Conference on Reverse Engineering, Stuttgart, Germany, Oct. 2 to Oct. 5 2001. IEEE: 2001, P. 13–22.</mixed-citation></citation-alternatives></ref><ref id="cit6"><label>6</label><citation-alternatives><mixed-citation xml:lang="ru">Moonen L. Lightweight Impact Analysis using Island Grammars // Proceedings of the 10th International Workshop on Program Comprehension, Paris, France, June 27 2002 to June 29 2002. IEEE: 2002, P. 219–228.</mixed-citation><mixed-citation xml:lang="en">Moonen L. Lightweight Impact Analysis using Island Grammars // Proceedings of the 10th International Workshop on Program Comprehension, Paris, France, June 27 2002 to June 29 2002. IEEE: 2002, P. 219–228.</mixed-citation></citation-alternatives></ref><ref id="cit7"><label>7</label><citation-alternatives><mixed-citation xml:lang="ru">Дроздов Д.С., Михалкович С.С. Создание и постобработка легковесных грамматик Go и GraphQL для разметки функциональностей кода // Труды XXXI всероссийской научной конференции «Современные информационные технологии: тенденции и перспективы развития», Ростов-на-Дону, Россия, 18–20 апреля 2024. ЮФУ: 2024, С. 163–165.</mixed-citation><mixed-citation xml:lang="en">Дроздов Д.С., Михалкович С.С. Создание и постобработка легковесных грамматик Go и GraphQL для разметки функциональностей кода // Труды XXXI всероссийской научной конференции «Современные информационные технологии: тенденции и перспективы развития», Ростов-на-Дону, Россия, 18–20 апреля 2024. ЮФУ: 2024, С. 163–165.</mixed-citation></citation-alternatives></ref><ref id="cit8"><label>8</label><citation-alternatives><mixed-citation xml:lang="ru">Головешкин А.В., Михалкович С.С. LanD: инструментальный комплекс поддержки послойной разработки программ // Труды XXV всероссийской научной конференции «Современные информационные технологии: тенденции и перспективы развития», Ростов-на-Дону, Россия, 17–18 мая 2018. ЮФУ: 2018, С. 53–56.</mixed-citation><mixed-citation xml:lang="en">Головешкин А.В., Михалкович С.С. LanD: инструментальный комплекс поддержки послойной разработки программ // Труды XXV всероссийской научной конференции «Современные информационные технологии: тенденции и перспективы развития», Ростов-на-Дону, Россия, 17–18 мая 2018. ЮФУ: 2018, С. 53–56.</mixed-citation></citation-alternatives></ref><ref id="cit9"><label>9</label><citation-alternatives><mixed-citation xml:lang="ru">Freeman A. Pro Go: The Complete Guide to Programming Reliable and Efficient Software Using Golang. New York: Apress, 2022. 1105 p.</mixed-citation><mixed-citation xml:lang="en">Freeman A. Pro Go: The Complete Guide to Programming Reliable and Efficient Software Using Golang. New York: Apress, 2022. 1105 p.</mixed-citation></citation-alternatives></ref><ref id="cit10"><label>10</label><citation-alternatives><mixed-citation xml:lang="ru">Мельцов В.Ю. Лекции по теории автоматов. Часть 2. Киров: ВятГУ, 2010. 24 с.</mixed-citation><mixed-citation xml:lang="en">Мельцов В.Ю. Лекции по теории автоматов. Часть 2. Киров: ВятГУ, 2010. 24 с.</mixed-citation></citation-alternatives></ref><ref id="cit11"><label>11</label><citation-alternatives><mixed-citation xml:lang="ru">Goloveshkin A.V., Mikhalkovich S.S. Using improved context-based code description for robust algorithmic binding to changing code // Procedia Computer Science, 2021. Vol. 139. P. 239–249.</mixed-citation><mixed-citation xml:lang="en">Goloveshkin A.V., Mikhalkovich S.S. Using improved context-based code description for robust algorithmic binding to changing code // Procedia Computer Science, 2021. Vol. 139. P. 239–249.</mixed-citation></citation-alternatives></ref><ref id="cit12"><label>12</label><citation-alternatives><mixed-citation xml:lang="ru">Robillard M., Murphy G. Concern graphs: finding and describing concerns using structural program dependencies // Proceedings of the 24th international conference on Software engineering, New York, United States, May 19 to May 25 2002. ACM: 2002, P. 406–416.</mixed-citation><mixed-citation xml:lang="en">Robillard M., Murphy G. Concern graphs: finding and describing concerns using structural program dependencies // Proceedings of the 24th international conference on Software engineering, New York, United States, May 19 to May 25 2002. ACM: 2002, P. 406–416.</mixed-citation></citation-alternatives></ref><ref id="cit13"><label>13</label><citation-alternatives><mixed-citation xml:lang="ru">Paltenghi M., Pandita R. et al. Extracting Meaningful Attention on Source Code: An Empirical Study of Developer and Neural Model Code Exploration // IEEE Transactions on Software Engineering. 2022. Vol. 50, No. 10, P. 256–2582.</mixed-citation><mixed-citation xml:lang="en">Paltenghi M., Pandita R. et al. Extracting Meaningful Attention on Source Code: An Empirical Study of Developer and Neural Model Code Exploration // IEEE Transactions on Software Engineering. 2022. Vol. 50, No. 10, P. 256–2582.</mixed-citation></citation-alternatives></ref><ref id="cit14"><label>14</label><citation-alternatives><mixed-citation xml:lang="ru">Okuda K., Chiba S. Lake symbols for island parsing // The Art, Science, and Engineering of Programming. 2021. Vol. 5. Issue 2. P. 11:3–11:32.</mixed-citation><mixed-citation xml:lang="en">Okuda K., Chiba S. Lake symbols for island parsing // The Art, Science, and Engineering of Programming. 2021. Vol. 5. Issue 2. P. 11:3–11:32.</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>
