DIFFERENCE BETWEEN COMPILER, INTERPRETER AND ASSEMBLER
ventional computers, translation of the program or the source code into object/machine code is done by various methods which include assembler, compiler and interpreter. Below are the underlying details of how they differ from one another.
What You Need To Know About Assembler
An assembler is a program that takes basic computer instruction or instructions and then converts them into a pattern of bits that the computer processor can use to perform its basic operations. Usually, language used to program the assembler is referred to as assembly language. Assembler converts source code to an object code first then it converts the object code to machine language with the help of the linker programs.
OR
Details About Assembler
- Assembler converts source code written in assembly language into machine code and then that machine code is executed by a computer.
- Assembler converts assembly language to machine language at once.
- It converts a source code to an object first then it converts the object code to machine language with the linker programs.
- Input to the assembler is assembly language code.
- GAS, GNU is an example of an assembler.
- At the output of assembler is re-locatable machine code generated by an assembler is represented by binary code.
- Assembler cannot convert the whole code into machine language at once.
- Assembler is less intelligent than compiler.
- Assembler makes two phases over the given input first phase and the second phase.
- It is difficult to debugging.
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.
OR
A compiler is a computer program that transforms source code written in programming language into machine language and then executes it. Normally, Compilers can take time because they have to translate high-level code to lower-level machine language at once and then save the executable object code to the memory. Also in a compiler, after conversion of all the code at once an error report for the whole program is generated.
Compilers can be classified based on what function it performs or how it has been constructed. Compilers can be classified as single-pass, load-and-go, debugging, multi-pass and optimization.
Compilation is performed in the following phases: lexical analyzer, syntax analyzer, semantic analyzer, intermediate code generator, code optimizer, symbol table and error handle.
Details About Compiler
- A compiler converts high-level language program code into machine language and then executes it. High-level languages are C and C#
- Complier scans the entire program first before translating into machine code.
- Compiler takes entire program as input.
- Intermediate object code is generated in case of compiler.
- Compiler takes less execution time when compared to interpreter.
Interpreter
Interpreter is a computer program that translates high level instructions into an intermediate form and then converts that intermediate code into machine language and; carries out specific actions. Interpreters are often used in software development tools as debugging tools because they can execute a single code at a time.
Details About Interpreter
- Interpreter converts source code into the intermediate form and then converts that intermediate code into machine language. The intermediate code looks same as assembler code.
- Interpreter scans and translates the program line by line to equivalent machine code.
- Interpreter takes single instruction as input.
- In case of interpreter, No intermediate object code is generated.
- Interpreter takes more execution time when compared to cocompiler.
Amazing write up , informative and knowledgeable stuff with great quality content. Thank you for sharing such informative content.
ReplyDeleteBachelor of Architecture Jobs and Career
Thanku so much 😊
DeleteThis comment has been removed by the author.
ReplyDelete