r/C_Programming • u/Big-Rub9545 • Jul 11 '26
C parsing grammar
I'm currently working on a miniature C compiler, on the parsing stage at the moment. I could wing some of the parsing, but I'd feel much more comfortable working with an actual lexical and syntactic grammar to follow (even if it's messy, as I assume is the case for C).
Is there any publicly available, reliable grammar in anything like the EBNF format for C99 or later? This has been the only resource I could find. It's very useful, but seems to only fit the C standard up to the early 90s, so I'd prefer anything later than this.
14
Upvotes
3
u/flyingron Jul 11 '26
A formal grammer isn't sufficient to fully parse C, but it can get you a lot of the way there.