Subj : Re: How can I get rid of #define in my generated C code ...? To : comp.programming From : Alex Fraser Date : Mon Oct 10 2005 02:23 am "Bahram" wrote in message news:1128902459.459289.314210@z14g2000cwz.googlegroups.com... > I am using lex and yacc for a project I am working on, wondering if > there is any switch I can specify ANYWHERE, including the C compiler, > that would take the .c files that these utilities generate, and get rid > of all the #defines in the generated code. > (when I say get rid of, I don't mean to simply delete, I mean to > recognize: Oh yes, this is defined and here is what I want to do.) Some compilers provide such an option, eg gcc -E. This doesn't just get rid of #defines though, it fully preprocesses the code. > The y.tab.c and lex.yy.c files that these utilities produce are > infested with #define, a lot conditional, making them impossible to > read, and modify (e.g. yes, I need to make some changes to them) I think you are asking the wrong question. You should be asking how to fix the (unspecified) problem with the parser, not how to implement your proposed fix. Modifying generated code - at least by hand - is a Really Bad Idea IMO. Alex .