Place Your Query
C Programming
- Control flow-based C Programs
- Enjoy Conditional Programming in C using If...else and switch statement.
- Good, Now write a C program to display "Hello World" on the screen.
- Write a C program to display Your Name, Address and City in different lines.
- C program to find sum of n numbers
- Write a C program For Addition of two numbers using Function.
- Write a Program to Find Simple Interest and Compound Interest.
- Write a Program to Convert Celsius To Fahrenheit and Vice Versa.
- Write a Program to Find Area and Perimeter of Circle, Triangle, Rectangle and Square.
- Write a Program to Swap Two Numbers Using Temporary Variables and Without Using Temporary Variables
- Write a C Program to Design a Simple Menu Driven Calculator
- Simple Expression Based C Programs
- 7. Components of C language
- 1. Introduction to C Programming Language
- 10. Operator Precedence and Associativity
- 11. Comments in C Programming
- 14. Fundamental Control Structure Statements in C [Part-1]
- 15. Fundamental Control Structure Statements in C [Part-2]
- 16. Looping Statements [Fundamental Control Structure Statements in C. #Part-3]
- 17. Keyword break, continue, return and exit [Fundamental Control Structure Statements in C. #Part-4]
- 2. Computer Languages
- 3. Interpreters vs Compilers vs Assemblers in programming languages
- 4. C Program Structure
- 5. Compile and Execute C Program
- 6. Errors in C Program
- 8. C Datatypes
- 9. Operators in C
- Control flow-based C Programs
- Demystifying Bit Masking: Unlocking the Power of Bitwise Operators in C-Language with best Examples.
- 18. Fundamentals of C Functions
- Show Remaining Articles (3)Collapse Articles
Java
AI ML
FAQs
- A Program to find Tokens in C code?
- What are the Common Coding Mistakes.
- Easy Learning, Python QAs for Beginner’s to Pro Part-1
- Easy Learning, Python QAs for Beginner’s to Pro Part-2
- Easy Learning, Python Strings QAs for Beginner’s to Pro Part-1
- Easy Learning, Python Strings QAs for Beginner’s to Pro Part-2
- Easy Learning, Python Strings QAs for Beginner to Pro Part-3 (String Functions)
Python Interview Questions
- Easy Learning, Python QAs for Beginner’s to Pro Part-1
- Easy Learning, Python QAs for Beginner’s to Pro Part-2
- Easy Learning, Python Strings QAs for Beginner’s to Pro Part-1
- Easy Learning, Python Strings QAs for Beginner’s to Pro Part-2
- Easy Learning, Python Strings QAs for Beginner to Pro Part-3 (String Functions)
Table of Contents
< All Topics
Print
3. Interpreters vs Compilers vs Assemblers in programming languages
Updated14 March 2024
ByMilind Bhatt
Quick Links
- As you know that high level language is machine independent and assembly language though it is machine dependent yet mnemonics that are being used to represent instructions are not directly understandable by the machine. Hence to make the machine understand the instructions provided by both the languages, programming language instructors are used.
- They transform the instruction prepared by programmers into a form which can be interpreted & executed by the computer. Flowing are the various tools to achieve this purpose:
Compiler
The software that reads a program written in high level language and translates it into an equivalent program in machine language is called as compiler. The program written by the programmer in high level language is called source program and the program generated by the compiler after translation is called as object program.
Interpreter
- it executes instructions written in a high-level language.
- Both complier & interpreter have the same goal i.e., to convert high level language into binary instructions, but their method of execution is different.
- The complier converts the entire source code into machine level program, while the interpreter takes 1 statement, translates it, executes it & then again takes the next statement.
Assembler
The software that reads a program written in assembly language and translates it into an equivalent program in machine language is called as assembler.
- Assembler is a program for converting instructions written in low-level assembly code into relocatable machine code and generating along information for the loader.
- Low level machine codes are also known as pnemonices. These are special words to define basic operations on binary data. example ADD, MULT, SQR, DIV, SUB etc.
- It generates instructions by evaluating the mnemonics (symbols) in operation field and find the value of symbol and literals to produce machine code.
Linker
A linker or link editor is a computer program that takes one or more object files generated by a compiler and combines them into a single executable file, library file, or another object file.
Comparison: Compiler vs Assembler
Compiler Vs Assembler | ||
BASIS OF COMPARISON | COMPILER | ASSEMBLER |
Translation | Compiler converts the source code written by the programmer to a machine level language. | Assembler converts the assembly code into the machine code. |
Take Input as | Compiler inputs is preprocessed source code. | Assembler inputs source code. |
Gives output as | The output of compiler is a mnemonic version of machine code. | The output of assembler is binary code. |
Examples | C | GAS |
C# | GNU | |
Java | ASM | |
C++ | ||
Debugging | Debugging is easy. | Debugging is difficult. |
Working | Complier scans the entire program first before translating into machine code. | Assembler converts source code to an object code first then it converts the object code to the machine language with the help of linker programs. |
Intelligence | Compiler is more intelligent than assembler. | Assembler is less intelligent than a compiler. |
Working Phases | The compilation phases are: Lexical analyzer Syntax analyzer Semantic analyzer Code optimizer Code generator | Assembler makes works in two phases over the given input. The phases are: First Phase Second Phase |
Comparison: Interpreter vs Compiler
BASIS OF COMPARISON | INTERPRETER | COMPILER |
Function | Interpreter converts source code into the intermediate form and then converts that intermediate code into machine language | A compiler converts high-level language program code into machine language and then executes it. |
Scanning | Interpreter scans and translates the program line by line to equivalent machine code. | Complier scans the entire program first before translating into machine code. |
Working | Interpreter takes single instruction as input. | Compiler takes entire program as input. |
Code Generation | In case of interpreter, No intermediate object code is generated. | Intermediate object code is generated in case of compiler. |
Execution Time | Interpreter takes more execution time when compared to compiler. | Compiler takes less execution time when compared to interpreter. |
Examples | Python | C, C++, Cobol, C# etc. |
Perl | COBOL | |
VB | C# | |
PostScript | C++, etc | |
LISP etc. | ||
Memory Requirement | Interpreter needs less memory when compared to compiler. | Compiler requires more memory than interpreter. |
Modification | If you make any modification and if that line has not been scanned then no need to recompile entire program. | If you happen to make any modification in program you have to recompile entire program i.e scan the whole program every time after modification. |
Speed | Interpreter is slower when compared to compiler. | Compiler is faster when compared to interpreter. |
At Execution | Every time program is scanned and translated at execution time. | There is usually no need to compile program every time (if not modified) at execution time. |
Error Detection | Interpreter stops the translation at the error generation and will continue when error get solved. | Compiler gives you the list of all errors after compilation of whole program. |
Machine Code | Each time the program is executed; every line is checked for error and then converted into equivalent machine code. | Compiler converts the entire program to machine code when all errors are removed execution takes place. |
Debugging | Interpreter is good for fast debugging. | Compiler is slow for debugging because errors are displayed after entire program has been checked. |
Code Version | At the output of assembler is re-locatable machine code generated by an assembler represented by binary code. | The assembly code generated by the compiler is a mnemonic version of machine code. |
BASIS OF COMPARISON | INTERPRETER | COMPILER |