ABSTRACT
Researchers discovered methods to generate fluent interfaces equipped with static checking to verify their calling conventions. This static checking is done by carefully designing classes and method signatures to make type checking to perform a calculation equivalent to syntax checking. In this paper, we propose a method to generate a fluent interface with syntax checking, which accepts both styles of method chaining; flat-chaining style and sub-chaining style. Supporting both styles is worthwhile because it allows programmers to wrap out parts of their method chaining for readability. Our method is based on grammar rewriting so that we could inspect the acceptable grammar. In conclusion, our method succeeds generation when the input grammar is LL(1) and there is no non-terminal symbol that generates either only an empty string or nothing.
- Alfred Aho, Jeffrey Ullman, Ravi Sethi, and Monica Lam. 2006. Compilers: Principles, Techniques, and Tools (2 ed.). Addison Wesley. isbn:978-0321486813 Google Scholar
- Yossi Gil and Tomer Levy. 2016. Formal Language Recognition with the Java Type Checker. In Proceedings of 30th European Conference on Object-Oriented Programming. https://doi.org/10.4230/LIPIcs.ECOOP.2016.10 Google ScholarCross Ref
- Yossi Gil and Ori Roth. 2019. Fling - A Fluent API Generator. In 33rd European Conference on Object-Oriented Programming (ECOOP 2019). https://doi.org/10.4230/LIPIcs.ECOOP.2019.13 Google ScholarCross Ref
- Radu Grigore. 2017. Java Generics Are Turing Complete. In Proceedings of the 44th ACM SIGPLAN Symposium on Principles of Programming Languages. isbn:9781450346603 https://doi.org/10.1145/3009837.3009871 Google ScholarDigital Library
- Dick Grune, Kees van Reeuwijk, Henri E. Bal, Ceriel J.H. Jacobs, and Koen Langendoen. 2012. Modern Compiler Design (2 ed.). Springer New York, NY. isbn:978-1-4614-4699-6 https://doi.org/10.1007/978-1-4614-4699-6 Google ScholarCross Ref
- 2000. jMock - An Expressive Mock Object Library for Java. http://jmock.org/ Google Scholar
- 2009. jOOQ: The easiest way to write SQL in Java. https://www.jooq.org/ Google Scholar
- Tomer Levy. 2017. A Fluent API for Automatic Generation of Fluent APIs in Java. Master’s thesis. Israel Institute of Technology. Google Scholar
- Tomoki Nakamaru and Shigeru Chiba. 2020. Generating a Generic Fluent API in Java. The Art, Science, and Engineering of Programming, 4, 3 (2020), 9. https://doi.org/10.22152/programming-journal.org/2020/4/9 Google ScholarCross Ref
- Tomoki Nakamaru, Kazuhiro Ichikawa, Tetsuro Yamazaki, and Shigeru Chiba. 2017. Silverchain: a fluent API generator. In Proceedings of the 16th ACM SIGPLAN International Conference on Generative Programming: Concepts and Experiences. https://doi.org/10.1145/3136040.3136041 Google ScholarDigital 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 ScholarDigital Library
- Ori Roth. 2021. Study of the Subtyping Machine of Nominal Subtyping with Variance. Proc. ACM Program. Lang., 5, OOPSLA (2021), Article 137, oct, 27 pages. https://doi.org/10.1145/3485514 Google ScholarDigital Library
- 2014. Java Platform Standard Edition 8 Documentation - interface Stream<T>. https://docs.oracle.com/javase/jp/8/docs/api/java/util/stream/Stream.html Google Scholar
- Hao Xu. 2010. EriLex: An Embedded Domain Specific Language Generator. Springer-Verlag, 192–212. isbn:978-3-642-13953-6 https://doi.org/10.1007/978-3-642-13953-6_11 Google ScholarCross Ref
- 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, OOPSLA (2019), Article 134, oct, 24 pages. https://doi.org/10.1145/3360560 Google ScholarDigital Library
Index Terms
- Yet Another Generating Method of Fluent Interfaces Supporting Flat- and Sub-chaining Styles
Recommendations
Generating a fluent API with syntax checking from an LR grammar
This paper proposes a fluent API generator for Scala, Haskell, and C++. It receives a grammar definition and generates a code skeleton of the library in the host programming language. The generated library is accessed through a chain of method calls; ...
Silverchain: a fluent API generator
GPCE 2017: Proceedings of the 16th ACM SIGPLAN International Conference on Generative Programming: Concepts and ExperiencesThis paper presents a tool named Silverchain, which generates class definitions for a fluent API from the grammar of the API. A fluent API is an API that is used by method chaining and its grammar is a BNF-like set of rules that defines method chains ...
Yet another chart-based technique for parsing ill-formed input
ANLC '94: Proceedings of the fourth conference on Applied natural language processingA new chart-based technique for parsing ill-formed input is proposed. This can process sentences with unknown/misspelled words, omitted words or extraneous words. This generalized parsing strategy is, similar to Mellish's, based on an active chart ...
Comments