{"status":"ok","message-type":"work","message-version":"1.0.0","message":{"indexed":{"date-parts":[[2026,10,6]],"date-time":"2026-10-06T15:13:45Z","timestamp":1791299625741,"version":"4.1.0"},"reference-count":37,"publisher":"Association for Computing Machinery (ACM)","issue":"OOPSLA1","license":[{"start":{"date-parts":[[2026,4,10]],"date-time":"2026-04-10T00:00:00Z","timestamp":1775779200000},"content-version":"vor","delay-in-days":0,"URL":"https:\/\/creativecommons.org\/licenses\/by\/4.0\/legalcode"}],"content-domain":{"domain":["dl.acm.org"],"crossmark-restriction":true},"short-container-title":["Proc. ACM Program. Lang."],"published-print":{"date-parts":[[2026,4,10]]},"abstract":"<jats:p>\n                    Context-free grammars (CFGs) are the de-facto formalism for declaratively describing concrete syntax for programming languages and generating parsers. One of the major challenges in defining a desired syntax is ruling out all possible ambiguities in the CFG productions that determine scoping rules as well as operator precedence and associativity. Practical tools for parser generation typically apply ad-hoc approaches for resolving such ambiguities, which might result in a parser\u2019s behaviour that contradicts the intents of the language designer. In this work, we present a user-friendly approach to soundly\n                    <jats:italic toggle=\"yes\">repair<\/jats:italic>\n                    grammars with ambiguities, which is inspired by the\n                    <jats:italic toggle=\"yes\">programming by example<\/jats:italic>\n                    line of research in automated program synthesis. At the heart of our approach is the interpretation of both the initial CFG and additional examples that define the desired restrictions in precedence and associativity, as\n                    <jats:italic toggle=\"yes\">tree automata<\/jats:italic>\n                    (TAs). The technical novelties of our approach are (1) a new TA learning algorithm that constructs an automaton based on the original grammar and examples that encode the user\u2019s preferred ways of resolving ambiguities all in a single TA, and (2) an efficient algorithm for TA intersection that utilises reachability analysis and optimizations that significantly reduce the size of the resulting automaton, which results in idiomatic CFGs amenable to parser generators. We have proven the soundness of the algorithms, and implemented our approach in a tool called Greta, demonstrating its effectiveness on a series of case studies.\n                  <\/jats:p>","DOI":"10.1145\/3798242","type":"journal-article","created":{"date-parts":[[2026,4,10]],"date-time":"2026-04-10T14:33:43Z","timestamp":1775831623000},"page":"1153-1179","update-policy":"https:\/\/doi.org\/10.1145\/crossmark-policy","source":"Crossref","is-referenced-by-count":1,"title":["Grammar Repair with Examples and Tree Automata"],"prefix":"10.1145","volume":"10","author":[{"ORCID":"https:\/\/orcid.org\/0000-0002-3803-9782","authenticated-orcid":false,"given":"Yunjeong","family":"Lee","sequence":"first","affiliation":[{"name":"National University of Singapore, Singapore, Singapore"}],"role":[{"vocabulary":"crossref","role":"author"}]},{"ORCID":"https:\/\/orcid.org\/0009-0003-6074-1847","authenticated-orcid":false,"given":"Gokul","family":"Rajiv","sequence":"additional","affiliation":[{"name":"National University of Singapore, Singapore, Singapore"}],"role":[{"vocabulary":"crossref","role":"author"}]},{"ORCID":"https:\/\/orcid.org\/0000-0003-4250-5392","authenticated-orcid":false,"given":"Ilya","family":"Sergey","sequence":"additional","affiliation":[{"name":"National University of Singapore, Singapore, Singapore"}],"role":[{"vocabulary":"crossref","role":"author"}]}],"member":"320","published-online":{"date-parts":[[2026,4,10]]},"reference":[{"key":"e_1_3_1_2_2","doi-asserted-by":"publisher","DOI":"10.1145\/365813.365821"},{"key":"e_1_3_1_3_2","doi-asserted-by":"publisher","DOI":"10.1145\/3133906"},{"key":"e_1_3_1_4_2","doi-asserted-by":"publisher","DOI":"10.1145\/512927.512928"},{"key":"e_1_3_1_5_2","doi-asserted-by":"publisher","DOI":"10.1016\/S0019-9958(81)90090-5"},{"key":"e_1_3_1_6_2","doi-asserted-by":"publisher","DOI":"10.1016\/0890-5401(87)90052-6"},{"key":"e_1_3_1_7_2","doi-asserted-by":"publisher","DOI":"10.1145\/3062341.3062349"},{"key":"e_1_3_1_8_2","doi-asserted-by":"publisher","DOI":"10.1016\/J.TCS.2007.03.038"},{"key":"e_1_3_1_9_2","doi-asserted-by":"publisher","DOI":"10.1145\/3663529.3663790"},{"key":"e_1_3_1_10_2","doi-asserted-by":"publisher","unstructured":"John Boyland and Daniel Spiewak. 2009. TOOL PAPER: ScalaBison Recursive Ascent-Descent Parser Generator. 253 7 (2009) 65\u201374. doi:10.1016\/J.ENTCS.2010.08.032","DOI":"10.1016\/J.ENTCS.2010.08.032"},{"key":"e_1_3_1_11_2","unstructured":"Hubert Comon Max Dauchet R\u00e9mi Gilleron Florent Jacquemard Denis Lugiez Christof L\u00f6ding Sophie Tison and Marc Tommasi. 2008. Tree Automata Techniques and Applications. https:\/\/inria.hal.science\/hal-03367725v1\/file\/tata.pdf."},{"key":"e_1_3_1_12_2","doi-asserted-by":"publisher","DOI":"10.22152\/programmingjournal.org\/2018\/2\/13"},{"key":"e_1_3_1_13_2","unstructured":"Alexander Demenchuk. 2008. Beaver - a LALR Parser Generator. https:\/\/beaver.sourceforge.net\/."},{"key":"e_1_3_1_14_2","unstructured":"Joost Engelfriet. 2015. Tree Automata and Tree Grammars. CoRR abs\/1510.02036 (2015). arXiv:1510.02036 http:\/\/arxiv.org\/abs\/1510.02036"},{"key":"e_1_3_1_15_2","doi-asserted-by":"publisher","DOI":"10.1145\/3368089.3409679"},{"key":"e_1_3_1_16_2","doi-asserted-by":"publisher","DOI":"10.1145\/1926385.1926423"},{"key":"e_1_3_1_17_2","volume-title":"Yacc: Yet another compiler-compiler","author":"Johnson Stephen C","year":"1975","unstructured":"Stephen C Johnson et al. 1975. Yacc: Yet another compiler-compiler. Vol. 32. Bell Laboratories Murray Hill, NJ."},{"key":"e_1_3_1_18_2","first-page":"1","volume-title":"Proc. ASMICS Workshop on Parsing Theory","author":"Klint Paul","year":"1994","unstructured":"Paul Klint and Eelco Visser. 1994. Using filters for the disambiguation of context-free grammars. In Proc. ASMICS Workshop on Parsing Theory. Milan, Italy, 1\u201320."},{"key":"e_1_3_1_19_2","doi-asserted-by":"publisher","DOI":"10.1145\/2594291.2594333"},{"key":"e_1_3_1_20_2","doi-asserted-by":"publisher","DOI":"10.1145\/3106237.3106309"},{"key":"e_1_3_1_21_2","unstructured":"Yunjeong Lee Gokul Rajiv and Ilya Sergey. 2026. Grammar Repair using Examples and Tree Automata: Extended Version. CoRR abs\/2602.18166 (2026). http:\/\/arxiv.org\/abs\/2602.18166"},{"key":"e_1_3_1_22_2","doi-asserted-by":"publisher","unstructured":"Yunjeong Lee Gokul Rajiv and Ilya Sergey. 2026. Greta: Grammar Repair using Examples and Tree Automata (Artefact). doi:10.5281\/zenodo.18654374 Working repository available at https:\/\/github.com\/verse-lab\/greta.","DOI":"10.5281\/zenodo.18654374"},{"key":"e_1_3_1_23_2","doi-asserted-by":"publisher","DOI":"10.1145\/2737924.2738002"},{"key":"e_1_3_1_24_2","volume-title":"Exploring expect - a Tcl-based toolkit for automating interactive programs (2. ed.)","author":"Libes Don","year":"1995","unstructured":"Don Libes. 1995. Exploring expect - a Tcl-based toolkit for automating interactive programs (2. ed.). O\u2019Reilly."},{"key":"e_1_3_1_25_2","doi-asserted-by":"publisher","DOI":"10.1145\/3341105.3374123"},{"key":"e_1_3_1_26_2","doi-asserted-by":"publisher","DOI":"10.1017\/9781009129220.023"},{"key":"e_1_3_1_27_2","unstructured":"Emmanuel Onzon. 2012. dypgen: User\u2019s Manual. http:\/\/dypgen.free.fr\/."},{"key":"e_1_3_1_28_2","doi-asserted-by":"publisher","DOI":"10.1145\/3180155.3180189"},{"key":"e_1_3_1_29_2","unstructured":"Christophe Raffalli and Rodolphe Lepigre. 2020. earley: Parsing library based on Earley Algorithm. https:\/\/opamo.caml.org\/packages\/earley\/."},{"key":"e_1_3_1_30_2","doi-asserted-by":"publisher","DOI":"10.1145\/3486608.3486910"},{"key":"e_1_3_1_31_2","unstructured":"Yann R\u00e9gis-Gianas and Fran\u00e7ois Pottier. 2016. Menhir Reference Manual. https:\/\/gallium.inria.fr\/~fpottier\/menhir\/."},{"key":"e_1_3_1_32_2","doi-asserted-by":"publisher","DOI":"10.1016\/J.CL.2017.11.003"},{"key":"e_1_3_1_33_2","doi-asserted-by":"publisher","DOI":"10.1007\/3-540-45937-5_12"},{"key":"e_1_3_1_34_2","unstructured":"Eelco Visser. 1997. A Case Study in Optimizing Parsing Schemata by Disambiguation Filters. In International Workshop on Parsing Technologies IWPT Sandiway Fong (Ed.). 210\u2013224. https:\/\/aclanthology.org\/1997.iwpt-1.24\/"},{"key":"e_1_3_1_35_2","doi-asserted-by":"publisher","DOI":"10.1145\/3062341.3062365"},{"key":"e_1_3_1_36_2","doi-asserted-by":"publisher","DOI":"10.1145\/3133886"},{"key":"e_1_3_1_37_2","doi-asserted-by":"publisher","DOI":"10.1007\/BF00268139"},{"key":"e_1_3_1_38_2","doi-asserted-by":"publisher","DOI":"10.1145\/2736277.2741659"}],"container-title":["Proceedings of the ACM on Programming Languages"],"original-title":[],"language":"en","link":[{"URL":"https:\/\/dl.acm.org\/doi\/pdf\/10.1145\/3798242","content-type":"unspecified","content-version":"vor","intended-application":"similarity-checking"}],"deposited":{"date-parts":[[2026,9,26]],"date-time":"2026-09-26T11:16:55Z","timestamp":1790421415000},"score":1,"resource":{"primary":{"URL":"https:\/\/dl.acm.org\/doi\/10.1145\/3798242"}},"subtitle":[],"short-title":[],"issued":{"date-parts":[[2026,4,10]]},"references-count":37,"journal-issue":{"issue":"OOPSLA1","published-print":{"date-parts":[[2026,4,10]]}},"alternative-id":["10.1145\/3798242"],"URL":"https:\/\/doi.org\/10.1145\/3798242","relation":{},"ISSN":["2475-1421"],"issn-type":[{"value":"2475-1421","type":"electronic"}],"subject":[],"published":{"date-parts":[[2026,4,10]]},"assertion":[{"value":"2025-10-10","order":0,"name":"received","label":"Received","group":{"name":"publication_history","label":"Publication History"}},{"value":"2026-02-17","order":2,"name":"accepted","label":"Accepted","group":{"name":"publication_history","label":"Publication History"}},{"value":"2026-04-10","order":3,"name":"published","label":"Published","group":{"name":"publication_history","label":"Publication History"}}]}}