Complied VS Interpreted Language编译型语言与解释型语言
生活随笔
收集整理的這篇文章主要介紹了
Complied VS Interpreted Language编译型语言与解释型语言
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
Not so much a feature of language syntax as of how language is converted into machine instructions.
Many languages use elements of both.
與其說是語言語法的特點不如說是怎么樣把編程語言轉(zhuǎn)化為機器語言。
許多語言兩種元素兼有。
Interpreter:
- Takes commands one at a time, converts into machine code, and executes
- Allows interactive programming at a shell prompt, as in Python or Matlab.
- Can't take advantage of optimizing over a entire program- does not know what instructions are coming next.
- Must translate each command while running the code, possibly many times over in a loop.
- 在同一時間接收一個命令,將其轉(zhuǎn)化為機器碼并執(zhí)行。
- 允許在命令行提示符中進行交互式編程,就像在Python或者Matlab中那樣
- 不能利用優(yōu)化整個程序所帶來的好處——不知道接下來所要運行的命令。
- 在運行代碼時,必須逐個命令的進行轉(zhuǎn)換翻譯,可能在一個循環(huán)中執(zhí)行了很多次(注:對一個命令編譯很多遍)
The program must be written in one or more files(calledsource code).
These files are input data for the compiler, which is a computer program that analyzes the source code and converts it intoobject code.
The object codes is then passed to a linker or loader that turns one or more objects into an executable. 編譯語言:
程序必須寫在一個或者幾個文件之中(源文件)。
這些文件就是編譯器的輸入數(shù)據(jù)。編譯器可以視為一種計算機程序,分析源代碼并將其轉(zhuǎn)化為目標代碼。
這些目標代碼會被傳遞給連接器或者裝載器,將其轉(zhuǎn)化為一個可執(zhí)行文件。
WHY TWO STEPS? Object code contains symbols such as variables that may be defined in other objects. Linker resolves the symbols and converts them into addresses in memory.
Often large projects consist of many separate files and/or library routines -- don't want to re-compile them all when only one is changed.(Makefiles can be used) 為什么分為兩步? 目標文件包含像變量這樣的符號,這些符號可能在其他目標文件中被定義。連接器分解這些符號并將其轉(zhuǎn)換為其在內(nèi)存中對應的地址。
大型項目經(jīng)常包含很多獨立的文件或者程序庫——當只有一個文件改動的時候并不像全部都重新編譯(可使用Makefiles)
參考: http://faculty.washington.edu/rjl/uwhpsc-coursera/index.html
總結(jié)
以上是生活随笔為你收集整理的Complied VS Interpreted Language编译型语言与解释型语言的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: C语言同学录(通讯录)的实现
- 下一篇: 手机照片删除了怎么恢复?解析恢复过程