[antlr-interest] standard C parser for C++

Jim Crafton jim.crafton at gmail.com
Mon Apr 4 08:17:12 PDT 2005

Does anyone know of a decent C grammar built using Antlr for C++? I
have tried, for most of the weekend, to fiddle around with the C
grammar in the /grammar/cgram/grammars/StdCParser.g, but have failed
to get it to work. It either spins in an infinite loop, or, if i take
out ALL the user functions, it ends up not being able to parse the

int foo( int v );

It will crap out with an error on the LPAREN. Has anyone else had any
success? Does it work well in it's native Java form?

I am asking because I would like to experiment with the following idea:

I would like to make a pre-proccessor, that takes a file written in a
strict C super set, and that adds the following features:
bounds checking on arrays
a UTF 16 string type with length
There's more to it than this, but this is the basic idea.

The processor would then spit out standard C, which could then be fed
to the C compiler of your choice.



More information about the antlr-interest mailing list