UvA-DARE is a service provided by the library of the University of Amsterdam (https://dare.uva.nl)
UvA-DARE (Digital Academic Repository)
Generic traversal over typed source code representations
Visser, J.M.W.
Publication date
2003
Link to publication
Citation for published version (APA):
Visser, J. M. W. (2003). Generic traversal over typed source code representations.
General rights
It is not permitted to download or to forward/distribute the text or part of it without the consent of the author(s) and/or copyright holder(s), other than for strictly personal, individual use, unless the work is under an open content license (like Creative Commons).
Disclaimer/Complaints regulations
If you believe that digital publication of certain material infringes any of your rights or (privacy) interests, please let the Library know, stating your reasons. In case of a legitimate complaint, the Library will make the material inaccessible and/or remove it from the website. Please Ask the Library: https://uba.uva.nl/en/contact, or a letter to: Library of the University of Amsterdam, Secretariat, Singel 425, 1012 WP Amsterdam, The Netherlands. You will be contacted as soon as possible.
Summary y
Manyy areas of software engineering essentially involve analysis and transforma-tionn of source code representations. Generally, such representations are highly heterogenouss data structures. Examples are parse trees, abstract syntax trees, de-pendencyy graphs, and call graphs. Preferably, the well-formedness of such data structuress is guarded by strong static type systems.
Unfortunately,, when using traditional approaches, typeful programming is at oddss with conciseness, reusability, and robustness. Access to and traversal over subelementss of typed representations involves dealing with many specific types in specificc ways. As a consequence, type-safety comes at the cost of lengthy traver-sall code, which can not be reused in different parts of the representation or for differentlyy typed representations, and which breaks with any change in the repre-sentationn type.
Inn this thesis we present techniques to remedy the dilemma between type-safetyy on the one hand, and conciseness, reusability, and robustness on the other. Forr representative typed languages from the functional and object-oriented pro-grammingg paradigms, viz Haskell and Java, we developed programming idioms thatt allow program construction from combinators which support typeful generic
traversal.traversal. Using these combinators, program abstractions can be composed that
capturee e.g. reusable traversal strategies or analysis and transformation schemas. Thoughh typeful, these abstractions need make little or no commitment to the spe-cificc type structure of the representations to which they are applied.
Wee have developed tool support to enable the application of our generic traver-sall techniques to source code representations that involve large numbers of differ-entt subelement types. These tools generate combinator support from SDF gram-mars.. Parsers and pretty-printers can be generated from the same grammars, as welll as the necessary code for representing and exchanging syntax trees between parsers,, traversal components, and pretty-printers. In fact, SDF grammars are em-ployedd as contracts that govern all tree exchange, representation, and processing in aa general multi-lingual architecture for source code analysis and transformation.
Thee practical applicability of all these techniques has been put to the test in severall case studies, ranging from procedure reconstruction for Cobol programs, throughh static analysis of Toolbus scripts, to automated Java refactoring.