Changes

Jump to: navigation, search

Machine Language

45 bytes added, 12:40, 5 January 2017
Relationship to Other Languages
== Relationship to Other Languages ==
Since machine language is the only type of code which can be directly executed by a CPU, programs written in other languages are must ultimately converted to result in machine language code being executed in some way.
'''Interpreted languages''', such as bash, are not converted into machine code, but blocks of machine code within the interpreter are selectively invoked to perform the operations stated in the program or script.
Interpretation and compilation represent the two extreme cases of conversion to machine code. There are intermediate approaches between interpreting and compiling:
* Bytecode compilers and interpreters compile source code into a "bytecode" which is like an architecture-independent machine code. The instructions in the bytecode are effectively instructions for a virtual machine that doesn't existis not modelled after a physical machine. Therefore, they cannot be directly executed by any CPU, but they can be interpreted much more quickly than the original source code because they have already been partially processed. Java and Python both utilize bytecode in the most common implementations.
* Just-in-time (JIT) interpreters/compilers take source code or bytecode and compile it into machine code on-the-fly. This has three advantages over traditional compilation: (1) the distributed software can be in an architecture-neutral form, (2) any portion of the code which will not be executed is not compiled, and (3) more information is available to the compiler about the execution environment when the compilation is being performed. JIT execution is typically faster than interpretation, but slower than traditional (pre-)compilation, because the compilation step occurs at run time.

Navigation menu