skip to main content
research-article

A co-contextual formulation of type rules and its application to incremental type checking

Published:23 October 2015Publication History
Skip Abstract Section

Abstract

Type rules associate types to expressions given a typing context. As the type checker traverses the expression tree top-down, it extends the typing context with additional context information that becomes available. This way, the typing context coordinates type checking in otherwise independent subexpressions, which inhibits parallelization and incrementalization of type checking. We propose a co-contextual formulation of type rules that only take an expression as input and produce a type and a set of context requirements. Co-contextual type checkers traverse an expression tree bottom-up and merge context requirements of independently checked subexpressions. We describe a method for systematically constructing a co-contextual formulation of type rules from a regular context-based formulation and we show how co-contextual type rules give rise to incremental type checking. Using our method, we derive incremental type checkers for PCF and for extensions that introduce records, parametric polymorphism, and subtyping. Our performance evaluation shows that co-contextual type checking has performance comparable to standard context-based type checking, and incrementalization can improve performance significantly.

References

  1. U. A. Acar, G. E. Blelloch, M. Blume, R. Harper, and K. Tangwongsan. An experimental analysis of self-adjusting computation. Transactions on Programming Languages and Systems (TOPLAS), 32(1), 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. S. Aditya and R. S. Nikhil. Incremental polymorphism. In Proceedings of Conference on Functional Programming Languages and Computer Architecture (FPCA), pages 379– 405. ACM, 1991. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. D. Ancona, F. Damiani, S. Drossopoulou, and E. Zucca. Polymorphic bytecode: Compositional compilation for Java-like languages. In Proceedings of Symposium on Principles of Programming Languages (POPL), pages 26–37. ACM, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. I. Attali, J. Chazarain, and S. Gilette. Incremental evaluation of natural semantics specifications. Logical Foundations of Computer Science, pages 87–104, 1992.Google ScholarGoogle ScholarCross RefCross Ref
  5. R. Bahlke and G. Snelting. The PSG system: From formal language definitions to interactive programming environments. Transactions on Programming Languages and Systems (TOPLAS), 8(4):547–576, 1986. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. L. A. Chamberland, S. F. Lymer, and A. G. Ryman. IBM VisualAge for Java. IBM Systems Journal, 37(3):386–408, 1998. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. O. Chitil. Compositional explanation of types and algorithmic debugging of type errors. In Proceedings of International Conference on Functional Programming (ICFP), pages 193– 204. ACM, 2001. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. A. J. Demers, T. W. Reps, and T. Teitelbaum. Incremental evaluation for attribute grammars with application to syntaxdirected editors. In Proceedings of Symposium on Principles of Programming Languages (POPL), pages 105–116. ACM, 1981. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. T. Despeyroux. Executable specification of static semantics. In Semantics of Data Types, volume 173 of LNCS. Springer, 1984.Google ScholarGoogle ScholarCross RefCross Ref
  10. M. A. Hammer, Y. P. Khoo, M. Hicks, and J. S. Foster. Adapton: composable, demand-driven incremental computation. In Proceedings of Conference on Programming Language Design and Implementation (PLDI), pages 156–166. ACM, 2014. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. T. Jim. What are principal typings and what are they good for? In Proceedings of Symposium on Principles of Programming Languages (POPL), pages 42–53. ACM, 1996. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. G. F. Johnson and J. A. Walz. A maximum-flow approach to anomaly isolation in unification-based incremental type inference. In Proceedings of Symposium on Principles of Programming Languages (POPL), pages 44–57. ACM, 1986. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. G. Kahn. Natural semantics. In Proceedings of Symposium on Theoretical Aspects of Computer Science (STACS), pages 22–39. Springer, 1987. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. A. Kuhn, G. C. Murphy, and C. A. Thompson. An exploratory study of forces and frictions affecting large-scale model-driven development. In Proceedings of Conference on Model Driven Engineering Languages and Systems (MoDELS), volume 7590 of LNCS, pages 352–367. Springer, 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. L. G. L. T. Meertens. Incremental polymorphic type checking in B. In Proceedings of Symposium on Principles of Programming Languages (POPL), pages 265–275. ACM, 1983. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. W. Miao and J. G. Siek. Incremental type-checking for type-reflective metaprograms. In Proceedings of Conference on Generative Programming and Component Engineering (GPCE), pages 167–176. ACM, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. R. Milner. A theory of type polymorphism in programming. Computer and System Sciences, 17(3):348–375, 1978.Google ScholarGoogle ScholarCross RefCross Ref
  18. R. Mitschke, S. Erdweg, M. Köhler, M. Mezini, and G. Salvaneschi. i3QL: Language-integrated live data views. In Proceedings of Conference on Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA), pages 417– 432. ACM, 2014. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. B. C. Pierce. Types and programming languages. MIT press, 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. B. C. Pierce and D. N. Turner. Local type inference. Transactions on Programming Languages and Systems (TOPLAS), 22(1):1–44, 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. F. Pottier. Simplifying subtyping constraints: A theory. Information and Computation, 170(2):153–183, 2001. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. G. Snelting. The calculus of context relations. Acta Informatica, 28(5):411–445, 1991. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. G. Snelting and W. Henhapl. Unification in many-sorted algebras as a device for incremental semantic analysis. In Proceedings of Symposium on Principles of Programming Languages (POPL), pages 229–235. ACM, 1986. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. G. Wachsmuth, G. D. P. Konat, V. A. Vergu, D. M. Groenewegen, and E. Visser. A language independent task engine for incremental name and type analysis. In Proceedings of Conference on Software Language Engineering (SLE), volume 8225 of LNCS, pages 260–280, 2013.Google ScholarGoogle ScholarCross RefCross Ref
  25. J. B. Wells. The essence of principal typings. In Proceedings of International Colloquium on Automata, Languages and Programming (ICALP), volume 2380 of LNCS, pages 913– 925. Springer, 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. A co-contextual formulation of type rules and its application to incremental type checking

          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 50, Issue 10
            OOPSLA '15
            October 2015
            953 pages
            ISSN:0362-1340
            EISSN:1558-1160
            DOI:10.1145/2858965
            • Editor:
            • Andy Gill
            Issue’s Table of Contents
            • cover image ACM Conferences
              OOPSLA 2015: Proceedings of the 2015 ACM SIGPLAN International Conference on Object-Oriented Programming, Systems, Languages, and Applications
              October 2015
              953 pages
              ISBN:9781450336895
              DOI:10.1145/2814270

            Copyright © 2015 ACM

            Publisher

            Association for Computing Machinery

            New York, NY, United States

            Publication History

            • Published: 23 October 2015

            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!