Scrap Your Boilerplate With Object Algebras

Abstract : Traversing complex Abstract Syntax Trees (ASTs) typically requires large amounts of tedious boilerplate code. For many operations most of the code simply walks the structure, and only a small portion of the code implements the functional- ity that motivated the traversal in the first place. This paper presents a type-safe Java framework called Shy that removes much of this boilerplate code. In Shy Object Algebras are used to describe complex and extensible AST structures. Using Java annotations Shy generates generic boilerplate code for various types of traversals. For a concrete traversal, users of Shy can then inherit from the generated code and over- ride only the interesting cases. Consequently, the amount of code that users need to write is significantly smaller. Moreover, traversals using the Shy framework are also much more structure shy, becoming more adaptive to future changes or extensions to the AST structure. To prove the effectiveness of the approach, we applied Shy in the implementation of a domain-specific questionnaire language. Our results show that for a large number of traversals there was a significant reduction in the amount of user-defined code.
Type de document :
Communication dans un congrès
Proceedings of the Object-oriented Programming, Systems, Languages, and Applications (OOPSLA, 2015), 2015, New York, United States. 2015
Liste complète des métadonnées

https://hal.inria.fr/hal-01261477
Contributeur : Tijs Van Der Storm <>
Soumis le : lundi 25 janvier 2016 - 14:06:36
Dernière modification le : vendredi 29 janvier 2016 - 13:41:57

Identifiants

  • HAL Id : hal-01261477, version 1

Collections

Citation

Haoyuan Zhang, Zewei Chu, Bruno C.D. S. Oliveira, Tijs Storm. Scrap Your Boilerplate With Object Algebras. Proceedings of the Object-oriented Programming, Systems, Languages, and Applications (OOPSLA, 2015), 2015, New York, United States. 2015. 〈hal-01261477〉

Partager

Métriques

Consultations de la notice

55