It is a translator which takes input i.e., High Level Language and produces an output of low level language i.e. machine or assembly language.
- Compiler is more intelligent than an assembler it checks all kinds of limits, ranges, errors etc.
- But it’s program run time is more and occupies a larger part of memory. It has slow speed because a compiler goes through the entire program and then translates the entire program into machine codes.
An interpreter is a program which translates a programming language into a comprehensible language. –
- It translates only one statement of the program at a time.
- Interpreters, more often than not are smaller than compilers.
Let’s see the difference between Compiler and Interpreter:
|1.||Compiler scans the whole program in one go.||Translates program one statement at a time.|
|2.||As it scans the code in one go, the errors (if any) are shown at the end together.||Considering it scans code one line at a time, errors are shown line by line.|
|3.||Main advantage of compilers is it’s execution time.||Due to interpreters being slow in executing the object code, it is preferred less.|
|4.||It converts the the instructions into systematic code.||It doesn’t convert the instructions instead it directly works on source language.||Eg.||C, C++, C# etc.||Python, Ruby, Perl, SNOBOL, MATLAB etc.|
Attention reader! Don’t stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the CS Theory Course at a student-friendly price and become industry ready.
- Language Processors: Assembler, Compiler and Interpreter
- Difference between Native compiler and Cross compiler
- Difference between Assembler and Interpreter
- Incremental Compiler in Compiler Design
- What is the Python Global Interpreter Lock (GIL)
- Difference between Compiler and Assembler
- Difference between Cross-Assembler and Compiler
- Why FIRST and FOLLOW in Compiler Design?
- Error detection and Recovery in Compiler
- Compiler Theory | Set 1
- Compiler Theory | Set 2
- Introduction to Syntax Analysis in Compiler Design
- Runtime Environments in Compiler Design
- Syntax Directed Translation in Compiler Design
- Intermediate Code Generation in Compiler Design
- Peephole Optimization in Compiler Design
- Code Optimization in Compiler Design
- Introduction of Object Code in Compiler Design
- Introduction of Compiler Design
- Phases of a Compiler
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.