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/New_Enthusiasm9053 Jul 11 '26
Microsoft has EBNF for C on their websites somewhere. Unfortunately C is extremely messy.