{"status":"ok","message-type":"work","message-version":"1.0.0","message":{"indexed":{"date-parts":[[2026,3,6]],"date-time":"2026-03-06T16:56:05Z","timestamp":1772816165908,"version":"3.50.1"},"reference-count":34,"publisher":"Association for Computing Machinery (ACM)","issue":"4","license":[{"start":{"date-parts":[[2017,9,18]],"date-time":"2017-09-18T00:00:00Z","timestamp":1505692800000},"content-version":"vor","delay-in-days":0,"URL":"https:\/\/www.acm.org\/publications\/policies\/copyright_policy#Background"}],"funder":[{"DOI":"10.13039\/501100001665","name":"Agence Nationale de la Recherche","doi-asserted-by":"crossref","award":["ANR-11-INSE-003"],"award-info":[{"award-number":["ANR-11-INSE-003"]}],"id":[{"id":"10.13039\/501100001665","id-type":"DOI","asserted-by":"crossref"}]}],"content-domain":{"domain":["dl.acm.org"],"crossmark-restriction":true},"short-container-title":["ACM Trans. Program. Lang. Syst."],"published-print":{"date-parts":[[2017,12,31]]},"abstract":"<jats:p>The syntax of the C programming language is described in the C11 standard by an ambiguous context-free grammar, accompanied with English prose that describes the concept of \u201cscope\u201d and indicates how certain ambiguous code fragments should be interpreted. Based on these elements, the problem of implementing a compliant C11 parser is not entirely trivial. We review the main sources of difficulty and describe a relatively simple solution to the problem. Our solution employs the well-known technique of combining an LALR(1) parser with a \u201clexical feedback\u201d mechanism. It draws on folklore knowledge and adds several original aspects, including a twist on lexical feedback that allows a smooth interaction with lookahead; a simplified and powerful treatment of scopes; and a few amendments in the grammar. Although not formally verified, our parser avoids several pitfalls that other implementations have fallen prey to. We believe that its simplicity, its mostly declarative nature, and its high similarity with the C11 grammar are strong informal arguments in favor of its correctness. Our parser is accompanied with a small suite of \u201ctricky\u201d C11 programs. We hope that it may serve as a reference or a starting point in the implementation of compilers and analysis tools.<\/jats:p>","DOI":"10.1145\/3064848","type":"journal-article","created":{"date-parts":[[2017,9,18]],"date-time":"2017-09-18T12:20:54Z","timestamp":1505737254000},"page":"1-36","update-policy":"https:\/\/doi.org\/10.1145\/crossmark-policy","source":"Crossref","is-referenced-by-count":6,"title":["A Simple, Possibly Correct LR Parser for C11"],"prefix":"10.1145","volume":"39","author":[{"given":"Jacques-Henri","family":"Jourdan","sequence":"first","affiliation":[{"name":"Inria Paris, MPI-SWS, Saarbr\u00fccken, Germany"}],"role":[{"role":"author","vocabulary":"crossref"}]},{"given":"Fran\u00e7ois","family":"Pottier","sequence":"additional","affiliation":[{"name":"Inria Paris, Paris Cedex, France"}],"role":[{"role":"author","vocabulary":"crossref"}]}],"member":"320","published-online":{"date-parts":[[2017,9,18]]},"reference":[{"key":"e_1_2_1_1_1","unstructured":"1992. Lookahead vs. Scanner Feedback. Retrieved from https:\/\/groups.google.com\/forum\/#&excl;topic\/comp.compilers\/gqeQy3mXqnA."},{"key":"e_1_2_1_2_1","doi-asserted-by":"publisher","DOI":"10.5555\/6448"},{"key":"e_1_2_1_3_1","unstructured":"ANSI. 1989. ANSI X3.159-1989 Programming Language C. (1989)."},{"key":"e_1_2_1_4_1","doi-asserted-by":"publisher","DOI":"10.5555\/998675.999466"},{"key":"e_1_2_1_5_1","unstructured":"Eli Bendersky. 2012. How Clang handles the type \/ variable name ambiguity of C\/C++. Retrieved from http:\/\/eli.thegreenplace.net\/2012\/07\/05\/how-clang-handles-the-type-variable-name-ambiguity-of-cc\/."},{"key":"e_1_2_1_6_1","volume-title":"Lex 8 Yacc","author":"Brown Doug","unstructured":"Doug Brown, John Levine, and Tony Mason. 1992. Lex 8 Yacc (2nd ed.). O\u2019Reilly Media.","edition":"2"},{"key":"e_1_2_1_7_1","unstructured":"Jutta Degener. 2012. C11 Yacc grammar. Retrieved from http:\/\/www.quut.com\/c\/ANSI-C-grammar-y.html."},{"key":"e_1_2_1_8_1","unstructured":"Chris Dodd and Vadim Maslov. 1999. BtYacc. Retrieved from http:\/\/www.siber.com\/btyacc\/."},{"key":"e_1_2_1_9_1","unstructured":"Charles Donnelly and Richard Stallman. 2015. Bison. Retrieved from http:\/\/www.gnu.org\/software\/bison\/manual\/."},{"key":"e_1_2_1_10_1","doi-asserted-by":"publisher","DOI":"10.1145\/2254064.2254103"},{"key":"e_1_2_1_11_1","doi-asserted-by":"publisher","DOI":"10.1145\/1133981.1133987"},{"key":"e_1_2_1_12_1","doi-asserted-by":"publisher","DOI":"10.5555\/1951778"},{"key":"e_1_2_1_13_1","unstructured":"ISO. 2011. ISO\/IEC 9899:2011 -- Programming languages -- C. Retrived from http:\/\/www.open-std.org\/jtc1\/sc22\/wg14\/www\/docs\/n1570.pdf."},{"key":"e_1_2_1_14_1","doi-asserted-by":"publisher","DOI":"10.1145\/937563.937566"},{"key":"e_1_2_1_15_1","unstructured":"Jacques-Henri Jourdan. 2015. GCC bug #67784: Incorrect parsing when using declarations in for loops and typedefs. Retrieved from https:\/\/gcc.gnu.org\/bugzilla\/show_bug.cgi?id&equals;67784"},{"key":"e_1_2_1_16_1","doi-asserted-by":"crossref","unstructured":"Jacques-Henri Jourdan and Fran\u00e7ois Pottier. 2017. A simple possibly correct LR parser for C11\u2014Implementation and test suite. Retrieved from https:\/\/github.com\/jhjourdan\/C11parser.","DOI":"10.1145\/3064848"},{"key":"e_1_2_1_17_1","doi-asserted-by":"publisher","DOI":"10.1007\/978-3-642-28869-2_20"},{"key":"e_1_2_1_18_1","doi-asserted-by":"publisher","DOI":"10.5555\/100511"},{"key":"e_1_2_1_19_1","doi-asserted-by":"publisher","DOI":"10.1016\/S0019-9958(65)90426-2"},{"key":"e_1_2_1_20_1","doi-asserted-by":"publisher","DOI":"10.1145\/1538788.1538814"},{"key":"e_1_2_1_21_1","unstructured":"Xavier Leroy. 2017. The CompCert C verified compiler. Retrieved from https:\/\/github.com\/AbsInt\/CompCert."},{"key":"e_1_2_1_22_1","volume-title":"Necula","author":"McPeak Scott","year":"2004","unstructured":"Scott McPeak and George C. Necula. 2004. Elkhound: A fast, practical GLR parser generator. In Proceedings of the International Conference on Compiler Construction (CC\u201904). Lecture Notes in Computer Science, Vol. 2985. Springer, 73--88."},{"key":"e_1_2_1_23_1","unstructured":"Yaron Minsky Anil Madhavapeddy and Jason Hickey. 2013. Real World OCaml: Functional Programming for the Masses. O\u2019Reilly."},{"key":"e_1_2_1_24_1","doi-asserted-by":"publisher","DOI":"10.1007\/978-3-642-00722-4_9"},{"key":"e_1_2_1_25_1","doi-asserted-by":"publisher","DOI":"10.1145\/1352592.1352618"},{"key":"e_1_2_1_26_1","doi-asserted-by":"publisher","DOI":"10.1007\/BF00290336"},{"key":"e_1_2_1_27_1","doi-asserted-by":"publisher","DOI":"10.1145\/2892208.2892224"},{"key":"e_1_2_1_28_1","unstructured":"Fran\u00e7ois Pottier and Yann R\u00e9gis-Gianas. 2016. The Menhir parser generator. Retrieved from http:\/\/gallium.inria.fr\/&sim;fpottier\/menhir\/."},{"key":"e_1_2_1_29_1","doi-asserted-by":"publisher","DOI":"10.1145\/154766.155580"},{"key":"e_1_2_1_30_1","unstructured":"Jim Roskind. 1990. A grammar for ANSI C. Retrieved from http:\/\/www.ccs.neu.edu\/research\/demeter\/tools\/master\/doc\/headers\/C++Grammar\/."},{"key":"e_1_2_1_31_1","unstructured":"Daniele Paolo Scarpazza. 2007. Practical parsing for ANSI C. Dr. Dobb\u2019s 392 (Jan.2007) 48--55."},{"key":"e_1_2_1_32_1","unstructured":"The GNU project. 2004. GCC 3.4.4 gcc\/c-parse.in. Retrieved from https:\/\/github.com\/gcc-mirror\/gcc\/blob\/8e095405a5fe8adf3f01361c05e7010a9b94e8cc\/gcc\/c-parse.in."},{"key":"e_1_2_1_33_1","doi-asserted-by":"publisher","DOI":"10.1145\/1188966.1188972"},{"key":"e_1_2_1_34_1","doi-asserted-by":"publisher","DOI":"10.1145\/1289971.1289983"}],"container-title":["ACM Transactions on Programming Languages and Systems"],"original-title":[],"language":"en","link":[{"URL":"https:\/\/dl.acm.org\/doi\/10.1145\/3064848","content-type":"unspecified","content-version":"vor","intended-application":"text-mining"},{"URL":"https:\/\/dl.acm.org\/doi\/pdf\/10.1145\/3064848","content-type":"unspecified","content-version":"vor","intended-application":"similarity-checking"}],"deposited":{"date-parts":[[2025,6,18]],"date-time":"2025-06-18T03:36:41Z","timestamp":1750217801000},"score":1,"resource":{"primary":{"URL":"https:\/\/dl.acm.org\/doi\/10.1145\/3064848"}},"subtitle":[],"short-title":[],"issued":{"date-parts":[[2017,9,18]]},"references-count":34,"journal-issue":{"issue":"4","published-print":{"date-parts":[[2017,12,31]]}},"alternative-id":["10.1145\/3064848"],"URL":"https:\/\/doi.org\/10.1145\/3064848","relation":{},"ISSN":["0164-0925","1558-4593"],"issn-type":[{"value":"0164-0925","type":"print"},{"value":"1558-4593","type":"electronic"}],"subject":[],"published":{"date-parts":[[2017,9,18]]},"assertion":[{"value":"2016-07-01","order":0,"name":"received","label":"Received","group":{"name":"publication_history","label":"Publication History"}},{"value":"2017-03-01","order":1,"name":"accepted","label":"Accepted","group":{"name":"publication_history","label":"Publication History"}},{"value":"2017-09-18","order":2,"name":"published","label":"Published","group":{"name":"publication_history","label":"Publication History"}}]}}