skip to main content
research-article

Resugaring: lifting evaluation sequences through syntactic sugar

Published:09 June 2014Publication History
Skip Abstract Section

Abstract

Syntactic sugar is pervasive in language technology. It is used to shrink the size of a core language; to define domain-specific languages; and even to let programmers extend their language. Unfortunately, syntactic sugar is eliminated by transformation, so the resulting programs become unfamiliar to authors. Thus, it comes at a price: it obscures the relationship between the user's source program and the program being evaluated.

We address this problem by showing how to compute reduction steps in terms of the surface syntax. Each step in the surface language emulates one or more steps in the core language. The computed steps hide the transformation, thus maintaining the abstraction provided by the surface language. We make these statements about emulation and abstraction precise, prove that they hold in our formalism, and verify part of the system in Coq. We have implemented this work and applied it to three very different languages.

References

  1. A. Aiken and B. R. Murphy. Implementing regular tree expressions. In Conference on Functional Programming Languages and Computer Architecture, 1991. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. A. Bohannon, J. N. Foster, B. C. Pierce, A. Pilkiewicz, and A. Schmitt. Boomerang: Resourceful lenses for string data. In Principles of Programming Languages, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. M. Bravenboer, K. T. Kalleberg, R. Vermaas, and E. Visser. Stratego/XT 0.17. A language and toolset for program transformation. Science of Computer Programming, 72(1--2), 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. J. Clements. Portable and high-level access to the stack with Continuation Marks. PhD thesis, Northeastern University, 2006.Google ScholarGoogle Scholar
  5. J. Clements, M. Flatt, and M. Felleisen. Modeling an algebraic stepper. In European Symposium on Programming Languages and Systems, 2001. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. R. Culpepper and M. Felleisen. Fortifying macros. In International Conference on Functional Programming, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. A. V. Deursen, P. Klint, and F. Tip. Origin tracking. Journal of Symbolic Computation, 15(5--6), 1993. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. R. K. Dybvig, D. P. Friedman, and C. T. Haynes. Expansion-passing style: A general macro mechanism. In Lisp and Symbolic Computation, 1988.Google ScholarGoogle ScholarCross RefCross Ref
  9. M. Felleisen, R. B. Findler, and M. Flatt. Semantics Engineering with PLT Redex. MIT Press, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. D. Fisher and O. Shivers. Static analysis for syntax objects. In International Conference on Functional Programming, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. C. Flanagan, A. Sabry, B. F. Duba, and M. Felleisen. The essence of compiling with continuations. In Programming Languages Design and Implementation, 1993. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. J. N. Foster, M. B. Greenwald, J. T. Moore, B. C. Pierce, and A. Schmitt. Combinators for bi-directional tree transformations: a linguistic approach to the view update problem. In Principles of Programming Languages, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. A. Guha, C. Saftoiu, and S. Krishnamurthi. The essence of JavaScript. In European Conference on Object-oriented Programming, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. J. Hennessy. Symbolic debugging of optimized code. Transactions on Programming Languages and Systems, 4(3), 1982. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. U. Hölzle, C. Chambers, and D. Ungar. Debugging optimized code with dynamic deoptimization. In Programming Languages Design and Implementation, 1992. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. E. Kohlbecker, D. P. Friedman, M. Felleisen, and B. Duba. Hygienic macro expansion. In ACM Conference on LISP and Functional Programming, 1986. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. E. E. Kohlbecker and M. Wand. Macro-by-example: Deriving syntactic transformations from their specifications. In Principles of Programming Languages, 1987. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. S. Krishnamurthi. Automata via macros. Journal of Functional Programming, 16(3), 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. S. Krishnamurthi, M. Felleisen, and B. F. Duba. From macros to reusable generative programming. In Generative and Component-Based Software Engineering, 1999. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. F. Lorenzen and S. Erdweg. Modular and automated type-soundness for language extensions. In International Conference on Functional Programming, 2013. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. R. Perera, U. A. Acar, J. Cheney, and P. B. Levy. Functional programs that explain their work. In International Conference on Functional Programming, 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. G. Pettyjohn, J. Clements, J. Marshall, S. Krishnamurthi, and M. Felleisen. Continuations from generalized stack inspection. In International Conference on Functional Programming, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. G. Roşu and T. F. Şerbănuţă. An overview of the K semantic framework. Journal of Logic and Algebraic Programming, 79(6), 2010.Google ScholarGoogle ScholarCross RefCross Ref
  24. P. Stevens. A landscape of bidirectional model transformations. In Generative and Transformational Techniques in Software Engineering II. Springer-Verlag, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. The Coq Development Team. The Coq Proof Assistant Reference Manual, version 8.4 edition, 2012.Google ScholarGoogle Scholar

Index Terms

  1. Resugaring: lifting evaluation sequences through syntactic sugar

    Recommendations

    Comments

    Login options

    Check if you have access through your login credentials or your institution to get full access on this article.

    Sign in

    Full Access

    • Published in

      cover image ACM SIGPLAN Notices
      ACM SIGPLAN Notices  Volume 49, Issue 6
      PLDI '14
      June 2014
      598 pages
      ISSN:0362-1340
      EISSN:1558-1160
      DOI:10.1145/2666356
      • Editor:
      • Andy Gill
      Issue’s Table of Contents
      • cover image ACM Conferences
        PLDI '14: Proceedings of the 35th ACM SIGPLAN Conference on Programming Language Design and Implementation
        June 2014
        619 pages
        ISBN:9781450327848
        DOI:10.1145/2594291

      Copyright © 2014 ACM

      Publisher

      Association for Computing Machinery

      New York, NY, United States

      Publication History

      • Published: 9 June 2014

      Check for updates

      Qualifiers

      • research-article

    PDF Format

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader
    About Cookies On This Site

    We use cookies to ensure that we give you the best experience on our website.

    Learn more

    Got it!