A nanopass infrastructure for compiler education

  • Authors:
  • Dipanwita Sarkar;Oscar Waddell;R. Kent Dybvig

  • Affiliations:
  • Indiana University;Abstrax, Inc.;Indiana University

  • Venue:
  • Proceedings of the ninth ACM SIGPLAN international conference on Functional programming
  • Year:
  • 2004

Quantified Score

Hi-index 0.00

Visualization

Abstract

Compilers structured as a small number of monolithic passes are difficult to understand and difficult to maintain. Adding new optimizations often requires major restructuring of existing passes that cannot be understood in isolation. The steep learning curve is daunting, and even experienced developers find it hard to modify existing passes without introducing subtle and tenacious bugs. These problems are especially frustrating when the developer is a student in a compiler class.An attractive alternative is to structure a compiler as a collection of many small passes, each of which performs a single task. This "micropass" structure aligns the actual implementation of a compiler with its logical organization, simplifying development, testing, and debugging. Unfortunately, writing many small passes duplicates code for traversing and rewriting abstract syntax trees and can obscure the meaningful transformations performed by individual passes.To address these problems, we have developed a methodology and associated tools that simplify the task of building compilers composed of many fine-grained passes. We describe these compilers as "nanopass" compilers to indicate both the intended granularity of the passes and the amount of source code required to implement each pass. This paper describes the methodology and tools comprising the nanopass framework.