Exploiting Macros in Source-to-Source Compiler Implementation

Tero Hasu
Bergen Language Design Laboratory
Department of Informatics
University of Bergen, Norway


A sufficiently feature-rich general-purpose programming language with an expressive macro system can play multiple roles in the implementation of a source-to-source compiler: it can host the language being compiled, and expose its own macro system to make the hosted language user extensible; it can embed macro-implemented language for the domain of program transformations; and its general-purpose features and libraries allow for the entire compiler to be implemented based on the same language technology. I discuss some potential uses of the “programmable programming language” Racket in the implementation of source-to-source compilers.


  author =       {Tero Hasu},
  title =        {Exploiting Macros in Source-to-Source Compiler
  booktitle =    {1st International Joint Symposium on Program and
                  Model Transformations (PAMT)},
  year =         2014,
  editor =       {Anya Helene Bagge and Yngve Lamo},
  month =        may,
  location =     {Bergen, Norway}


(define hasu-14-exploiting
     "Exploiting Macros in Source-to-Source Compiler Implementation"
   #:author (authors "Tero Hasu")
   #:date "2014"
   #:location (proceedings-location
     "Intl. Joint Sym. Program and Model Transformations")))

Publication Details

preprint (as PDF)
Proceedings URL
PAMT 2014 (1st International Joint Symposium on Program and Model Transformations)