In this article we will discuss three types of language converter software like Assembler and Compiler and Interpreter.These software are links between human and machine. Humans understand many languages such as English, Latin, Hindi, French etc. But machines only understand the binary language which is zero and one, and your computer only understands machine language.
Compiler is a language translator that translates high level language into machine language and Interpreter is also language translator which converts high level language to machine code. But assembler is a low level language this is the middle of a high level language to machine language.
High level Language?
High level languages are very close to human language. This language has no knowledge of hardware because this language is made only to understand humans. These languages do not need to remember the architecture and register of a CPU. High level languages use all programming languages such as: C, C++, JAVA, PYTHON, PHP etc.
Low level Language?
Low level languages write a program for computer hardware because this language is very close to hardware. This languages are very complex for programmers to understand. Examples of low level language are Machine language and Assembly language.
Machine Language?
Machine language is totally based on binary code which is zero and one. Machine language is the part of Low level language. This language is computer language and all programs are run in machine language.
Definition of Assembler and Compiler and Interpreter
What is Assembler?
Assembler is a language translator and it is used to translate the program assembly language into machine language.This is the middle of high level language and machine language. It is very close to machine language and this is called low level language. The program of the assembly language is written to special hardware.
What is Compiler?
Compiler is software that translates the programming language’s high level language to machine understandable machine code because the compiler is a translator. This software works between high level languages such as C and C++ to machine code. Firstly the compiler checks the full program, if no error, sends the execution. Compiler occupies more space because it checks programs fast. All programming languages such as C, C++ are used compilers for language conversion.
Difference between Compiler and Assembler.
Compiler | Assembler |
Compiler converts the program’s high level to machine level language. | It converts the program’s assembly level into machine level language. |
Compiler inputs the program’s high level source code. | Assembler inputs the program’s assembly level code. |
It works in 7 phases. | Assembler works only in 2 phases. |
Compiler output machine code. | Assembler output binary code. |
What is an Interpreter?
Interpreter is working between source code and machine code. Compiler and Interpreter are working almost the same but Interpreter is execution of program line by line. Interpreter is that translates the high level program into machine code because the interpreter is a translator software. Near interpreter scanning time is lower but the overall execution time is higher. Interpreter software occupies more memory because it checks the program line by line.
Difference between Compiler and Interpreter
Compiler | Interpreter |
Scan the full program at a time. | Line by line scanning of programs. |
Its program converts object code into source code. | This program does not convert object code into source code. |
Working fastly. | Interpreter Working slowly because line by line scanning of programs. |
It supports C, C++ and JAVA programming languages. | Interpreter supports Python, PHP, Ruby and Perl programming languages. |
Program code runs fast. | Interpreter Program code runs slow. |
Frequently Asked Questions
Q1. Which is better: Interpreter or Compiler?
You will get a compiler and interpret both pros and cons, also the compiler runs fast because it scans the full program at a time. An interpreter runs slow because it scans the program line by line.
Q2. Which is better: Compiler or Assembler?
Compilers are more intelligent than assemblers. Compiler programming languages such as C, C++ and Java but example or assembler are GNU and GAS.
Difference between Assembler and Compiler and Interpreter
Compiler | Interpreter | Assembler |
It converts the program’s high level language to machine code. | Interpreter converts the program’s high level language to machine code. | It converts the program assembly language to machine code. |
Full program execution. | Line by line checking. | It translates the entire program before running. |
Memory occupies space more. | Memory occupies space more. | Memory occupies space less. |
The program is written for a particular language. | The program is written for a particular language. | The program is written for particular hardware. |
Example : C, C++ and JAVA | Example : Python, Perl and Ruby | Programming languages convert into assembly language. |
Conclusion
The main difference between compiler, interpreter and assembler. Compiler translates the program high level language like C and C++ to machine code at a time and Interpreter is translate the program high level language like Python,Ruby and Perl to machine code line by line. But the assembler translates the program assembly language to machine code.