Re: A Readable C Code without #DEFINEs ...



Bahram wrote:
Folks,

I am using LEX and YACC and they produce this grossly unreadable C code
that is infested with #define this and #define that.

The code is unreadable and I need to make changes to it for the
particular project I am working on.

You do not ever modify the code produced by lex or yacc. Each of these languages has a system defined to allow you to insert appropriate code as necessary.


If for some reason, you feel the need to actually modify the lex or yacc code, stop immediately. Go back to your design and fix the problems in your design that prevent you from using these tools correctly.

If for some unknowable reason, you feel the need to still modify the inner workings of these tools, again stop immediately. Go back to your design and change it so that it includes the steps necessary for you to design and build tools that allow you to accomplish your goals. If your design calls for using lex and yacc, use them as tools and ignore the C code they generate. Concentrate on making the code you insert work correctly. Do not ever try to modify the code produced by lex or yacc.

/Joe


Is there a switch is C, or, if you know about a hidden switch in either
lex or yacc, that would produce a final human readable code that I can
make sense out of, PLEASE.

Cheers,
Bahram Saghari
bsaghari@xxxxxxxxxxx
--
comp.lang.c.moderated - moderation address: clcm@xxxxxxxxxxxx -- you must
have an appropriate newsgroups line in your header for your mail to be seen,
or the newsgroup name in square brackets in the subject line.  Sorry.
.



Relevant Pages

  • Re: Redirect stdin ?
    ... get a workaround (as of I wouldn't be aware of Lex & Yacc a bit) ... generated code from lex and yacc". ... One interpretation is that you do not want to hand-modify the C code ... yacc would generate would take the supplied input routine into account. ...
    (comp.lang.c)
  • Re: A Readable C Code without #DEFINEs ...
    ... > I am using LEX and YACC and they produce this grossly unreadable C code ... Hopefully the input files are readable, ... > Is there a switch is C, or, if you know about a hidden switch in either ...
    (comp.lang.c.moderated)
  • Re: How is a compiler written
    ... >> The Dragon Book is a good one suggestion, ... >> best way to write a compiler is with lex and yacc is not. ...
    (comp.lang.c)
  • Re: A Readable C Code without #DEFINEs ...
    ... either Lex or Yacc. ... Or, yet again, you can obtain the source for various open source ... have an appropriate newsgroups line in your header for your mail to be seen, ...
    (comp.lang.c.moderated)
  • Re: Supergirl #3 (spoilers)
    ... >> the design at all, but to the awful way it's portrayed (that ... the revealed result of Black Kryptonite may also be a reference to ... > And Lex doesn't even think they're impressive... ...
    (rec.arts.comics.dc.universe)