A Reflexive and Automated Approach to Syntactic Pattern Matching in Code Transformations - Archive ouverte HAL Accéder directement au contenu
Communication Dans Un Congrès Année : 2018

A Reflexive and Automated Approach to Syntactic Pattern Matching in Code Transformations

Résumé

Empowering software engineers often requires to let them write code transformations. However existing automated or tool-supported approaches force developers to have a detailed knowledge of the internal representation of the underlying tool. While this knowledge is time consuming to master, the syntax of the language, on the other hand, is already well known to developers and can serve as a strong foundation for pattern matching. Pattern languages with metavariables (that is variables holding abstract syntax subtrees once the pattern has been matched) have been used to help programmers define program transformations at the language syntax level. The question raised is then the engineering cost of metavariable support. Our contribution is to show that, with a GLR parser, such patterns with metavariables can be supported by using a form of runtime reflexivity on the parser internal structures. This approach allows one to directly implement such patterns on any parser generated by a parser generation framework, without asking the pattern writer to learn the AST structure and node types. As a use case for that approach we describe the implementation built on top of the SmaCC (Smalltalk Compiler Compiler) GLR parser generator framework. This approach has been used in production for source code transformations on a large scale. We will express perspectives to adapt this approach to other types of parsing technologies.
Fichier principal
Vignette du fichier
reflexiveparsing.pdf (267.77 Ko) Télécharger le fichier
Origine : Fichiers produits par l'(les) auteur(s)
Loading...

Dates et versions

hal-01851857 , version 1 (31-07-2018)

Identifiants

Citer

Jason Lecerf, John Brant, Thierry Goubier, Stéphane Ducasse. A Reflexive and Automated Approach to Syntactic Pattern Matching in Code Transformations. ICSME 2018 - 34th IEEE International Conference on Software Maintenance and Evolution, Sep 2018, Madrid, Spain. ⟨10.1109/ICSME.2018.00052⟩. ⟨hal-01851857⟩
382 Consultations
664 Téléchargements

Altmetric

Partager

Gmail Facebook X LinkedIn More