skip to main content
research-article

Hygienic resugaring of compositional desugaring

Published: 29 August 2015 Publication History

Abstract

Syntactic sugar is widely used in language implementation. Its benefits are, however, offset by the comprehension problems it presents to programmers once their program has been transformed. In particular, after a transformed program has begun to evaluate (or otherwise be altered by a black-box process), it can become unrecognizable. We present a new approach to _resugaring_ programs, which is the act of reflecting evaluation steps in the core language in terms of the syntactic sugar that the programmer used. Relative to prior work, our approach has two important advances: it handles hygiene, and it allows almost arbitrary rewriting rules (as opposed to restricted patterns). We do this in the context of a DAG representation of programs, rather than more traditional trees.

References

[1]
M. D. Adams. Towards the essence of hygiene. In Principles of Programming Languages, 2015.
[2]
A. Chlipala. Parametric higher-order abstract syntax for mechanized semantics. In International Conference on Functional Programming, 2008.
[3]
S. Erdweg, T. van der Storm, and Y. Dai. Capture-avoiding and hygienic program transformations. In European Conference on Object-Oriented Programming, 2014.
[4]
M. Felleisen and R. Hieb. The revised report on the syntactic theories of sequential control and state. Theoretical Computer Science, 103(2): 235–271, 1992.
[5]
M. J. Gabbay and A. M. Pitts. A new approach to abstract syntax with variable binding. Formal Aspects of Computing, 13(3–5):341–363, 2000.
[6]
J. Hennessy. Symbolic debugging of optimized code. Transactions on Programming Languages and Systems, 4(3), 1982.
[7]
D. Herman and M. Wand. A theory of hygienic macros. In European Symposium on Programming Languages and Systems, 2008.
[8]
E. Kohlbecker, D. P. Friedman, M. Felleisen, and B. Duba. Hygienic macro expansion. In ACM Conference on LISP and Functional Programming, 1986.
[9]
G. Konat, L. Kats, G. Wachsmuth, and E. Visser. Declarative name binding and scope rules. In Software Language Engineering, 2012.
[10]
P. J. Landin. The mechanical evaluation of expressions. The Computer Journal, 6(4):308–320, 1964.
[11]
P. Neron, A. Tolmach, E. Visser, and G. Wachsmuth. A theory of name resolution. In European Symposium on Programming Languages and Systems, 2015. To appear.
[12]
F. Pfenning and C. Elliot. Higher-order abstract syntax. In Programming Languages Design and Implementation, 1988.
[13]
J. Pombrio and S. Krishnamurthi. Resugaring: Lifting evaluation sequences through syntactic sugar. In Programming Languages Design and Implementation, 2014.
[14]
P. Sewell, F. Z. Nardelli, S. Owens, G. Peskine, T. Ridge, S. Sarkar, and R. Strnisa. Ott: Effective tool support for the working semanticist. In International Conference on Functional Programming, 2007.
[15]
M. Sperber, R. K. Dybvig, M. Flatt, A. van Straaten, R. Findler, and J. Matthews. Revised {6} Report on the Algorithmic Language Scheme. Cambridge University Press, 2010.
[16]
P. Stansifer and M. Wand. Romeo: a system for more flexible bindingsafe programming. In International Conference on Functional Programming, 2014.
[17]
A. Van Deursen, P. Klint, and F. Tip. Origin tracking. Journal of Symbolic Computation, 15(5–6), 1993.
[18]
S. Weirich, B. Yorgey, and T. Sheard. Binders unbound. In International Conference on Functional Programming, 2011.

Cited By

View all
  • (2023)How Helpful do Novice Programmers Find the Feedback of an Automated Repair Tool?2023 IEEE International Conference on Teaching, Assessment and Learning for Engineering (TALE)10.1109/TALE56641.2023.10398393(1-6)Online publication date: 28-Nov-2023
  • (2022)A Lazy Desugaring System for Evaluating Programs with SugarsFunctional and Logic Programming10.1007/978-3-030-99461-7_14(243-261)Online publication date: 10-May-2022
  • (2016)Macrofication: Refactoring by Reverse Macro ExpansionProgramming Languages and Systems10.1007/978-3-662-49498-1_25(644-671)Online publication date: 2016
  • Show More Cited By

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM SIGPLAN Notices
ACM SIGPLAN Notices  Volume 50, Issue 9
ICFP '15
September 2015
436 pages
ISSN:0362-1340
EISSN:1558-1160
DOI:10.1145/2858949
  • Editor:
  • Andy Gill
Issue’s Table of Contents
  • cover image ACM Conferences
    ICFP 2015: Proceedings of the 20th ACM SIGPLAN International Conference on Functional Programming
    August 2015
    436 pages
    ISBN:9781450336697
    DOI:10.1145/2784731
Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than the author(s) must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected].

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 29 August 2015
Published in SIGPLAN Volume 50, Issue 9

Check for updates

Author Tags

  1. abstract syntax DAG
  2. hygiene
  3. resugaring
  4. syntactic sugar

Qualifiers

  • Research-article

Funding Sources

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)3
  • Downloads (Last 6 weeks)1
Reflects downloads up to 13 Dec 2024

Other Metrics

Citations

Cited By

View all
  • (2023)How Helpful do Novice Programmers Find the Feedback of an Automated Repair Tool?2023 IEEE International Conference on Teaching, Assessment and Learning for Engineering (TALE)10.1109/TALE56641.2023.10398393(1-6)Online publication date: 28-Nov-2023
  • (2022)A Lazy Desugaring System for Evaluating Programs with SugarsFunctional and Logic Programming10.1007/978-3-030-99461-7_14(243-261)Online publication date: 10-May-2022
  • (2016)Macrofication: Refactoring by Reverse Macro ExpansionProgramming Languages and Systems10.1007/978-3-662-49498-1_25(644-671)Online publication date: 2016
  • (2019)Dependent type systems as macrosProceedings of the ACM on Programming Languages10.1145/33710714:POPL(1-29)Online publication date: 20-Dec-2019
  • (2017)Inferring scope through syntactic sugarProceedings of the ACM on Programming Languages10.1145/31102881:ICFP(1-28)Online publication date: 29-Aug-2017
  • (2017)Imperative functional programs that explain their workProceedings of the ACM on Programming Languages10.1145/31102581:ICFP(1-28)Online publication date: 29-Aug-2017
  • (2016)MacroficationProceedings of the 25th European Symposium on Programming Languages and Systems - Volume 963210.5555/3089528.3089553(644-671)Online publication date: 2-Apr-2016
  • (2015)Modular capture avoidance for program transformationsProceedings of the 2015 ACM SIGPLAN International Conference on Software Language Engineering10.1145/2814251.2814260(59-70)Online publication date: 26-Oct-2015

View Options

Login options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media