shebang launcher for D programs

Andrei Alexandrescu (See Website For Email) SeeWebsiteForEmail at erdani.org
Wed Mar 21 11:56:18 PDT 2007


I used the shebang feature like this:

#!/usr/bin/env rdmd
... D code ...

Unfortunately, rdmd only works on single-file code. As soon as you try 
to import another file of yours, rdmd won't handle that.

So I wrote a Perl script rundmd that parses the D source looking for 
import directives, then does the same for all imported files, 
transitively (using a worklist approach). The script caches the results 
so it only does that minimally, after modifications. Then the script 
launches the proper compile command (if needed), and finally runs the 
produced executable.

In short, rundmd does what rdmd does but works on multi-module programs.

I suspect other people have written similar scripts, but just in case, I 
thought I'd ask. If people are interested, I'll be glad to comb the 
script a little and post it here.


Andrei



More information about the Digitalmars-d mailing list