I’ve been trying to find a yacc-compatible grammar for C99. Incredibly, I can’t find one online. This best I could find was this, which is very close to what I need. The main problem that I’m running into is rules like the following:
postfix_expression : postfix_expression ‘(’ argument_expression_list? ‘)’ ;
My parser generator(it isn’t yacc, but it’s quite close) can’t handle the ? operator. I tried the following:
optional_argument_expression_list : argument_expression_list | ;
postfix_expression : postfix_expression ‘(’ optional_argument_expression_list ‘)’ ;
But that doesn’t seem to have worked – I get a whole bunch of warnings telling me that such-and-such a production is never reduced.
Can anyone either give me a hint on how to deal with this? Or, better yet, link me to a yacc grammar for C99? Even better, how about a grammar for gcc99(ie C99 + the gcc extensions).