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. Unifying Analytic and Statically-Typed Quasiquotes
 
conference paper

Unifying Analytic and Statically-Typed Quasiquotes

Parreaux, Lionel  
•
Voizard, Antoine
•
Shaikhha, Amir  
Show more
2018
Proceedings of the ACM on Programming Languages
ACM SIGPLAN Symposium on Principles of Programming Languages (POPL 2018)

Metaprograms are programs that manipulate (generate, analyze and evaluate) other programs. These tasks are greatly facilitated by quasiquotation, a technique to construct and deconstruct program fragments using quoted code templates expressed in the syntax of the manipulated language. We argue that two main flavors of quasiquotes have existed so far: Lisp-style quasiquotes, which can both construct and deconstruct programs but may produce code that contains type mismatches and unbound variables; and MetaML-style quasiquotes, which rely on static typing to prevent these errors, but can only construct programs. In this paper, we show how to combine the advantages of both flavors into a unified framework: we allow the construction, deconstruction and evaluation of program fragments while ensuring that generated programs are well-typed and well-scoped, a combination unseen in previous work. We formalize our approach as λ{}, a multi-stage calculus with code pattern matching and rewriting, and prove its type safety. We also present its realization in Squid, a metaprogramming framework for Scala, leveraging Scala's expressive type system. To demonstrate the usefulness of our approach, we introduce speculative rewrite rules, a novel code transformation technique that makes decisive use of these capabilities, and we outline how it simplifies the design of some crucial query compiler optimizations.

  • Files
  • Details
  • Metrics
Type
conference paper
DOI
10.1145/3158101
Author(s)
Parreaux, Lionel  
Voizard, Antoine
Shaikhha, Amir  
Koch, Christoph  
Date Issued

2018

Published in
Proceedings of the ACM on Programming Languages
Volume

2

Issue

13

Subjects

quasiquotes

•

metaprogramming

•

rewriting

•

static typing

URL

URL

https://popl18.sigplan.org/event/popl-2018-papers-unifying-analytic-and-statically-typed-quasiquotes
Editorial or Peer reviewed

REVIEWED

Written at

EPFL

EPFL units
DATA  
Event nameEvent placeEvent date
ACM SIGPLAN Symposium on Principles of Programming Languages (POPL 2018)

Los Angeles, California, USA

January 7–13, 2018

Available on Infoscience
November 13, 2017
Use this identifier to reference this record
https://infoscience.epfl.ch/handle/20.500.14299/142155
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