Repository logo

Infoscience

  • English
  • French
Log In
Logo EPFL, École polytechnique fédérale de Lausanne

Infoscience

  • English
  • French
Log In
  1. Home
  2. Academic and Research Output
  3. Conferences, Workshops, Symposiums, and Seminars
  4. A Practical Unification of Multi-stage Programming and Macros
 
conference paper

A Practical Unification of Multi-stage Programming and Macros

Stucki, Nicolas
•
Biboudis, Aggelos
•
Odersky, Martin
2018
Proceedings of the 17th ACM SIGPLAN International Conference on Generative Programming: Concepts and Experiences
17th ACM SIGPLAN International Conference on Generative Programming: Concepts and Experiences

Program generation is indispensable. We propose a novel unification of two existing metaprogramming techniques: multi-stage programming and hygienic generative macros. The former supports runtime code generation and execution in a type-safe manner while the latter offers compile-time code generation. In this work we draw upon a long line of research on metaprogramming, starting with Lisp, MetaML and MetaOCaml. We provide direct support for quotes, splices and top-level splices, all regulated uniformly by a level-counting Phase Consistency Principle. Our design enables the construction and combination of code values for both expressions and types. Moreover, code generation can happen either at runtime à la MetaML or at compile time, in a macro fashion, à la MacroML. We provide an implementation of our design in Scala and we present two case studies. The first implements the Hidden Markov Model, Shonan Challenge for HPC. The second implements the staged streaming library Strymonas.

  • Files
  • Details
  • Metrics
Type
conference paper
DOI
10.1145/3278122.3278139
Author(s)
Stucki, Nicolas
Biboudis, Aggelos
Odersky, Martin
Date Issued

2018

Published in
Proceedings of the 17th ACM SIGPLAN International Conference on Generative Programming: Concepts and Experiences
Total of pages

14

Subjects

Macros

•

Multi-stage programming

•

Scala

Editorial or Peer reviewed

REVIEWED

Written at

EPFL

EPFL units
LAMP1  
Event nameEvent placeEvent date
17th ACM SIGPLAN International Conference on Generative Programming: Concepts and Experiences

Boston, MA, USA

November 5–6, 2018

Available on Infoscience
October 4, 2018
Use this identifier to reference this record
https://infoscience.epfl.ch/handle/20.500.14299/148636
Logo EPFL, École polytechnique fédérale de Lausanne
  • Contact
  • infoscience@epfl.ch

  • Follow us on Facebook
  • Follow us on Instagram
  • Follow us on LinkedIn
  • Follow us on X
  • Follow us on Youtube
AccessibilityLegal noticePrivacy policyCookie settingsEnd User AgreementGet helpFeedback

Infoscience is a service managed and provided by the Library and IT Services of EPFL. © EPFL, tous droits réservés