{"status":"ok","message-type":"work","message-version":"1.0.0","message":{"indexed":{"date-parts":[[2026,5,26]],"date-time":"2026-05-26T23:05:46Z","timestamp":1779836746553,"version":"3.53.1"},"reference-count":39,"publisher":"Cambridge University Press (CUP)","issue":"6","license":[{"start":{"date-parts":[[2012,7,10]],"date-time":"2012-07-10T00:00:00Z","timestamp":1341878400000},"content-version":"unspecified","delay-in-days":0,"URL":"https:\/\/www.cambridge.org\/core\/terms"}],"content-domain":{"domain":[],"crossmark-restriction":false},"short-container-title":["J. Funct. Prog."],"published-print":{"date-parts":[[2012,11]]},"abstract":"<jats:title>Abstract<\/jats:title>\n                  <jats:p>\n                    We define a finally tagless, shallow embedding of a typed grammar language. In order to avoid the limitations of traditional parser combinator libraries (no bottom-up parsing, no full grammar analysis or transformation), we require object-language recursion to be observable in the meta-language. Since existing proposals for recursive constructs are not fully satisfactory, we propose new finally tagless primitive recursive constructs to solve the problem. To do this in a well-typed way, we require considerable infrastructure, for which we reuse techniques from the multirec generic programming library. Our infrastructure allows a precise model of the complex interaction between a grammar, a parsing algorithm and a set of semantic actions. On the flip side, our approach requires the grammar author to provide a type- and value-level encoding of the grammar's domain and we can provide only a limited form of constructs like\n                    <jats:italic>many<\/jats:italic>\n                    . We demonstrate five meta-language grammar algorithms exploiting our model, including a grammar pretty-printer, a reachability analysis, a translation of quantified recursive constructs to the standard one and an implementation of the left-corner grammar transform. The work we present forms the basis of the\n                    <jats:monospace>grammar-combinators<\/jats:monospace>\n                    parsing library\n                    <jats:sup>1<\/jats:sup>\n                    , which is the first to work with a precise, shallow model of abstract context-free grammars in a classical (not dependently typed) functional language and which supports a wide range of grammar manipulation primitives. From a more general point of view, our work shows a solution to the well-studied problem of observable sharing in shallowly embedded domain-specific languages and specifically in finally tagless domain-specific languages.\n                  <\/jats:p>","DOI":"10.1017\/s0956796812000226","type":"journal-article","created":{"date-parts":[[2012,7,10]],"date-time":"2012-07-10T07:46:24Z","timestamp":1341906384000},"page":"757-796","source":"Crossref","is-referenced-by-count":10,"title":["Finally tagless observable recursion for an abstract grammar model"],"prefix":"10.1017","volume":"22","author":[{"given":"DOMINIQUE","family":"DEVRIESE","sequence":"first","affiliation":[],"role":[{"vocabulary":"crossref","role":"author"}]},{"given":"FRANK","family":"PIESSENS","sequence":"additional","affiliation":[],"role":[{"vocabulary":"crossref","role":"author"}]}],"member":"56","published-online":{"date-parts":[[2012,7,10]]},"reference":[{"key":"S0956796812000226_ref39","volume-title":"Proceedings of the HASKELL 2008","author":"Viera","year":"2008"},{"key":"S0956796812000226_ref19","volume-title":"Proceedings of the PEPM","author":"Magalh\u00e3es","year":"2010"},{"key":"S0956796812000226_ref35","first-page":"1","volume-title":"Proceedings of the 2002 ACM SIGPLAN workshop on Haskell","author":"Sheard","year":"2002"},{"key":"S0956796812000226_ref15","doi-asserted-by":"publisher","DOI":"10.1007\/978-0-387-68954-8"},{"key":"S0956796812000226_ref4","doi-asserted-by":"publisher","DOI":"10.1006\/inco.1998.2772"},{"key":"S0956796812000226_ref23","volume-title":"Proceedings of the NAACL","author":"Moore","year":"2000"},{"key":"S0956796812000226_ref28","volume-title":"Proceedings of the ICFP","author":"Peyton Jones","year":"2006"},{"key":"S0956796812000226_ref22","volume-title":"Proceedings of the ICFP","author":"Might","year":"2011"},{"key":"S0956796812000226_ref8","volume-title":"Proceedings of the 15th ICFP","author":"Danielsson","year":"2010"},{"key":"S0956796812000226_ref25","doi-asserted-by":"publisher","DOI":"10.1007\/BFb0017309"},{"key":"S0956796812000226_ref2","volume-title":"Proceedings of the 2004 HASKELL Workshop","author":"Baars","year":"2004"},{"key":"S0956796812000226_ref1","volume-title":"Compilers: Principles, Techniques and Tools","author":"Aho","year":"2006"},{"key":"S0956796812000226_ref38","volume-title":"Proceedings of the AFP","author":"Swierstra","year":"1996"},{"key":"S0956796812000226_ref3","doi-asserted-by":"crossref","first-page":"15","DOI":"10.1145\/1481861.1481865","volume-title":"Proceedings of the TLDI'09","author":"Baars","year":"2009"},{"key":"S0956796812000226_ref33","volume-title":"Proceedings of the 13th ICFP","author":"Schrijvers","year":"2008"},{"key":"S0956796812000226_ref29","volume-title":"Types and Programming Languages","author":"Pierce","year":"2002"},{"key":"S0956796812000226_ref36","doi-asserted-by":"publisher","DOI":"10.1017\/S0956796808006758"},{"key":"S0956796812000226_ref14","doi-asserted-by":"publisher","DOI":"10.1145\/1596638.1596653"},{"key":"S0956796812000226_ref31","doi-asserted-by":"publisher","DOI":"10.1109\/SWAT.1970.5"},{"key":"S0956796812000226_ref18","volume-title":"Parsec: Direct Style Monadic Parser Combinators for the Real World","author":"Leijen","year":"2001"},{"key":"S0956796812000226_ref9","unstructured":"Devriese D. & Piessens F. (2010) Explicitly Recursive Grammar Combinators \u2013 Implemention of Some Grammar Algorithms. Tech. Rep. CW594, KU Leuven, CS. Available at: http:\/\/www.cs.kuleuven.be\/publicaties\/rapporten\/cw\/CW594.abs.html."},{"key":"S0956796812000226_ref27","first-page":"240","volume-title":"Proceedings of the ICFP","author":"Paterson","year":"2001"},{"key":"S0956796812000226_ref7","volume-title":"Proceedings of the ASIAN'99","author":"Claessen","year":"1999"},{"key":"S0956796812000226_ref37","doi-asserted-by":"crossref","unstructured":"Swierstra D. (2009) Combinator Parsing: A Short Tutorial. Language Engineering and Rigorous Software Development, Piriapolis, Uruguay, Revised Tutorial Lectures, Lecture Notes in Computer Science, vol. 5520. New York: Springer-Verlag, pp. 252\u2013300.","DOI":"10.1007\/978-3-642-03153-3_6"},{"key":"S0956796812000226_ref11","volume-title":"2002 Haskell Workshop","author":"Erk\u00f6k","year":"2002"},{"key":"S0956796812000226_ref16","doi-asserted-by":"publisher","DOI":"10.1016\/S0167-6423(99)00023-4"},{"key":"S0956796812000226_ref26","doi-asserted-by":"publisher","DOI":"10.1002\/spe.4380250705"},{"key":"S0956796812000226_ref34","unstructured":"Sheard T. (December 2005) Another look at hardware design languages. Available at: http:\/\/www.cs.pdx.edu\/~sheard\/."},{"key":"S0956796812000226_ref10","volume-title":"Proceedings of the 13th PADL'11","author":"Devriese","year":"2011"},{"key":"S0956796812000226_ref12","volume-title":"Proceedings of the ICFP","author":"Ford","year":"2002"},{"key":"S0956796812000226_ref21","volume-title":"Proceedings of the FPLCA","author":"Meijer","year":"1991"},{"key":"S0956796812000226_ref13","volume-title":"Proceedings of the 10th PADL","author":"Frost","year":"2008"},{"key":"S0956796812000226_ref24","unstructured":"Norell U. (2007) Towards a Practical Programming Language Based on Dependent Type Theory. PhD thesis, Chalmers University of Technology, Sweden."},{"key":"S0956796812000226_ref32","doi-asserted-by":"publisher","DOI":"10.1017\/S0956796897002943"},{"key":"S0956796812000226_ref6","doi-asserted-by":"publisher","DOI":"10.1017\/S0956796809007205"},{"key":"S0956796812000226_ref5","volume-title":"Proceedings of the MPC","author":"Brink","year":"2010"},{"key":"S0956796812000226_ref17","volume-title":"Unix Programmer's Manual","author":"Johnson","year":"1979"},{"key":"S0956796812000226_ref20","doi-asserted-by":"publisher","DOI":"10.1017\/S0956796807006326"},{"key":"S0956796812000226_ref30","volume-title":"Proceedings of the 14th ICFP","author":"Rodriguez","year":"2009"}],"container-title":["Journal of Functional Programming"],"original-title":[],"language":"en","link":[{"URL":"https:\/\/www.cambridge.org\/core\/services\/aop-cambridge-core\/content\/view\/S0956796812000226","content-type":"unspecified","content-version":"vor","intended-application":"similarity-checking"}],"deposited":{"date-parts":[[2026,5,26]],"date-time":"2026-05-26T22:36:26Z","timestamp":1779834986000},"score":1,"resource":{"primary":{"URL":"https:\/\/www.cambridge.org\/core\/product\/identifier\/S0956796812000226\/type\/journal_article"}},"subtitle":[],"short-title":[],"issued":{"date-parts":[[2012,7,10]]},"references-count":39,"journal-issue":{"issue":"6","published-print":{"date-parts":[[2012,11]]}},"alternative-id":["S0956796812000226"],"URL":"https:\/\/doi.org\/10.1017\/s0956796812000226","relation":{},"ISSN":["0956-7968","1469-7653"],"issn-type":[{"value":"0956-7968","type":"print"},{"value":"1469-7653","type":"electronic"}],"subject":[],"published":{"date-parts":[[2012,7,10]]}}}