Where can I get a BNF or YACC grammar for C?
The definitive grammar is of course the one in the ANSI standard; see question 11.2. Another grammar by Jim Roskind is available at ftp.eskimo.com in u/s/scs/roskind_grammar.Z. A fleshed-out, working instance of the ANSI C90 grammar (due to Jeff Lee) is on ftp.uu.net (see question 18.16) in usenet/net.sources/ansi.c.grammar.Z (including a companion lexer). [footnote] The FSF’s GNU C compiler contains a grammar, as does the appendix to K&R2. The comp.compilers archives contain more information about grammars; see question 18.3. References: K&R1 Sec. A18 pp. 214-219 K&R2 Sec. A13 pp. 234-239 ISO Sec. B.2 H&S pp. 423-435 Appendix B comp.lang.c FAQ list ยท Question 18.15b Q: Does anyone have a C compiler test suite I can use? A: Plum Hall (formerly in Cardiff, NJ; now in Hawaii) sells one; other packages are Ronald Guilmette’s RoadTest(tm) Compiler Test Suites (ftp to netcom.com, pub/rfg/roadtest/announce.txt for information) and Nullstone’s Automated Compiler Performance Analysis Tool (see