A Generic Platform for Name Resolution in Source Code Analysis

Nicolas Anquetil 1 Yuriy Tymchuk 1 Anne Etien 1 Gustavo Santos 1 Stéphane Ducasse 1
1 RMOD - Analyses and Languages Constructs for Object-Oriented Application Evolution
Inria Lille - Nord Europe, CRIStAL - Centre de Recherche en Informatique, Signal et Automatique de Lille (CRIStAL) - UMR 9189
Abstract : 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).
Document type :
Reports
Complete list of metadatas

Cited literature [5 references]  Display  Hide  Download

https://hal.inria.fr/hal-01664258
Contributor : Lse Lse <>
Submitted on : Thursday, January 25, 2018 - 9:40:24 AM
Last modification on : Friday, March 22, 2019 - 1:34:15 AM
Long-term archiving on : Wednesday, May 2, 2018 - 11:08:48 AM

File

paper.pdf
Files produced by the author(s)

Identifiers

  • HAL Id : hal-01664258, version 1

Collections

Citation

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⟩

Share

Metrics

Record views

466

Files downloads

97