Maybe you want Knuth's Literate Programming. http://en.wikipedia.org/wiki/Literate_programming Long ago it was only for pascal and C (web and cweb), but now I see there is noweb that works with any programming language. -- Dan