Development of Lightweight Parsers with Different Go Language Granularity

Main Article Content

Abstract

We consider an approach to creating a family of lightweight grammars with the Any symbol denoting skipping code parts [1]. 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.

Article Details

References

1. 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.
2. Bodner J. Learning Go. An Idiomatic Approach to Real-World Go Programming. Sebastopol: O’Reilly Media Inc., 2024. 353 p.
3. Головешкин А.В., Михалкович С.С. Разметка сквозных функциональностей в коде программы // Труды XXI Всероссийской научной конференции «Научный сервис в сети Интернет», Новороссийск, Россия, 23–28 сентября 2019 г. ИПМ им. М.В. Келдыша: 2019, с. 245–256.
4. Malevannyy M., Mikhalkovich S. Context-based model for concern markup of a source code // Proc. ISP RAS. 2016. Vol. 28. P. 63–78.
5. 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.
6. 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.
7. Дроздов Д.С., Михалкович С.С. Создание и постобработка легковесных грамматик Go и GraphQL для разметки функциональностей кода // Труды XXXI всероссийской научной конференции «Современные информационные технологии: тенденции и перспективы развития», Ростов-на-Дону, Россия, 18–20 апреля 2024. ЮФУ: 2024, С. 163–165.
8. Головешкин А.В., Михалкович С.С. LanD: инструментальный комплекс поддержки послойной разработки программ // Труды XXV всероссийской научной конференции «Современные информационные технологии: тенденции и перспективы развития», Ростов-на-Дону, Россия, 17–18 мая 2018. ЮФУ: 2018, С. 53–56.
9. Freeman A. Pro Go: The Complete Guide to Programming Reliable and Efficient Software Using Golang. New York: Apress, 2022. 1105 p.
10. Мельцов В.Ю. Лекции по теории автоматов. Часть 2. Киров: ВятГУ, 2010. 24 с.
11. 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.
12. 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.
13. 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.
14. 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.