Differentiate between an interpreter and a compiler.
Answers
COMPILER
- It takes an entire program at a time.
- It generates intermediate object code.
- The compilation is done before execution.
- Display all errors after compilation, all at the same time.
INTERPRETER
- It takes a single line of code or instruction at a time.
- It does not produce any intermediate object code.
- Compilation and execution take place simultaneously.
- Displays error of each line one by one.
HOPE THIS ANSWER WILL HELP YOU!!♡
Answer:
Differentiate between interpreter and compiler.
Compliers and interpreters are programs that help convert the high level language (Source Code) into machine codes to be understood by the computers. Computer programs are usually written on high level languages. A high level language is one that can be understood by humans. To make it clear, they contain words and phrases from the languages in common use – English or other languages for example. However, computers cannot understand high level languages as we humans do. They can only understand the programs that are developed in binary systems known as a machine code. To start with, a computer program is usually written in high level language described as a source code. These source codes must be converted into machine language and here comes the role of compilers and interpreters.
Additional information
How Interpreter and Compiler work?
To start with, a compiler creates the program. It will analyze all the language statements to check if they are correct. If it comes across something incorrect, it will give an error message. If there are no errors spotted, the compiler will convert the source code into machine code. The compiler links the different code files into programs that can be run such as exe. Finally the program runs.
An interpreter creates the program. It neither links the files nor generates machine code. The source statements are executed line by line while executing the program.
Advantages and disadvantages of Interpreter and Compiler
In case of using compilers, the program codes are translated into machine code already and hence the time to execute the code is very less. On the negative side, it is not possible to change the program without going back to the source code while working with a compiler.
Interpreters make working with the source code much easier. Hence they are highly suitable especially for the beginners. On the negative side, interpreted programs can only run on the computers that have the respective interpreters.