c parser wanted
Dan DeVries
ddv at Solbourne.COM
Thu Apr 27 11:47:25 AEST 1989
In article <7974 at june.cs.washington.edu> franz at cs.washington.edu (Franz G. Amador) writes:
>Does anyone have or know of source for a parser/pretty-printer for c
>that reads in the c and just spits it back out? I'd much prefer that
>it be based upon a nice yacc grammar than it be hand-coded, which is
>why I'd rather not use the source for Unix's indent command.
>
To write a pretty printer that completely syntax checks C is horribly
wasteful. Only certain constructs cause indentation and that is all thea
a pretty printer should recognize. This is important because a pretty printer
is an excellent debug tool when the C parser doesn't help. (i.e. where did
I leave out that } ). The last pretty printer I wrote took 4 hours and
only recognized { } for while if repeat and a few others.
Forget Yacc. The source for yacc would be MUCH more complicated than a
simple scanner required for prettyPrint.
(I know, flame away. I just think that Yacc has it's place and its not
for every job)
More information about the Comp.lang.c
mailing list