Polyglot AST: Towards Enabling Polyglot Code Analysis - Inria - Institut national de recherche en sciences et technologies du numérique Accéder directement au contenu
Communication Dans Un Congrès Année : 2023

Polyglot AST: Towards Enabling Polyglot Code Analysis

Résumé

Today, a plethora of programming languages exists, each better suited for a particular concern. For example, Python is suited for data analysis but not web development, whereas JavaScript is the inverse. As software complexity grows and needs to address multiple concerns, different programming languages are often used in combination, despite the burden of bridging them (e.g., using Java Native Interface). Polyglot programming emerged as a solution allowing the seamless mixing of multiple programming languages. GraalVM and PolyNote are examples of runtimes allowing polyglot programming. However, there is a striking lack of support at design time for building and analyzing polyglot code. To the best of our knowledge, there is no uniform language-agnostic way of reasoning over multiple languages to provide seamless code analysis, since each language comes with its own form of Abstract Syntax Trees (AST). In this paper, we present an approach to build a uniform yet polyglot AST over polyglot code, so that it is easier to perform global analysis. We first motivate this challenge and identify the main requirements for building a polyglot AST. We then propose a proof of concept implementation of our solutions on GraalVM's polyglot API. On top of the polyglot AST, we demonstrate the ability to implement several polyglot-specific analysis services, namely auto-completion, consistency checking, type inference, and rename refactoring. Our evaluation on three polyglot projects taken from GitHub, and involving JavaScript and Python code, shows that we can build a polyglot AST without significant overhead. We also demonstrate the usefulness of the polyglot analysis services through the provided automation, as well as their scalability.
Fichier principal
Vignette du fichier
Article_ICECCS.pdf (524.85 Ko) Télécharger le fichier
Origine : Fichiers produits par l'(les) auteur(s)

Dates et versions

hal-04077663 , version 1 (21-04-2023)
hal-04077663 , version 2 (25-04-2023)

Identifiants

  • HAL Id : hal-04077663 , version 2

Citer

Philémon Houdaille, Djamel Eddine Khelladi, Romain Briend, Robbert Jongeling, Benoit Combemale. Polyglot AST: Towards Enabling Polyglot Code Analysis. ICECCS 2023 - 27th International Conference on Engineering of Complex Computer Systems, Jun 2023, Toulouse, France. pp.1-10. ⟨hal-04077663v2⟩
117 Consultations
154 Téléchargements

Partager

Gmail Facebook X LinkedIn More