1

I just started reading about literate programming and noweb - and I find it quite interesting. As far as I understand it, the 'notangle' step is the one that extracts (machine) source code (file), from the literal programming (source) file.

Here, I'm interested in one specific aspect: I would like to be able to extract multiple source files in one pass (in the notangle step) , including an execution script - and run the execution script in the same step!

An example in bash would look something like this:

#!/usr/bin/env bash
# file: test.c.gdb.sh 

# generate C source file
cat > test.c <<"EOF"
#include "stdio.h"

int main(void) {
  return 0;
}
EOF

# generate gdb script file
cat > test.gdb <<"EOF"
break main
run
EOF

# run the 'execution script'

gcc -g -Wall test.c -o test.exe
chmod +x test.exe
gdb -x test.gdb -se test.exe

The point in this, is that I can just call './test.c.gdb.sh' from the shell, and I'll have the source files generated, then compiled, and then have the debugger started automatically.

Is there a literate programming tool, that would allow something like this in the notangle step?

Thanks in advance for any answers,
Cheers!

sdaau
  • 36,975
  • 46
  • 198
  • 278

1 Answers1

1

extract multiple source files in one pass (in the notangle step), including an execution script - and run the execution script in the same step!

Folks sometimes use make, ant, scons or maven for this kind of thing.

A "single" magical command can't cover very many bases very well. So it's left to external tools to do this.

Often, the final report or document requires complex, multi-step processing through various LaTeX tools. This, too, may require a simple build script or tool setup.

S.Lott
  • 384,516
  • 81
  • 508
  • 779
  • Many thanks for the answer, @S.Lott - good to have the references on make, ant, scons or maven (haven't heard about maven before); good to have it confirmed that in this case, it's up to external tools. Cheers! – sdaau Sep 19 '11 at 19:27
  • 1
    @sdaau: Literate programming is not about magical tools to magically make programming "easier" or "simpler". The tools, actually, are usually **more** complex than illiterate programming. After all, programming is hard to begin with. Literate program merely exposes how inherently difficult it is. – S.Lott Sep 19 '11 at 20:01