Writable PSI Generator for a Multi-Language IDE Platform
https://doi.org/10.15514/ISPRAS-2023-35(3)-2
Abstract
Any state-of-the-art integrated development environment (IDE) should provide software developers with services for quick and correct code transformation. Such services can be used both for program refactoring to improve its quality and for quick fixing of syntax errors in source code. This paper presents the method of constructing a subsystem that makes it possible to create the services described above and also has the property of fast extensibility to support different programming languages. The method of transformation of Program Structure Interface (PSI) - a special data structure, which provides API for development of IDE-services, is proposed. Besides, a method of generating types for PSI in accordance with the syntax of the supported programming language is proposed. The approach is developed for a multi-language platform of a large telecommunications company. Refactoring and Quick Fix features are implemented using on the proposed generator for two IDEs: a Python IDE and a Java IDE.
About the Authors
Alexander Sergeevich BOZHNYUKRussian Federation
Junior engineer of MPG IT Solutions
Alexander Alexandrovich ZAKHAROV
Russian Federation
Еngineer of key projects of MPG IT Solutions
Nikolay Vladimirovich TROPIN
Russian Federation
Leading engineer of the IDE team
Mikhail Valeryevich VOLKOV
Russian Federation
PhD in Physics
References
1. Alfred V. Aho, Ravi. Sethi, Jeffrey D. Ullman. Compilers: Principles, Techniques, and Tools. ––1986. –– P. 69–70.
2. Z. Kurbatova, Y. Golubev, V. Kovalenko and T. Bryksin. The IntelliJ Platform: A Framework for Building Plugins and Mining Software Data. 2021 36th IEEE/ACM International Conference on Automated Software Engineering Workshops (ASEW), Melbourne, Australia, 2021. –– P. 14–17.
3. Jeffrey L. Overbey. 2013. Immutable source-mapped abstract syntax tree: a design pattern for refactoring engine APIs. In Proceedings of the 20th Conference on Pattern Languages of Programs (PLoP '13). The Hillside Group, USA, Article 7. –– P. 1–8.
4. Lippert E. Fabulous adventures in coding. Blog. https://ericlippert.com/2012/06/08/red-green-trees/
5. Jean-Rémy Falleri, Floréal Morandat, Xavier Blanc, Matias Martinez, and Martin Monperrus. 2014. Fine-grained and accurate source code differencing. In Proceedings of the 29th ACM/IEEE International Conference on Automated Software Engineering (ASE '14). Association for Computing Machinery, New York, NY, USA. –– P. 313–324.
6. IntelliJ Platform SDK — Modifying the PSI. –– URL: https://plugins.jetbrains.com/docs/intellij/modifying-psi.html.
7. A Framework for Software Product Line Practice, version 5.0, Software Engineering Institute, 2012, https://resources.sei.cmu.edu/
8. Попова Т.Н., Кознов Д.В., Тинова А.А., Романовский К.Ю. "Эволюция общих активов в семействе средств реинжиниринга программного обеспечения" // Системное программирование, 1 (2005), 184-198.
9. Peter Sommerlad, Guido Zgraggen, Thomas Corbat, Lukas Felber. Retaining comments when refactoring code –– 2008. –– 01. –– P. 653–662.
10. Roberts Don, Brant John, Johnson Ralph. A Refactoring Tool for Smalltalk // TAPOS. –– 1997. –– 01. –– Vol. 3. –– P. 253–263.
11. Garrido Alejandra. Program Refactoring in the Presence of Preprocessor Directives: Ph. D. thesis / Alejandra Garrido. –– USA: University of Illinois at Urbana-Champaign, 2005. –– AAI3199001.
12. Bille Philip. A survey on tree edit distance and related problems //
13. Theoretical Computer Science. –– 2005. –– Vol. 337, no. 1. –– P. 217–
14.
15. Pawlik Mateusz, Augsten Nikolaus. RTED: A Robust Algorithm for
16. the Tree Edit Distance. –– 2011. –– 1201.0230.
17. Sudarshan S. Chawathe, Anand Rajaraman, Hector Garcia-Molina, Jennifer Widom. Change Detection in Hierarchically Structured Information. Proceedings of the 1996 ACM SIGMOD International Conference on Management of Data. –– SIGMOD ’96. –– New York, NY, USA: Association for Computing Machinery, 1996. –– P. 493–504.
18. Beat Fluri, Michael Wursch, Martin PInzger,
19. Harald Gall. Change Distilling: Tree Differencing for Fine-Grained Source Code
20. Change Extraction / // IEEE Transactions on Software Engineering. –– 2007. –– Vol. 33, no. 11. –– P. 725–743.
21. Guillermo de la Torre, Romain Robbes, and Alexandre Bergel. 2018. Imprecisions diagnostic in source code deltas. In Proceedings of the 15th International Conference on Mining Software Repositories (MSR '18). Association for Computing Machinery, New York, NY, USA, 492–502.
22. J. Matsumoto, Y. Higo and S. Kusumoto. Beyond GumTree: A Hybrid Approach to Generate Edit Scripts. 2019 IEEE/ACM 16th International Conference on Mining Software Repositories (MSR), Montreal, QC, Canada, 2019. –– P. 550-554.
23. Pattis, Richard E. EBNF: A Notation to Describe Syntax. ICS.UCI.edu. University of California, Irvine.
Review
For citations:
BOZHNYUK A.S., ZAKHAROV A.A., TROPIN N.V., VOLKOV M.V. Writable PSI Generator for a Multi-Language IDE Platform. Proceedings of the Institute for System Programming of the RAS (Proceedings of ISP RAS). 2023;35(3):33-46. https://doi.org/10.15514/ISPRAS-2023-35(3)-2