- #1
fog37
- 1,569
- 108
- TL;DR Summary
- Difference between interpreted and compiled files...
Hello,
I am sort of clear on the difference between compiled and interpreted computer languages.
Compilation
A program (source code), for example written in C, is essentially text that is converted by a compiler (software program) into binary machine code (1s and 0s) for the microprocessor to execute. Different computers have different operating systems and microprocessor architectures. This means that, while the source code is the same, the compiler and the compiler's output (binary code) are machine dependent. If a programmer wants to distribute its C code, he/she must first either compile the code into the binary code to share it. The generated .exe file can only run on the same type of machine that the programmer has. If the recipient machine is different, the .exe file will not work. The C programmer could also share the source code directly with the recipient who must then download the appropriate compiler program on its machine to compile the C source code into a binary code that works on his/her machine.
Interpretation
Interpreted Langauge (Python): The fist step consists of converting the source code into intermediary code (bytecode). I think the bytecode is computer hardware independent. Bytecode must then be converted by a Python virtual machine (software) into the actual binary machine code. I think that different machines (with different operating system and processor) would require different types of VMs to perform the final conversion. Is that correct?
So the recipient of a file that was written with an interpreted language like Python still needs to download on their machine the VM/
In both the compilation and interpretation cases, the recipient of the file needs to download piece of software ( either a VM or a compiler) to use the file. And both the VM and the compiler are machine dependent, I believe. So how is Python more portable if the user still need to have a machine specific software, the VM? It seems to be the same issue that we have with a machine specific compiler...
Thanks!
I am sort of clear on the difference between compiled and interpreted computer languages.
Compilation
A program (source code), for example written in C, is essentially text that is converted by a compiler (software program) into binary machine code (1s and 0s) for the microprocessor to execute. Different computers have different operating systems and microprocessor architectures. This means that, while the source code is the same, the compiler and the compiler's output (binary code) are machine dependent. If a programmer wants to distribute its C code, he/she must first either compile the code into the binary code to share it. The generated .exe file can only run on the same type of machine that the programmer has. If the recipient machine is different, the .exe file will not work. The C programmer could also share the source code directly with the recipient who must then download the appropriate compiler program on its machine to compile the C source code into a binary code that works on his/her machine.
Interpretation
Interpreted Langauge (Python): The fist step consists of converting the source code into intermediary code (bytecode). I think the bytecode is computer hardware independent. Bytecode must then be converted by a Python virtual machine (software) into the actual binary machine code. I think that different machines (with different operating system and processor) would require different types of VMs to perform the final conversion. Is that correct?
So the recipient of a file that was written with an interpreted language like Python still needs to download on their machine the VM/
In both the compilation and interpretation cases, the recipient of the file needs to download piece of software ( either a VM or a compiler) to use the file. And both the VM and the compiler are machine dependent, I believe. So how is Python more portable if the user still need to have a machine specific software, the VM? It seems to be the same issue that we have with a machine specific compiler...
Thanks!