My first thought was this could be a candidate for literate programming (<a href="http://www.literateprogramming.com/" rel="nofollow">http://www.literateprogramming.com/</a>), but it's hard to parse and doesn't seem practical.