skip to main content
research-article
Public Access
Artifacts Available
Artifacts Evaluated & Functional

Inferring type rules for syntactic sugar

Published:11 June 2018Publication History
Skip Abstract Section

Abstract

Type systems and syntactic sugar are both valuable to programmers, but sometimes at odds. While sugar is a valuable mechanism for implementing realistic languages, the expansion process obscures program source structure. As a result, type errors can reference terms the programmers did not write (and even constructs they do not know), baffling them. The language developer must also manually construct type rules for the sugars, to give a typed account of the surface language. We address these problems by presenting a process for automatically reconstructing type rules for the surface language using rules for the core. We have implemented this theory, and show several interesting case studies.

Skip Supplemental Material Section

Supplemental Material

p812-pombrio.webm

References

  1. Ambrose Bonnaire-Sergeant, Rowan Davies, and Sam Tobin-Hochstadt. 2016. Practical Optional Types for Clojure. In European Symposium on Programming Languages and Systems. Springer-Verlag, Berlin, Heidelberg. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. Eugene Burmako. 2013. Scala macros: let our powers combine!. In Scala Workshop. ACM, New York, NY, USA. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. Benjamin C. Pierce. 2002. Types and Programming Languages. MIT Press. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. Stephen Chang, Alex Knauth, and Ben Greenman. 2017. Type systems as macros. In Principles of Programming Languages. ACM, New York, NY, USA. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. Daniel de Rauglaudre. 2007. Camlp5 - Reference Manua. (2007). http://pauillac.inria.fr/ddr/camlp5/doc/pdf/camlp5-5.06.pdf.Google ScholarGoogle Scholar
  6. Matthias Felleisen, Robert Bruce Findler, and Matthew Flatt. 2009. Semantics Engineering with PLT Redex. MIT Press. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. 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
  8. Matthew Flatt and PLT. June 7, 2010. Reference: Racket. Technical Report PLT-TR2010-1. PLT Inc. racket-lang.org/tr1/.Google ScholarGoogle Scholar
  9. Steve Ganz, Amr Sabry, and Walid Taha. 2001. Macros as Multi-Stage Computations: Type-Safe, Generative, Binding Macros in MacroML. In International Conference on Functional Programming. ACM, New York, NY, USA. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. Arjun Guha, Claudiu Saftoiu, and Shriram Krishnamurthi. 2010. The Essence of JavaScript. In European Conference on Object-oriented Programming. Springer-Verlag, Berlin, Heidelberg, 25. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. Bastiaan Heeren, Jurriaan Hage, and S. Doaitse Swierstra. 2003. Scripting the Type Inference Process. In International Conference on Functional Programming. ACM, NewYork, NY, USA. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. David Herman and Mitchell Wand. 2008. A Theory of Hygienic Macros. In European Symposium on Programming Languages and Systems. Springer-Verlag, Berlin, Heidelberg, 48s62. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. Gilles Kahn. 1987. Natural Semantics. In International Symposium on Theoretical Aspects of Computer Software. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. 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. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. Florian Lorenzen and Sebastian Erdweg. 2016. Sound type-dependent syntactic language extension. In Principles of Programming Languages. ACM, New York, NY, USA. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. Geoffrey Mainland. 2012. Explicitly Heterogeneous Metaprogramming with MetaHaskell. In International Conference on Functional Programming. ACM, New York, NY, USA. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. Cyrus Omar, Darya Kurilova, Ligia Nistor, Benjamin Chung, Alex Potanin, and Jonathan Aldrich. 2014. Safely Composable Type-Specific Languages. In European Conference on Object-Oriented Programming. Springer-Verlag, New York, NY, USA. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. Peyton Jones, Simon. 2003. Haskell 98 Language and Libraries: The Revised Report. Cambridge University Press.Google ScholarGoogle Scholar
  19. Gordon D. Plotkin. 1981. A Structured Approach to Operational Semantics. Technical Report DAIMI FN-19. Computer Science Department, Aarhus University, Aarhus, Denmark.Google ScholarGoogle Scholar
  20. Joe Gibbs Politz, Matt Carroll, Benjamin S. Lerner, Justin Pombrio, and Shriram Krishnamurthi. 2012. A Tested Semantics for Getters, Setters, and Eval in JavaScript. In Dynamic Languages Symposium. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. Joe Gibbs Politz, Alejandro Martinez, Matthew Milano, Sumner Warren, Daniel Patterson, Junsong Li, Anand Chitipothu, and Shriram Krishnamurthi. 2013. Python: The Full Monty: A Tested Semantics for the Python Programming Language. In ACM SIGPLAN Conference on Object-Oriented Programming Systems, Languages and Applications. ACM, New York, NY, USA, 217s232. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. 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. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. Justin Pombrio, Shriram Krishnamurthi, and Mitchell Wand. 2017. Inferring Scope through Syntactic Sugar. In International Conference on Functional Programming. ACM, New York, NY, USA. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. Alejandro Serrano and Jurriaan Hage. 2016. Type Error Diagnosis for Embedded DSLs by Two-Stage Specialized Type Rules. In European Symposium on Programming Languages and Systems. ACM, New York, NY, USA. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. Tim Sheard and Simon Peyton Jones. 2002. Template Metaprogramming for Haskell. In ACM SIGPLAN Haskell Workshop. ACM, New York, NY, USA. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. Joel Spolsky. 2002. The Law of Leaky Abstractions. Blog post: Joel on Software. (2002). https://www.joelonsoftware.com/2002/11/11/the-law-of-leaky-abstractions/.Google ScholarGoogle Scholar
  27. 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, 53s65. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. Sam Tobin-Hochstadt, Vincent St-Amour, Ryan Culpepper, Matthew Flatt, and Matthias Felleisen. 2011. Languages as Libraries. In Programming Languages Design and Implementation. ACM, New York, NY, USA. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Inferring type rules for 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

    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!