[gnu.gcc] Literate GCC

ara@LOM1.MATH.YALE.EDU (Allan Adler) (12/03/89)

I like the GCC documentation but I wish that the GCC source code itself
could be documented as thoroughly as TeX and METAFONT are. This is not
to say that they are not well documented. But the most thorough documentation
I have seen is in programs written in WEB, developed by Knuth in connection
with his concept of "Literate Programming". 

But how can this be done with GCC ? In order to use WEB, one would have to
write GCC in Pascal, which I think no one wants to do. On the other hand,
there is a program called CWEB which documents C programs the way that
WEB is used to document Pascal programs. Unfortunately, to the best of my
knowledge, CWEB is proprietary software and it would be contrary to the
principles and probably to the best interests of FSF to depend on it
for documentation. But there is no reason why FSF cannot develop its own
CWEB and use it to document the source code to GNU software.

The availability of a free CWEB would raise the level of documentation
of source code for all complex C programs. If it is desirable to have
source code available then it must also be desirable to enhance its
readability to the nonspecialist. So the value of such an undertaking
would go beyond its application to GNU software. And why shouldn't such
a tool be a part of the GNU operating system ?

I am unfortunately not competent to do it. But I wish somebody would.

Allan Adler
ara@lom1.math.yale.edu

tbrakitz@phoenix.Princeton.EDU (Byron Rakitzis) (12/03/89)

RE: CWEB. I know that a CWEB is available from the /pub/cweb directory
on princeton.princeton.edu. I'm not sure whether this program is in
the PD. In fact, I doubt it, since the header reads "Copyright
Princeton University". However, I'm also sure everyone is free to copy
it. For details, contact the author: levy@math.princeton.edu.

Regarding the program itself, I don't think it's as successful
processing C with WEB as it is for Pascal. For one, C has operators
like += and ^= and so on which don't really come across well with the
TeX math fonts. Perhaps a re-vamping of the way CWEB pretty-prints
things will change it. 

CWEB changes the way C programs look. Pascal is the kind of language
which one associates with textbooks, and left arrows for assignment
and so on, but I don't think it goes over well when you see

 source :       if (A == B && A != C)

 destination:   if( A\equiv B  \land A \not= C)

(I guess you have to know TeX to see why this transformation is
incongruous.) 

Oh well. Just some random late-night ramblings. Please excuse any
non-sequiturs. Good night.

-- 
"C Code."
	  "C Code run."
			"Run, Code, run!"
Byron Rakitzis. (tbrakitz@phoenix.princeton.edu ---- tbrakitz@pucc.bitnet)