skip to main content
10.1145/3567512.3567533acmconferencesArticle/Chapter ViewAbstractPublication PagessplashConference Proceedingsconference-collections
research-article

Yet Another Generating Method of Fluent Interfaces Supporting Flat- and Sub-chaining Styles

Published: 01 December 2022 Publication History

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.

References

[1]
Alfred Aho, Jeffrey Ullman, Ravi Sethi, and Monica Lam. 2006. Compilers: Principles, Techniques, and Tools (2 ed.). Addison Wesley. isbn:978-0321486813
[2]
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
[3]
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
[4]
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
[5]
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
[6]
2000. jMock - An Expressive Mock Object Library for Java. http://jmock.org/
[7]
2009. jOOQ: The easiest way to write SQL in Java. https://www.jooq.org/
[8]
Tomer Levy. 2017. A Fluent API for Automatic Generation of Fluent APIs in Java. Master’s thesis. Israel Institute of Technology.
[9]
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
[10]
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
[11]
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
[12]
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
[13]
2014. Java Platform Standard Edition 8 Documentation - interface Stream<T>. https://docs.oracle.com/javase/jp/8/docs/api/java/util/stream/Stream.html
[14]
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
[15]
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

Cited By

View all

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM Conferences
SLE 2022: Proceedings of the 15th ACM SIGPLAN International Conference on Software Language Engineering
November 2022
278 pages
ISBN:9781450399197
DOI:10.1145/3567512
Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than the author(s) must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected].

Sponsors

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 01 December 2022

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. LL(1) parsing
  2. fluent interface generation
  3. grammar rewriting

Qualifiers

  • Research-article

Funding Sources

Conference

SLE '22
Sponsor:

Upcoming Conference

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)35
  • Downloads (Last 6 weeks)1
Reflects downloads up to 06 Nov 2024

Other Metrics

Citations

Cited By

View all

View Options

Get Access

Login options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media