Source-to-Source Compilation in Racket: You Want it in Which Language?

Tero Hasu
BLDL and University of Bergen

Matthew Flatt
PLT and University of Utah

Abstract

Racket's macro system enables language extension and definition primarily for programs that are run on the Racket virtual machine, but macro facilities are also useful for implementing languages and compilers that target different platforms. Even when the core of a new language differs significantly from Racket's core, macros offer a maintainable approach to implementing a larger language by desugaring into the core. Users of the language gain the benefits of Racket's programming environment, its build management, and even its macro support (if macros are exposed to programmers of the new language), while Racket's syntax objects and submodules provide convenient mechanisms for recording and extracting program information for use by an external compiler. We illustrate this technique with Magnolisp, a programming language that runs within Racket for testing purposes, but that compiles to C++ (with no dependency on Racket) for deployment.

BibTeX

@inproceedings{hasu-flatt-14-source,
  author =       {Tero Hasu and Matthew Flatt},
  title =        {Source-to-Source Compilation in {Racket}:
                  You Want it in Which Language?},
  booktitle =    {Preproceedings of the 26nd Symposium on
                  Implementation and Application of Functional
                  Languages (IFL 2014)},
  year =         2014,
  month =        oct,
  location =     {Boston, Massachusetts}
}

Scribble

(define hasu-flatt-14-source
  (make-bib
   #:title
     @elem{Source-to-Source Compilation in Racket:
           You Want it in @emph{Which} Language?}
   #:author (authors "Tero Hasu" "Matthew Flatt")
   #:date "2014"
   #:location (proceedings-location
     @elem{Intl. Sym. Implementation and Application of
           Functional Languages (Preproceedings)})))

Publication Details