[antlr-interest] bug in GnuCParser.g - missing declarations and statements

Sam Barnett-Cormack s.barnett-cormack at lancaster.ac.uk
Fri Apr 10 09:37:00 PDT 2009


Andy Tripp wrote:
> FWIW, I found and fixed a problem in the "cgram" grammar
> GnuCParser.g and StdCParser.g.  They didn't recognize 
> declarations coming after statements in a compoundStatement, like this:
> 
> f() {
>   printf("hello");
>   int i;
> }
> 
> This is allowed in the C99 standard, section 6.8.2, and
> by the GCC manual section 5.26 "Mixed Declarations and Code".

And explicitly not allowed by earlier "standard" (eg ISO, K&R) C 
standards... do we document what standard StdCPardser is meant to target?

-- 
Sam Barnett-Cormack


More information about the antlr-interest mailing list