Source-to-Source Compilation via Submodules
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-2016-source, author = {Tero Hasu and Matthew Flatt}, title = {Source-to-Source Compilation via Submodules}, booktitle = {Proceedings of the 9th European Lisp Symposium (ELS 2016)}, year = 2016, month = may, location = {Krak{\'o}w, Poland} }
Scribble
(define hasu-flatt-2016-source (make-bib #:title "Source-to-Source Compilation via Submodules" #:author (authors "Tero Hasu" "Matthew Flatt") #:date "2016" #:location (proceedings-location "European Lisp Symposium")))
Publication Details and Materials
- Paper
- preprint
- Presentation
- slides
- Software
- http://bldl.github.io/magnolisp-els16/
- Symposium
- ELS 2016
Related Resources
- Early version of the paper
- Source-to-Source Compilation in Racket: You Want it in Which Language?
- Latest version of the software
- https://github.com/bldl/magnolisp