[問題] Compiler vs Interpreter

看板Perl作者時間13年前 (2011/06/18 15:08), 編輯推噓0(006)
留言6則, 2人參與, 最新討論串1/1
大家都知道Compiler通常用在高階語言C/C++,而Scripting Language通常用 Interpreter做解譯,而我有點搞不清楚Compiler與Interpreter的差別。 就我來說,Compiler很簡單就是下列流程: C code(printf/for/while) -> [Compiler] -> Assembly instruction code(ADD/SUB/MOV) -> [Assembler] -> Machine binary code(0010001) 而Interpreter的角色呢?他是如何轉換成binary code呢?是不是比Compiler多了 幾個步驟呢? 假設我們用Perl寫程式,如何轉換成binary code呢? Perl -> Interpreter -> a bunch of C code -> compiler -> assembly -> assembler -> machine binary code? 謝謝 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 114.34.225.82

06/18 15:24, , 1F
wikipedia/perl/Implementation
06/18 15:24, 1F

06/18 15:24, , 2F
先去看看吧
06/18 15:24, 2F

06/18 15:26, , 3F
每個語言都不太一樣,從純interpreted(eg. bash)到幾乎變成
06/18 15:26, 3F

06/18 15:27, , 4F
binary(eg. perl) wiki/Interpreter_(computing)也可以看看
06/18 15:27, 4F

06/18 15:33, , 5F
Wiki並沒有解釋如何變成binary code的細節。
06/18 15:33, 5F

06/18 15:33, , 6F
只是都是個抽象的大概解釋,沒有較Detail的流程
06/18 15:33, 6F
文章代碼(AID): #1D_4xhKQ (Perl)