A Refactoring Library for Scala Compiler Extensions

Conference paper

DOI: 10.1007/978-3-662-46663-6_2

Part of the Lecture Notes in Computer Science book series (LNCS, volume 9031)
Cite this paper as:
Sherwany A., Zaza N., Nystrom N. (2015) A Refactoring Library for Scala Compiler Extensions. In: Franke B. (eds) Compiler Construction. CC 2015. Lecture Notes in Computer Science, vol 9031. Springer, Berlin, Heidelberg

Abstract

Compiler plugins enable languages to be extended with new functionality by adding compiler passes that perform additional static checking, code generation, or code transformations. However, compiler plugins are often difficult to build. A plugin can perform arbitrary code transformations, easily allowing a developer to generate incorrect code. Moreover, the base compiler assumes many complex, sometimes undocumented invariants, requiring plugin developers to acquire intimate knowledge of the design and implementation of the compiler. To address these issues in the context of the Scala compiler plugin framework, we introduce Piuma. Piuma is a library that provides, first, an API to perform many common refactoring tasks needed by plugin writers, and, second, a DSL to eliminate much of the boilerplate code required for plugin development. We demonstrate the usefulness of our library by implementing five diverse compiler plugins. We show that, using Piuma, plugins require less code and are easier to understand than plugins developed using the base Scala compiler plugin API.

Keywords

Scala compiler extensions refactoring 

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

Copyright information

© Springer-Verlag Berlin Heidelberg 2015

Authors and Affiliations

  • Amanj Sherwany
    • 1
  • Nosheen Zaza
    • 1
  • Nathaniel Nystrom
    • 1
  1. 1.Faculty of InformaticsUniversità della Svizzera italiana (USI)LuganoSwitzerland

Personalised recommendations