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 hand-written 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.
Publisher
Association for Computing Machinery (ACM)
Subject
Safety, Risk, Reliability and Quality,Software
Cited by
5 articles.
订阅此论文施引文献
订阅此论文施引文献,注册后可以免费订阅5篇论文的施引文献,订阅后可以查看论文全部施引文献
1. Functional Programming Oriented Software Design: A Systematic Literature Review;2023 11th International Conference in Software Engineering Research and Innovation (CONISOFT);2023-11-06
2. Pattern Eliminating Transformations;Logic-Based Program Synthesis and Transformation;2021
3. Morbig: A Static parser for POSIX shell;Journal of Computer Languages;2020-04
4. Characterising renaming within OCaml’s module system: theory and implementation;Proceedings of the 40th ACM SIGPLAN Conference on Programming Language Design and Implementation;2019-06-08
5. ROTOR: A Tool for Renaming Values in OCaml's Module System;2019 IEEE/ACM 3rd International Workshop on Refactoring (IWoR);2019-05