Visitors unchained

Abstract : Traversing and transforming abstract syntax trees that involve name binding is notoriously difficult to do in a correct, concise, modular, customizable manner. We address this problem in the setting of OCaml, a functional programming language equipped with powerful object-oriented features. We use visitor classes as partial, composable descriptions of the operations that we wish to perform on abstract syntax trees. We introduce visitors, a simple type-directed facility for generating visitor classes that have no knowledge of binding. Separately, we present alphaLib, a library of small handwritten visitor classes, each of which knows about a specific binding construct, a specific representation of names, and/or a specific operation on abstract syntax trees. By combining these components, a wide range of operations can be defined. Multiple representations of names can be supported, as well as conversions between representations. Binding structure can be described either in a programmatic style, by writing visitor methods, or in a declarative style, via preprogrammed binding combinators.
Type de document :
Article dans une revue
Proceedings of the ACM on Programming Languages, ACM, 2017, 1 (ICFP), pp.1 - 28. 〈10.1145/3110272〉
Liste complète des métadonnées

Littérature citée [41 références]  Voir  Masquer  Télécharger
Contributeur : François Pottier <>
Soumis le : jeudi 21 décembre 2017 - 15:59:49
Dernière modification le : jeudi 26 avril 2018 - 10:28:50


Fichiers produits par l'(les) auteur(s)




François Pottier. Visitors unchained. Proceedings of the ACM on Programming Languages, ACM, 2017, 1 (ICFP), pp.1 - 28. 〈10.1145/3110272〉. 〈hal-01670735〉



Consultations de la notice


Téléchargements de fichiers