Machine-level language | Assembly language |
The machine-level language comes at the lowest level in the hierarchy, so it has zero abstraction level from the hardware. | The assembly language comes above the machine language means that it has less abstraction level from the hardware. |
It cannot be easily understood by humans. | It is easy to read, write, and maintain. |
The machine-level language is written in binary digits, i.e., 0 and 1. | The assembly language is written in simple English language, so it is easily understandable by the users. |
It does not require any translator as the machine code is directly executed by the computer. | In assembly language, the assembler is used to convert the assembly code into machine code. |
It is a first-generation programming language. | It is a second-generation programming language. |
Basis of difference | Compiler | Interpreter |
Programming Steps |
|
|
Advantage | The program code is already translated into machine code. Thus, it code execution time is less. | Interpreters are easier to use, especially for beginners. |
Disadvantage | You can't change the program without going back to the source code. | Interpreted programs can run on computers that have the corresponding interpreter. |
Machine code | Store machine language as machine code on the disk | Not saving machine code at all. |
Running time | Compiled code run faster | Interpreted code run slower |
Model | It is based on language translation linking-loading model. | It is based on Interpretation Method. |
Program generation | Generates output program (in the form of exe) which can be run independently from the original program. | Do not generate output program. So they evaluate the source program at every time during execution. |
Execution | Program execution is separate from the compilation. It performed only after the entire output program is compiled. | Program Execution is a part of Interpretation process, so it is performed line by line. |
Memory requirement | Target program execute independently and do not require the compiler in the memory. | The interpreter exists in the memory during interpretation. |
Best suited for | Bounded to the specific target machine and cannot be ported. C and C++ are a most popular a programming language which uses compilation model. | For web environments, where load times are important. Due to all the exhaustive analysis is done, compiles take relatively larger time to compile even small code that may not be run multiple times. In such cases, interpreters are better. |
Code Optimization | The compiler sees the entire code upfront. Hence, they perform lots of optimizations that make code run faster | Interpreters see code line by line, and thus optimizations are not as robust as compilers |
Dynamic Typing | Difficult to implement as compilers cannot predict what happens at turn time. | Interpreted languages support Dynamic Typing |
Usage | It is best suited for the Production Environment | It is best suited for the program and development environment. |
Error execution | Compiler displays all errors and warning at the compilation time. Therefore, you can't run the program without fixing errors | The interpreter reads a single statement and shows the error if any. You must correct the error to interpret next line. |
Input | It takes an entire program | It takes a single line of code. |
Output | Compliers generate intermediate machine code. | Interpreter never generates any intermediate machine code. |
Errors | Display all errors after, compilation, all at the same time. | Displays all errors of each line one by one. |
Pertaining Programming languages | C,C++,C#, Scala, Java all use complier. | PHP, Perl, Ruby uses an interpreter. |