000232427 001__ 232427
000232427 005__ 20190812210004.0
000232427 0247_ $$2doi$$a10.1145/3158101
000232427 037__ $$aCONF
000232427 245__ $$aUnifying Analytic and Statically-Typed Quasiquotes
000232427 269__ $$a2018
000232427 260__ $$c2018
000232427 336__ $$aConference Papers
000232427 520__ $$aMetaprograms 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.
000232427 6531_ $$aquasiquotes
000232427 6531_ $$ametaprogramming
000232427 6531_ $$arewriting
000232427 6531_ $$astatic typing
000232427 700__ $$0249261$$g246168$$aParreaux, Lionel
000232427 700__ $$aVoizard, Antoine
000232427 700__ $$0247633$$g211771$$aShaikhha, Amir
000232427 700__ $$0244689$$g205917$$aKoch, Christoph
000232427 7112_ $$dJanuary 7–13, 2018$$cLos Angeles, California, USA$$aACM SIGPLAN Symposium on Principles of Programming Languages (POPL 2018)
000232427 773__ $$j2$$tProceedings of the ACM on Programming Languages$$k13
000232427 8564_ $$zURL$$uhttps://popl18.sigplan.org/event/popl-2018-papers-unifying-analytic-and-statically-typed-quasiquotes
000232427 8564_ $$zn/a$$yn/a$$uhttps://infoscience.epfl.ch/record/232427/files/%5Bv.2.10%5D%20qq_unif_popl18.pdf$$s919052
000232427 909C0 $$xU12327$$pDATA$$0252342
000232427 909CO $$ooai:infoscience.tind.io:232427$$qGLOBAL_SET$$pconf$$pIC
000232427 917Z8 $$x246168
000232427 917Z8 $$x246168
000232427 917Z8 $$x246168
000232427 937__ $$aEPFL-CONF-232427
000232427 973__ $$rREVIEWED$$sACCEPTED$$aEPFL
000232427 980__ $$aCONF