The main difference between compiler interpreter and assembler is that compiler converts the whole high level language program to machine language at a time while interpreter converts high level language program to machine language line by line and assembler converts assembly language program to machine language.
A computer program is a set of instructions for the computer to perform a certain task. Most programs are written in high level languages or assembly language. These programs are easy to read and understand by programmers but not understandable by the computer. The computer only understands machine language. It consists of binary which is ones and zeros. Therefore, the high level or assembly program should be converted into machine language for the computer to understand the instructions. Compiler, interpreter and assembler are translators that convert high level or assembly language based programs to machine language.
Key Areas Covered
1. What is Compiler
– Definition, Functionality
2. What is Interpreter
– Definition, Functionality
3. What is Assembler
– Definition, Functionality
4. Difference Between Compiler Interpreter and Assembler
– Comparison of Key Differences
Key Terms
Compiler, Interpreter, Assembler
What is Compiler
A compiler is a language translator that converts high level programs into machine understandable machine codes. In this process, the compiler converts the whole program to machine code at a time. If there are any syntactic or semantic error, the compiler will indicate them. It checks the whole program and displays all errors. It is not possible to execute the program without fixing those errors.
Programming languages such as C, C++ uses a compiler for language conversion. The execution time is lower in these languages. Therefore, they are considered fast languages.
What is Interpreter
An interpreter is also a language translator that converts high level programs into machine codes. Unlike compilers, interpreters convert the source code to machine code line by line. As it checks line by line, the scanning time is lower. But the overall execution time is higher.
Interpreter displays an error at a time. The programmer should fix that error to interpret the next line. Programming languages such as Python, Ruby, PHP, Perl are some examples of interpreter-based languages.
What is Assembler
In addition to high level languages and machine language, there is another language called the assembly language. Assembly language is in between the high level languages and machine language. It is closer to machine language than high level languages. It is also called low level language. This language is not easily readable and understandable by the programmer like a high level programming language. The assembler works as the translator in converting the assembly language program to machine code.
Difference Between Compiler Interpreter and Assembler
Definition
A compiler is a software that converts programs written in a high level language into machine language. An interpreter is a software that translates a high level language program into machine language while an assembler is a software that converts programs written in assembly language into machine language.
Functionality
Compiler converts the whole high level language program to machine language at a time. Interpreter converts the high level language program to machine language line by line. In contrast, assembler converts assembly language program to machine language.
Language
Languages such as C, C++ use compilers to convert the code. Languages such as Ruby, Perl, Python, PHP uses an interpreter and assembly language uses an assembler.
Conclusion
Compiler, Interpreter and Assembler are language translators. The difference between compiler interpreter and assembler is that compiler converts whole high level language programs to machine language at a time while interpreter converts high level language programs to machine language line by line and assembler converts assembly language programs to machine language.
Reference:
1. “What Is Assembler , Interpreter & Compiler? (In English)”, Exam Study Zone, 9 Sept. 2017, Available here.
2. “Assembly Introduction.” Tutorials Point, 19 Mar. 2018, Available here.
Image Courtesy:
1. “Compiler” By I, Surachit (CC BY-SA 3.0) via Commons Wikimedia
Leave a Reply