开发者

Literate programming: tool to extract and run a script from source in one pass?

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开发者_JS百科 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!


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜