A Generic Platform for Name Resolution in Source Code Analysis - INRIA - Institut National de Recherche en Informatique et en Automatique Accéder directement au contenu
Rapport (Rapport De Recherche) Année : 2014

A Generic Platform for Name Resolution in Source Code Analysis

Résumé

Analysing a software system supposes two preliminary tasks: parsing the source code and resolving the names (identifiers) it contains. The parsing results in an Abstract Syntax Tree (AST) representing the source code. Name resolution maps all the identifiers found in the code to the software entities they refer to (variables, functions, classes,. . .). If there are solutions for some popular programming languages (e.g., JDT for the Java language), these two tasks can impose a significant burden on multi-language platforms (e.g., Cast, Eclipse, Rascal, Spoofax, Synectique) where a parser with name resolution must be implemented for each language analysed. For the parser, one may use a grammar of the language and a parser generator tool. For name resolution, solutions are ad-hoc and one must develop them by hand. We work with a company that had to create parsers and name resolvers for five languages in the past 18 months. As a solution, we describe in this paper, an infrastructure that helps implementing a name resolution tool. This infrastructure is based on an AST metamodel similar to ASTM (from the OMG). One part of the solution comes from decomposing the task into two phases: First, looking-up for candidate entities that could map to a name; second selecting among these candidates the entity that actually maps to the name. Another part of the solution relies on the definition of scopes as first class entities that can be attached to any node in an AST. We discuss implementation of our solution for two languages: Ada and Pharo (a Smalltalk dialect).
Fichier principal
Vignette du fichier
paper.pdf (385.62 Ko) Télécharger le fichier
Origine : Fichiers produits par l'(les) auteur(s)
Loading...

Dates et versions

hal-01664258 , version 1 (25-01-2018)

Identifiants

  • HAL Id : hal-01664258 , version 1

Citer

Nicolas Anquetil, Yuriy Tymchuk, Anne Etien, Gustavo Santos, Stéphane Ducasse. A Generic Platform for Name Resolution in Source Code Analysis. [Research Report] Inria Lille Nord Europe - Laboratoire CRIStAL - Université de Lille. 2014. ⟨hal-01664258⟩
256 Consultations
108 Téléchargements

Partager

Gmail Facebook X LinkedIn More