A Generic Platform for Name Resolution in Source Code Analysis - Inria - Institut national de recherche en sciences et technologies du numérique Access content directly
Reports (Research Report) Year : 2014

A Generic Platform for Name Resolution in Source Code Analysis

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).
Fichier principal
Vignette du fichier
paper.pdf (385.62 Ko) Télécharger le fichier
Origin Files produced by the author(s)
Loading...

Dates and versions

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

Identifiers

  • HAL Id : hal-01664258 , version 1

Cite

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⟩
259 View
112 Download

Share

Gmail Mastodon Facebook X LinkedIn More