Abstract
This is a study of the computing power of the subtyping machine behind Kennedy and Pierce's nominal subtyping with variance. We depict the lattice of fragments of Kennedy and Pierce's type system and characterize their computing power in terms of regular, context-free, deterministic, and non-deterministic tree languages. Based on the theory, we present Treetop---a generator of C# implementations of subtyping machines. The software artifact constitutes the first feasible (yet POC) fluent API generator to support context-free API protocols in a decidable type system fragment.
Supplemental Material
- Ken Arnold, James Gosling, and David Holmes. 2006. The Java Programming Language (4 ed.). Addison-Wesley, Upper Saddle River, NJ. isbn:978-0-321-34980-4Google Scholar
- Henk Barendregt. 1991. Introduction to generalized type systems. J. Functional Prog., 1 (1991), 125–154. issn:0956-7968 https://doi.org/10.1017/s0956796800020025. Google Scholar
Cross Ref
- Norbert Blum and Robert Koch. 1999. Greibach Normal Form Transformation Revisited. Information and Computation, 150, 1 (1999), 112 – 118. issn:0890-5401 https://doi.org/10.1006/inco.1998.2772 Google Scholar
Digital Library
- Donald D. Chamberlin and Raymond F. Boyce. 1974. SEQUEL: A Structured English Query Language. In Proc. ACM SIGFIDET Work. Data Description, Access & Control (SIGFIDET ’74). ACM, NY/USA. 249–264. isbn:9781450374156 https://doi.org/10.1145/800296.811515 Google Scholar
Digital Library
- H. Comon, M. Dauchet, R. Gilleron, C. Löding, F. Jacquemard, D. Lugiez, S. Tison, and M. Tommasi. 2007. Tree Automata Techniques and App.. Available on:. http://tata.gforge.inria.fr/Google Scholar
- James O. Coplien. 1996. Curiously Recurring Template Patterns. SIGS Publications, Inc., USA. 135–144. isbn:1884842372 Google Scholar
Digital Library
- Kostas Ferles, Jon Stephens, and Isil Dillig. 2020. Verifying Correct Usage of Context-Free API Protocols (Extended Version). arxiv:2010.09652. Google Scholar
Digital Library
- Martin Fowler. 2005. FluentInterface. https://www.martinfowler.com/bliki/FluentInterface.html (accessed August 12, 2020)Google Scholar
- Ferenc Gécseg and Magnus Steinby. 1997. Tree Languages. Springer-Verlag, Berlin, Heidelberg. 1–68. isbn:3540606491 Google Scholar
Digital Library
- Joseph Gil and Ori Roth. 2020. Ties between Parametrically Polymorphic Type Systems and Finite Control Automata. arXiv preprint arXiv:2009.04437, arxiv:2009.04437.Google Scholar
- Yossi Gil and Tomer Levy. 2016. Formal language recognition with the Java type checker. In 30 Europ. Conf OO Prog. (ECOOP 2016), Shriram Krishnamurthi and Benjamin S. Lerner (Eds.) (Leibniz International Proceedings in Inf. (LIPIcs), Vol. 56). Schloss Dagstuhl–Leibniz-Zentrum fuer Informatik, Dagstuhl, Germany. 10:1–10:27. isbn:978-3-95977-014-9 issn:1868-8969 https://doi.org/10.4230/LIPIcs.ECOOP.2016.10 Google Scholar
- Yossi Gil and Ori Roth. 2019. Fling—a fluent API generator. In 33 Europ. Conf OO Prog. (ECOOP 2019), Alastair F. Donaldson (Ed.) (Leibniz International Proceedings in Inf. (LIPIcs), Vol. 134). Schloss Dagstuhl–Leibniz-Zentrum fuer Informatik, Dagstuhl, Germany. 13:1–13:25. isbn:978-3-95977-111-5 issn:1868-8969 https://doi.org/10.4230/LIPIcs.ECOOP.2019.13 Google Scholar
- Ben Greenman, Fabian Muehlboeck, and Ross Tate. 2014. Getting F-Bounded Polymorphism into Shape. SIGPLAN Not., 49, 6 (2014), June, 89–99. issn:0362-1340 https://doi.org/10.1145/2666356.2594308 Google Scholar
Digital Library
- Sheila A. Greibach. 1965. A New Normal-Form Theorem for Context-Free Phrase Structure Grammars. J. ACM, 12, 1 (1965), Jan., 42–52. issn:0004-5411 https://doi.org/10.1145/321250.321254 Google Scholar
Digital Library
- Radu Grigore. 2017. Java Generics Are Turing Complete. In Proceedings of the 44th ACM SIGPLAN Symposium on Principles of Programming Languages (POPL 2017). Association for Computing Machinery, New York, NY, USA. 73–85. isbn:9781450346603 https://doi.org/10.1145/3009837.3009871 Google Scholar
Digital Library
- Irène Guessarian. 1983. Pushdown tree automata. Math. Syst. Theory, 16, 1 (1983), 237–263.Google Scholar
- Anders Hejlsberg, Scott Wiltamuth, Peter Golde, and Mads Torgersen. 2003. The C# Programming Language (2 ed.). Addison-Wesley, Reading, MA, USA. isbn:0-321-15491-6 Google Scholar
Digital Library
- John E. Hopcroft, Rajeev Motwani, and Jeffrey D. Ullman. 2007. Introduction to automata theory, languages, and computation (3 ed.). Pearson Addison Wesley, Boston, MA. isbn:0321455371 Google Scholar
Digital Library
- Andrew Kennedy and Benjamin Pierce. 2007. On decidability of nominal subtyping with variance. In Int. Work. Found. & Devel. OO Lang. (FOOL/WOOD‘07). ACM, Nice, France. Article 5, 12 pages. http://foolwood07.cs.uchicago.edu/program/kennedy-abstract.htmlGoogle Scholar
- Tomoki Nakamaru and Shigeru Chiba. 2020. Generating a generic fluent API in Java. Art, Sci., & Eng. Prog., 4 (2020), Article 9, Feb., 23 pages. issn:2473-7321 https://doi.org/10.22152/programming-journal.org/2020/4/9Google Scholar
- Tomoki Nakamaru, Kazuhiro Ichikawa, Tetsuro Yamazaki, and Shigeru Chiba. 2017. Silverchain: a fluent API generator. In Proc. 16 ACM SIGPLAN Int. Conf Generative Prog. (GPCE’17). ACM, Vancouver, BC, Canada. 199–211. isbn:978-1-4503-5524-7 Google Scholar
Digital Library
- Tomoki Nakamaru, Tomomasa Matsunaga, Tetsuro Yamazaki, Soramichi Akiyama, and Shigeru Chiba. 2020. An Empirical Study of Method Chaining in Java. In Proceedings of the 17th International Conference on Mining Software Repositories (MSR ’20). Association for Computing Machinery, New York, NY, USA. 93–102. isbn:9781450375177 https://doi.org/10.1145/3379597.3387441 Google Scholar
Digital Library
- Martin Odersky, Philippe Altherr, Vincent Cremet, Burak Emir, Sebastian Maneth, Stéphane Micheloud, Nikolay Mihaylov, Michel Schinz, Erik Stenman, and Matthias Zenger. 2004. An Overview of the Scala Programming Language. EPFL Lausanne, Switzerland.Google Scholar
- Johannes Osterholzer. 2018. New Results on Context-Free Tree Languages. Ph. D. Dissertation. Technische Universität Dresden. Zellescher Weg 18 01069 Dresden. https://nbn-resolving.org/urn:nbn:de:bsz:14-qucosa-235434Google Scholar
- Ori Roth. 2021. Study of the Subtyping Machine of Nominal Subtyping with Variance (full version). arxiv:2109.03950. Google Scholar
Digital Library
- Ori Roth. 2021. Treetop: A Context-Free Fluent API Generator for C#. https://doi.org/10.5281/zenodo.5091711 Google Scholar
Digital Library
- Leslie G. Valiant. 1975. General context-free recognition in less than cubic time. J. Comput. System Sci., 10, 2 (1975), 308 – 315. issn:0022-0000 https://doi.org/10.1016/S0022-0000(75)80046-8 Google Scholar
Digital Library
- Mirko Viroli. 2000. On the recursive generation of parametric types. DEIS-LIA-00-002, Universitá di Bologna.Google Scholar
- Hao Xu. 2010. EriLex: an embedded domain specific language generator. In Objects, Models, Components, Patterns, Jan Vitek (Ed.). Springer, Berlin, Heidelberg. 192–212. isbn:978-3-642-13953-6 Google Scholar
Digital Library
- Tetsuro Yamazaki, Tomoki Nakamaru, Kazuhiro Ichikawa, and Shigeru Chiba. 2019. Generating a fluent API with syntax checking from an LR grammar. Proc. ACM Program. Lang., 3 (2019), Article 134, Oct., 24 pages. https://doi.org/10.1145/3360560 Google Scholar
Digital Library
Index Terms
Study of the subtyping machine of nominal subtyping with variance
Recommendations
Subtyping delimited continuations
ICFP '11: Proceedings of the 16th ACM SIGPLAN international conference on Functional programmingWe present a type system with subtyping for first-class delimited continuations that generalizes Danvy and Filinski's type system for shift and reset by maintaining explicit information about the types of contexts in the metacontext. We exploit this ...
Unifying typing and subtyping
In recent years dependent types have become a hot topic in programming language research. A key reason why dependent types are interesting is that they allow unifying types and terms, which enables both additional expressiveness and economy of concepts. ...
Matching MyType to subtyping
The notion of MyType has been proposed to promote type-safe reuse of binary methods and recently extended to mutually recursive definitions. It is well known, however, that MyType does not match with subtyping well. In current type systems, type safety ...






Comments