{"status":"ok","message-type":"work","message-version":"1.0.0","message":{"indexed":{"date-parts":[[2026,2,19]],"date-time":"2026-02-19T12:22:02Z","timestamp":1771503722720,"version":"3.50.1"},"reference-count":30,"publisher":"Association for Computing Machinery (ACM)","issue":"OOPSLA","license":[{"start":{"date-parts":[[2019,10,10]],"date-time":"2019-10-10T00:00:00Z","timestamp":1570665600000},"content-version":"vor","delay-in-days":0,"URL":"https:\/\/creativecommons.org\/licenses\/by\/4.0\/"}],"content-domain":{"domain":["dl.acm.org"],"crossmark-restriction":true},"short-container-title":["Proc. ACM Program. Lang."],"published-print":{"date-parts":[[2019,10,10]]},"abstract":"<jats:p>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; this style of API is called a fluent API. The library uses the host-language type checker to detect an invalid chain of method calls. Each method call is regarded as a lexical token in the embedded domain specific language implemented by that library. A sequence of the lexical tokens is checked and, if the sequence is not acceptable by the grammar, a type error is reported during compilation time. A contribution of this paper is to present an algorithm for generating the code-skeleton for a fluent API that reports a type error when a chain of method calls to the library does not match the given LR grammar. Our algorithm works in Scala, Haskell, and C++. To encode LR parsing, it uses the method\/function overloading available in those languages. It does not need an advanced type system, or exponential compilation time or memory consumption. This paper also presents our implementation of the proposed generator.<\/jats:p>","DOI":"10.1145\/3360560","type":"journal-article","created":{"date-parts":[[2019,10,11]],"date-time":"2019-10-11T14:53:33Z","timestamp":1570805613000},"page":"1-24","update-policy":"https:\/\/doi.org\/10.1145\/crossmark-policy","source":"Crossref","is-referenced-by-count":10,"title":["Generating a fluent API with syntax checking from an LR grammar"],"prefix":"10.1145","volume":"3","author":[{"given":"Tetsuro","family":"Yamazaki","sequence":"first","affiliation":[{"name":"University of Tokyo, Japan"}]},{"given":"Tomoki","family":"Nakamaru","sequence":"additional","affiliation":[{"name":"University of Tokyo, Japan"}]},{"given":"Kazuhiro","family":"Ichikawa","sequence":"additional","affiliation":[{"name":"University of Tokyo, Japan"}]},{"given":"Shigeru","family":"Chiba","sequence":"additional","affiliation":[{"name":"University of Tokyo, Japan"}]}],"member":"320","published-online":{"date-parts":[[2019,10,10]]},"reference":[{"key":"e_1_2_1_1_1","unstructured":"Roland Bock. 2016. rbock\/sqlpp11: A type safe SQL template library for C++. https:\/\/github.com\/rbock\/sqlpp11 .  Roland Bock. 2016. rbock\/sqlpp11: A type safe SQL template library for C++. https:\/\/github.com\/rbock\/sqlpp11 ."},{"key":"e_1_2_1_2_1","unstructured":"John Cocke. 1969. Programming Languages and Their Compilers: Preliminary Notes.  John Cocke. 1969. Programming Languages and Their Compilers: Preliminary Notes."},{"key":"e_1_2_1_3_1","volume-title":"On Jump-Deterministic Pushdown Automata. Mathematical systems theory","author":"Courcelle Bruno","year":"1977","unstructured":"Bruno Courcelle . 1977. On Jump-Deterministic Pushdown Automata. Mathematical systems theory ( 1977 ). Bruno Courcelle. 1977. On Jump-Deterministic Pushdown Automata. Mathematical systems theory (1977)."},{"key":"e_1_2_1_4_1","doi-asserted-by":"publisher","DOI":"10.1145\/1985793.1985889"},{"key":"e_1_2_1_5_1","unstructured":"Apache Software Foundation. 2014. Apache Phoenix. https:\/\/phoenix.apache.org\/ .  Apache Software Foundation. 2014. Apache Phoenix. https:\/\/phoenix.apache.org\/ ."},{"key":"e_1_2_1_6_1","unstructured":"Martin Fowler. 2005. FluentInterface. https:\/\/www.martinfowler.com\/bliki\/FluentInterface.html .  Martin Fowler. 2005. FluentInterface. https:\/\/www.martinfowler.com\/bliki\/FluentInterface.html ."},{"key":"e_1_2_1_7_1","doi-asserted-by":"publisher","DOI":"10.5555\/358668.358697"},{"key":"e_1_2_1_8_1","doi-asserted-by":"publisher","DOI":"10.1145\/2628136.2628138"},{"key":"e_1_2_1_9_1","doi-asserted-by":"publisher","DOI":"10.1016\/j.scico.2010.01.004"},{"key":"e_1_2_1_10_1","volume-title":"Proceedings of 30th European Conference on Object-Oriented Programming .","author":"Gil Yossi","year":"2016","unstructured":"Yossi Gil and Tomer Levy . 2016 . Formal Language Recognition with the Java Type Checker . In Proceedings of 30th European Conference on Object-Oriented Programming . Yossi Gil and Tomer Levy. 2016. Formal Language Recognition with the Java Type Checker. In Proceedings of 30th European Conference on Object-Oriented Programming ."},{"key":"e_1_2_1_11_1","doi-asserted-by":"publisher","DOI":"10.4230\/LIPIcs.ECOOP.2019.13"},{"key":"e_1_2_1_12_1","doi-asserted-by":"publisher","DOI":"10.1007\/BF01786988"},{"key":"e_1_2_1_13_1","doi-asserted-by":"publisher","DOI":"10.1145\/3009837.3009871"},{"key":"e_1_2_1_14_1","doi-asserted-by":"publisher","DOI":"10.1016\/0304-3975(81)90067-0"},{"key":"e_1_2_1_15_1","volume-title":"CONCUR\u201993","author":"Honda Kohei","unstructured":"Kohei Honda . 1993. Types for dyadic interaction . In CONCUR\u201993 , Eike Best (Ed.). Springer Berlin Heidelberg , Berlin, Heidelberg , 509\u2013523. Kohei Honda. 1993. Types for dyadic interaction. In CONCUR\u201993, Eike Best (Ed.). Springer Berlin Heidelberg, Berlin, Heidelberg, 509\u2013523."},{"key":"e_1_2_1_16_1","volume-title":"Building Domain-Specific Embedded Languages. Comput. Surveys","author":"Hudak Paul","year":"1996","unstructured":"Paul Hudak . 1996. Building Domain-Specific Embedded Languages. Comput. Surveys ( 1996 ). Paul Hudak. 1996. Building Domain-Specific Embedded Languages. Comput. Surveys (1996)."},{"key":"e_1_2_1_17_1","volume-title":"Article 15","author":"Ichikawa Kazuhiro","year":"2017","unstructured":"Kazuhiro Ichikawa and Shigeru Chiba . 2017. User-Defined Operators Including Name Binding for New Language Constructs. The Art, Science, and Engineering of Programming 1, 2 , Article 15 ( 2017 ), 15:1\u201315:25 pages. Kazuhiro Ichikawa and Shigeru Chiba. 2017. User-Defined Operators Including Name Binding for New Language Constructs. The Art, Science, and Engineering of Programming 1, 2, Article 15 (2017), 15:1\u201315:25 pages."},{"key":"e_1_2_1_18_1","unstructured":"Google Inc. 2011. Improve your code with lint checks. https:\/\/developer.android.com\/studio\/write\/lint .  Google Inc. 2011. Improve your code with lint checks. https:\/\/developer.android.com\/studio\/write\/lint ."},{"key":"e_1_2_1_20_1","doi-asserted-by":"publisher","DOI":"10.1016\/j.scico.2017.10.006"},{"key":"e_1_2_1_21_1","volume-title":"European Conference on Object-Oriented Programming (ECOOP). 10:1\u201310:27","author":"Kr\u00fcger Stefan","year":"2018","unstructured":"Stefan Kr\u00fcger , Johannes Sp\u00e4th , Karim Ali , Eric Bodden , and Mira Mezini . 2018 . CrySL: An Extensible Approach to Validating the Correct Usage of Cryptographic APIs . In European Conference on Object-Oriented Programming (ECOOP). 10:1\u201310:27 . Stefan Kr\u00fcger, Johannes Sp\u00e4th, Karim Ali, Eric Bodden, and Mira Mezini. 2018. CrySL: An Extensible Approach to Validating the Correct Usage of Cryptographic APIs. In European Conference on Object-Oriented Programming (ECOOP). 10:1\u201310:27."},{"key":"e_1_2_1_22_1","unstructured":"Tomer Levy. 2017. A Fluent API for Automatic Generation of Fluent APIs in Java.  Tomer Levy. 2017. A Fluent API for Automatic Generation of Fluent APIs in Java."},{"key":"e_1_2_1_23_1","doi-asserted-by":"publisher","DOI":"10.1016\/0020-0190(94)90033-7"},{"key":"e_1_2_1_24_1","doi-asserted-by":"publisher","DOI":"10.1145\/3136040.3136041"},{"key":"e_1_2_1_25_1","unstructured":"Hanne Riis Nielson and Flemming Nielson. 1992. Semantics with Applications: A Formal Introduction.  Hanne Riis Nielson and Flemming Nielson. 1992. Semantics with Applications: A Formal Introduction."},{"key":"e_1_2_1_26_1","doi-asserted-by":"publisher","DOI":"10.1145\/2489828.2489830"},{"key":"e_1_2_1_27_1","doi-asserted-by":"publisher","DOI":"10.1145\/2048066.2048122"},{"key":"e_1_2_1_28_1","doi-asserted-by":"publisher","DOI":"10.1145\/2951913.2951926"},{"key":"e_1_2_1_29_1","volume-title":"Technical Report","author":"Veldhuizen Todd","unstructured":"Todd Veldhuizen . 2003. C++ Templates are Turing Complete . Technical Report . Indiana University Computer Science . Todd Veldhuizen. 2003. C++ Templates are Turing Complete. Technical Report. Indiana University Computer Science."},{"key":"e_1_2_1_30_1","doi-asserted-by":"crossref","unstructured":"Hao Xu. 2010. EriLex: An Embedded Domain Specific Language Generator.  Hao Xu. 2010. EriLex: An Embedded Domain Specific Language Generator.","DOI":"10.1007\/978-3-642-13953-6_11"},{"key":"e_1_2_1_31_1","volume-title":"Recognition and parsing of context-free languages in time n 3 . Information and Control","author":"Younger Daniel","year":"1967","unstructured":"Daniel Younger . 1967. Recognition and parsing of context-free languages in time n 3 . Information and Control ( 1967 ). Daniel Younger. 1967. Recognition and parsing of context-free languages in time n 3 . Information and Control (1967)."}],"container-title":["Proceedings of the ACM on Programming Languages"],"original-title":[],"language":"en","link":[{"URL":"https:\/\/dl.acm.org\/doi\/10.1145\/3360560","content-type":"unspecified","content-version":"vor","intended-application":"text-mining"},{"URL":"https:\/\/dl.acm.org\/doi\/pdf\/10.1145\/3360560","content-type":"unspecified","content-version":"vor","intended-application":"similarity-checking"}],"deposited":{"date-parts":[[2025,6,17]],"date-time":"2025-06-17T23:22:59Z","timestamp":1750202579000},"score":1,"resource":{"primary":{"URL":"https:\/\/dl.acm.org\/doi\/10.1145\/3360560"}},"subtitle":[],"short-title":[],"issued":{"date-parts":[[2019,10,10]]},"references-count":30,"journal-issue":{"issue":"OOPSLA","published-print":{"date-parts":[[2019,10,10]]}},"alternative-id":["10.1145\/3360560"],"URL":"https:\/\/doi.org\/10.1145\/3360560","relation":{},"ISSN":["2475-1421"],"issn-type":[{"value":"2475-1421","type":"electronic"}],"subject":[],"published":{"date-parts":[[2019,10,10]]},"assertion":[{"value":"2019-10-10","order":2,"name":"published","label":"Published","group":{"name":"publication_history","label":"Publication History"}}]}}