000232427 001__ 232427
000232427 005__ 20190317000855.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$$aParreaux, Lionel$$g246168
000232427 700__ $$aVoizard, Antoine
000232427 700__ $$0247633$$aShaikhha, Amir$$g211771
000232427 700__ $$0244689$$aKoch, Christoph$$g205917
000232427 7112_ $$aACM SIGPLAN Symposium on Principles of Programming Languages (POPL 2018)$$cLos Angeles, California, USA$$dJanuary 7–13, 2018
000232427 773__ $$j2$$k13$$tProceedings of the ACM on Programming Languages
000232427 8564_ $$uhttps://popl18.sigplan.org/event/popl-2018-papers-unifying-analytic-and-statically-typed-quasiquotes$$zURL
000232427 8564_ $$s919052$$uhttps://infoscience.epfl.ch/record/232427/files/%5Bv.2.10%5D%20qq_unif_popl18.pdf$$yn/a$$zn/a
000232427 909C0 $$0252342$$pDATA$$xU12327
000232427 909CO $$ooai:infoscience.tind.io:232427$$pconf$$pIC$$qGLOBAL_SET
000232427 917Z8 $$x246168
000232427 917Z8 $$x246168
000232427 917Z8 $$x246168
000232427 937__ $$aEPFL-CONF-232427
000232427 973__ $$aEPFL$$rREVIEWED$$sACCEPTED
000232427 980__ $$aCONF