2007/09/14

〈Literate Programming〉

突然想到:強烈建議每個人(包括有意嘗試者以及不想轉換的人)都看看這篇 Knuth 寫的介紹。可以從 external link 下載,也可以看 Knuth 的 Selected Papers 系列第一彈《Literate Programming》的 chapter 4。(不過圖書館裡的這本現在在我手上就是了 XD。)裡面的 WEB system 用的語言是 Pascal,不過精神和 CWEB 完全一樣。(That's no surprise, since CWEB is a direct descendant of WEB.)這篇是我個人很喜歡的一篇 XD。

C/C++ programs 當然用 CWEB 寫(除非有 make 相關的問題,見下段)。至於其他語言我目前用 Nuweb,這是 language-independent、以 LaTeX 排版的 literate programming tool(其實現在 CWEB 以外的 literate programming tool 幾乎都是用 LaTeX 排版),我不太習慣它排出來的長相,但還可接受。

「make 相關的問題」指的是 CWEB 重新從 .w 產出 .h 檔時,很多時候 .h 檔的內容其實沒變,但 make 以為有變,而重新編譯所有引入該 .h 檔的 .c/.cpp 檔案。Nuweb 沒有這個問題。不過近期我用 CWEB 應該不會被這問題困擾才是 XD。

--
快擺脫 "illiterate" programs 吧!XD

Labels:

Blogger yen39/14/2007 7:13 pm 說:

這篇頗有基本教義派的意味 XD

 
Blogger Josh Ko9/15/2007 2:46 am 說:

Knuth 的確在這篇文章裡面做了類似的宣稱 XD:"In fact, my enthusiasm is so great that I must warn the reader to discount much of what I shall say as the ravings of a fanatic who thinks he has just seen a great light." 所以自己體驗一遍最準 XD。

 

<< 回到主頁