D
David Thompson
| On 20 July, 22:27, (e-mail address removed) wrote:
|
|> I'm starting to design a meta pre-processor for the C language. It could
|> also be used for other languages, by C is my focus. The purpose of this
|> pre-processor is to select sections of code from files to be included in
|> other files. The goal is the ability to code related items such as structs,
|> and functions or macros that use those structs, in a single file, while the
|> actual code needs to be split up into separate .c and .h files, and combined
|> the parts from other code, for compiling. This is to allow my code to be
|> organized more like modules.
|
|
| I think you've re-discovered Literate Programming
Except that my intentions are not related to documentation specifically,
but rather, code modularization and organization. I suppose that can be
thought of as literate programming to the extent that such organization
Exactly. Literate programming, as proposed (invented?) by Knuth et al,
focusses on presenting the pieces of your program in a 'logical,
understandable (to humans)' fashion, and then automatically reordering
and reformatting as needed to make compilable code.
Unfortunately, AFAICT it takes a lot of skill (even genius) to do this
well, and I believe also some knowledge about -- and thus constraints
on -- your audience. So it hasn't caught on widely.
The same or similar tools can also reformat documentation embedded in
source code. This has proven easier and more popular, and it makes it
more likely to have correct doc which is a good thing -- but it is NOT
LP, even though it is sometimes miscalled that.
What you say sounds much closer to LP, though perhaps not exaclty.
Which is not a bad thing. Knuth's desiderata are generally good.