skip to main content
research-article
Open Access
Artifacts Available
Artifacts Evaluated & Reusable

Inferring scope through syntactic sugar

Published:29 August 2017Publication History
Skip Abstract Section

Abstract

Many languages use syntactic sugar to define parts of their surface language in terms of a smaller core. Thus some properties of the surface language, like its scoping rules, are not immediately evident. Nevertheless, IDEs, refactorers, and other tools that traffic in source code depend on these rules to present information to users and to soundly perform their operations. In this paper, we show how to lift scoping rules defined on a core language to rules on the surface, a process of scope inference. In the process we introduce a new representation of binding structure---scope as a preorder---and present a theoretical advance: proving that a desugaring system preserves α-equivalence even though scoping rules have been provided only for the core language. We have also implemented the system presented in this paper.

Skip Supplemental Material Section

Supplemental Material

References

  1. Peter Aczel. 1978. A General Church-Rosser Theorem. Technical Report. University of Manchester.Google ScholarGoogle Scholar
  2. Michael D. Adams. 2015. Towards the Essence of Hygiene. In Principles of Programming Languages. ACM, New York, NY, USA, 457–469. DOI: Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. Sebastian Erdweg, Tijs van der Storm, and Yi Dai. 2014. Capture-Avoiding and Hygienic Program Transformations. In European Conference on Object-Oriented Programming . Springer-Verlag, Berlin, Heidelberg, 489–514. DOI: Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. Robert Bruce Findler, John Clements, Cormac Flanagan, Matthew Flatt, Shriram Krishnamurthi, Paul Steckler, and Matthias Felleisen. 2002. DrScheme: A Programming Environment for Scheme. Journal of Functional Programming 12 (2002), 159–182. DOI: Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. David Fisher and Olin Shivers. 2006. Static Analysis for Syntax Objects. In International Conference on Functional Programming. ACM, New York, NY, USA. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. Matthew Flatt. 2016. Binding as Sets of Scopes. In Principles of Programming Languages. ACM. DOI: Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. David Herman and Mitchell Wand. 2008. A Theory of Hygienic Macros. In European Symposium on Programming Languages and Systems . Springer-Verlag, Berlin, Heidelberg, 48–62. DOI: Google ScholarGoogle ScholarCross RefCross Ref
  8. R. Kelsey, W. Clinger, and J. Rees (eds.). 1998. Revised Report on the Algorithmic Language Scheme. Cambridge University Press.Google ScholarGoogle Scholar
  9. J. W. Klop. 1992. Term Rewriting Systems. Handbook of Logic in Computer Science (1992). DOI: Google ScholarGoogle ScholarCross RefCross Ref
  10. Donald E. Knuth. 1968. Semantics of Context-Free Languages. In Mathematical Systems Theory. Springer-Verlag. DOI: Google ScholarGoogle ScholarCross RefCross Ref
  11. Eugene Kohlbecker, Daniel P. Friedman, Matthias Felleisen, and Bruce Duba. 1986. Hygienic Macro Expansion. In ACM Conference on LISP and Functional Programming . ACM, New York, NY, USA, 11. DOI: Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. Gabrie Konat, Lennart Kats, Guido Wachsmuth, and Eelco Visser. 2012. Declarative Name Binding and Scope Rules. In Software Language Engineering . Springer-Verlag, Berlin, Heidelberg, 311–331. DOI: Google ScholarGoogle ScholarCross RefCross Ref
  13. Florian Lorenzen and Sebastian Erdweg. 2013. Modular and Automated Type-Soundness for Language Extensions. In International Conference on Functional Programming . ACM, New York, NY, USA, 12. DOI: Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. Pierre Neron, Andrew Tolmach, Eelco Visser, and Guido Wachsmuth. 2015. A Theory of Name Resolution. In European Symposium on Programming Languages and Systems . Springer-Verlag, Berlin, Heidelberg, 205–231. DOI: Google ScholarGoogle ScholarCross RefCross Ref
  15. Justin Pombrio and Shriram Krishnamurthi. 2014. Resugaring: Lifting Evaluation Sequences through Syntactic Sugar. In Programming Languages Design and Implementation . ACM, New York, NY, USA, 361–371. DOI: Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. Justin Pombrio and Shriram Krishnamurthi. 2015. Hygienic Resugaring of Compositional Desugaring. In International Conference on Functional Programming . ACM, New York, NY, USA, 75–87. DOI: Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. François Pottier. 2005. An Overview of C α ml. In Electronic Notes in Theoretical Computer Science. DOI: Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. Peter Sewell, Francesco Zappa Nardelli, Scott Owens, Gilles Peskine, Thomas Ridge, Susmit Sarkar, and Rok Strniša. 2010. Ott: Effective Tool Support for the Working Semanticist. Journal of Functional Programming (2010). DOI: Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. Simon Peyton Jones. 2003. Haskell 98 Language and Libraries: The Revised Report. Cambridge University Press.Google ScholarGoogle Scholar
  20. Paul Stansifer and Mitchell Wand. 2014. Romeo: a System For More Flexible Binding-Safe Programming. In International Conference on Functional Programming . ACM, New York, NY, USA, 53–65. DOI: Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. Stephanie Weirich, Brent Yorgey, and Tim Sheard. 2011. Binders Unbound. In International Conference on Functional Programming . ACM, New York, NY, USA, 333–345. DOI: Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Inferring scope 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 Proceedings of the ACM on Programming Languages
        Proceedings of the ACM on Programming Languages  Volume 1, Issue ICFP
        September 2017
        1173 pages
        EISSN:2475-1421
        DOI:10.1145/3136534
        Issue’s Table of Contents

        Copyright © 2017 ACM

        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 2017
        Published in pacmpl Volume 1, Issue ICFP

        Permissions

        Request permissions about this article.

        Request Permissions

        Check for updates

        Qualifiers

        • research-article

      PDF Format

      View or Download as a PDF file.

      PDF

      eReader

      View online with eReader.

      eReader