Context-Free Session Type Inference

  • Luca Padovani
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 10201)


Some interesting communication protocols can be precisely described only by context-free session types, an extension of conventional session types with a general form of sequential composition. The complex metatheory of context-free session types, however, hinders the definition of corresponding checking and inference algorithms. In this work we address and solve these problems introducing a new type system for context-free session types of which we provide two OCaml embeddings.


Type System Sequential Composition Typing Rule Type Environment Concrete Syntax 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.



The author is grateful to the anonymous ESOP reviewers for their detailed and valuable feedback and to Hernán Melgratti for reading and commenting on an early draft of the paper.


  1. 1.
    Ahmed, A., Fluet, M., Morrisett, G.: L\({}^{{3}}\): a linear language with locations. Fundam. Informaticae 77(4), 397–449 (2007)MathSciNetzbMATHGoogle Scholar
  2. 2.
    Charguéraud, A., Pottier, F.: Functional translation of a calculus of capabilities. In: Proceedings of ICFP 2008, pp. 213–224. ACM (2008)Google Scholar
  3. 3.
    Courcelle, B.: Fundamental properties of infinite trees. Theor. Comput. Sci. 25, 95–169 (1983)MathSciNetCrossRefzbMATHGoogle Scholar
  4. 4.
    Dardha, O., Giachino, E., Sangiorgi, D.: Session types revisited. In: Proceedings of PPDP 2012, pp. 139–150. ACM (2012)Google Scholar
  5. 5.
    Demangeon, R., Honda, K.: Full abstraction in a subtyped pi-calculus with linear types. In: Katoen, J.-P., König, B. (eds.) CONCUR 2011. LNCS, vol. 6901, pp. 280–296. Springer, Heidelberg (2011). doi: 10.1007/978-3-642-23217-6_19 CrossRefGoogle Scholar
  6. 6.
    Florijn, G.: Object protocols as functional parsers. In: Tokoro, M., Pareschi, R. (eds.) ECOOP 1995. LNCS, vol. 952, pp. 351–373. Springer, Heidelberg (1995). doi: 10.1007/3-540-49538-X_17 CrossRefGoogle Scholar
  7. 7.
    Frisch, A., Garrigue, J.: First-class modules and composable signatures in Objective Caml 3.12. In: ACM SIGPLAN Workshop on ML (2010)Google Scholar
  8. 8.
    Gay, S.J., Vasconcelos, V.T.: Linear type theory for asynchronous session types. J. Funct. Program. 20(1), 19–50 (2010)MathSciNetCrossRefzbMATHGoogle Scholar
  9. 9.
    Honda, K.: Types for dyadic interaction. In: Best, E. (ed.) CONCUR 1993. LNCS, vol. 715, pp. 509–523. Springer, Heidelberg (1993). doi: 10.1007/3-540-57208-2_35 Google Scholar
  10. 10.
    Honda, K., Vasconcelos, V.T., Kubo, M.: Language primitives and type discipline for structured communication-based programming. In: Hankin, C. (ed.) ESOP 1998. LNCS, vol. 1381, pp. 122–138. Springer, Heidelberg (1998). doi: 10.1007/BFb0053567 CrossRefGoogle Scholar
  11. 11.
    Hu, R., Yoshida, N.: Hybrid session verification through endpoint API generation. In: Stevens, P., Wąsowski, A. (eds.) FASE 2016. LNCS, vol. 9633, pp. 401–418. Springer, Heidelberg (2016). doi: 10.1007/978-3-662-49665-7_24 CrossRefGoogle Scholar
  12. 12.
    Hüttel, H., Lanese, I., Vasconcelos, V.T., Caires, L., Carbone, M., Deniélou, P.-M., Mostrous, D., Padovani, L., Ravara, A., Tuosto, E., Vieira, H.T., Zavattaro, G.: Foundations of session types and behavioural contracts. ACM Comput. Surv. 49(1), 3 (2016)CrossRefGoogle Scholar
  13. 13.
    Kfoury, A.J., Tiuryn, J., Urzyczyn, P.: Type reconstruction in the presence of polymorphic recursion. ACM Trans. Program. Lang. Syst. 15(2), 290–311 (1993)CrossRefGoogle Scholar
  14. 14.
    Kobayashi, N.: Type systems for concurrent programs. In: Aichernig, B.K., Maibaum, T. (eds.) Formal Methods at the Crossroads. From Panacea to Foundational Support. LNCS, vol. 2757, pp. 439–453. Springer, Heidelberg (2003). doi: 10.1007/978-3-540-40007-3_26. CrossRefGoogle Scholar
  15. 15.
    Kobayashi, N., Pierce, B.C., Turner, D.N.: Linearity and the pi-calculus. ACM Trans. Program. Lang. Syst. 21(5), 914–947 (1999)CrossRefGoogle Scholar
  16. 16.
    Launchbury, J., Jones, S.L.P.: State in Haskell. Lisp Symbolic Comput. 8(4), 293–341 (1995)CrossRefGoogle Scholar
  17. 17.
    Mitchell, J.C., Plotkin, G.D.: Abstract types have existential type. ACM Trans. Program. Lang. Syst. 10(3), 470–502 (1988)CrossRefGoogle Scholar
  18. 18.
    Moggi, E., Sabry, A.: Monadic encapsulation of effects: a revised approach (extended version). J. Funct. Program. 11(6), 591–627 (2001)MathSciNetCrossRefzbMATHGoogle Scholar
  19. 19.
    Nierstrasz, O.: Regular types for active objects. In: Proceedings of OOPSLA 1993, pp. 1–15. ACM (1993)Google Scholar
  20. 20.
    Padovani, L.: Context-free session type inference. Technical report, Università di Torino (2016). Accessed 04 Jan 2017
  21. 21.
    Padovani, L.: A simple library implementation of binary sessions. J. Funct. Program. 27 (2017).
  22. 22.
    Ravara, A., Vasconcelos, V.T.: Typing non-uniform concurrent objects. In: Palamidessi, C. (ed.) CONCUR 2000. LNCS, vol. 1877, pp. 474–489. Springer, Heidelberg (2000). doi: 10.1007/3-540-44618-4_34 CrossRefGoogle Scholar
  23. 23.
    Reppy, J.H.: Concurrent Programming in ML. Cambridge University Press, Cambridge (1999)CrossRefzbMATHGoogle Scholar
  24. 24.
    Südholt, M.: A model of components with non-regular protocols. In: Gschwind, T., Aßmann, U., Nierstrasz, O. (eds.) SC 2005. LNCS, vol. 3628, pp. 99–113. Springer, Heidelberg (2005). doi: 10.1007/11550679_8 CrossRefGoogle Scholar
  25. 25.
    Thiemann, P., Vasconcelos, V.T.: Context-free session types. In: Proceedings of ICFP 2016, pp. 462–475. ACM (2016)Google Scholar
  26. 26.
    Tov, J.A.: Practical programming with substructural types. Ph.D. thesis, Northeastern University (2012)Google Scholar
  27. 27.
    Tov, J.A., Pucella, R.: Stateful contracts for affine types. In: Gordon, A.D. (ed.) ESOP 2010. LNCS, vol. 6012, pp. 550–569. Springer, Heidelberg (2010). doi: 10.1007/978-3-642-11957-6_29 CrossRefGoogle Scholar
  28. 28.
    Tov, J.A., Pucella, R.: Practical affine types. In: Proceedings of POPL 2011, pp. 447–458. ACM (2011)Google Scholar
  29. 29.
    Wadler, P.: Propositions as sessions. J. Funct. Program. 24(2–3), 384–418 (2014)MathSciNetCrossRefzbMATHGoogle Scholar
  30. 30.
    Walker, D., Watkins, K.: On regions and linear types. In: Proceedings of ICFP 2001, pp. 181–192. ACM (2001)Google Scholar
  31. 31.
    Wright, A.K., Felleisen, M.: A syntactic approach to type soundness. Inf. Comput. 115(1), 38–94 (1994)MathSciNetCrossRefzbMATHGoogle Scholar
  32. 32.
    Yallop, J., Kiselyov, O.: First-class modules: hidden power and tantalizing promises. In: ACM SIGPLAN Workshop on ML (2010)Google Scholar

Copyright information

© Springer-Verlag GmbH Germany 2017

Authors and Affiliations

  1. 1.Dipartimento di InformaticaUniversità di TorinoTorinoItaly

Personalised recommendations