need lex/yacc grammar for c

Tim Singletary tsingle at sunland.sunland.gsfc.nasa.gov
Fri Jul 13 00:35:20 AEST 1990


We need to do various transformations on C programs, one of the more
interesting of which is to transform stuff like:

	struct {
	    unsigned int a: 3;
	    unsigned int b: 4;
	    unsigned int c: 1;
	} bitfields;

into

	struct {
	    unsigned int c: 1;
	    unsigned int b: 4;
	    unsigned int a: 3;
	} bitfields;

Sed and lex are powerful enough to do most of our transformations, but
stuff like the above will (I think) require yacc.

Does anyone have a lex/yacc grammar which recognizes C (or at least a
substantial subset of C), and if you do, would you mind mailing it to
me?

Thanks,

tim
--
Tim Singletary, August Automation Inc., (301) 286-7942
--
NRA extremist, etc.



More information about the Comp.lang.c mailing list