Compiler and Interpreter are two different ways to translate a program from programming or scripting language to machine language.
A compiler takes entire program and converts it into object code which is typically stored in a file. The object code is also refereed as binary code and can be directly executed by the machine after linking. Examples of compiled programming languages are C and C++.
An Interpreter directly executes instructions written in a programming or scripting language without previously converting them to an object code or machine code. Examples of interpreted languages are Perl, Python and Matlab.
Following are some interesting facts about interpreters and compilers.
1) Both compilers and interpreters convert source code (text files) into tokens, both may generate a parse tree, and both may generate immediate instructions. The basic difference is that a compiler system, including a (built in or separate) linker, generates a stand alone machine code program, while an interpreter system instead performs the actions described by the high level program.
2) Once a program is compiled, its source code is not useful for running the code. For interpreted programs, the source code is needed to run the program every time.
3) In general, interpreted programs run slower than the compiled programs.
4) Java programs are first compiled to an intermediate form, then interpreted by the interpreter.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- Language Processors: Assembler, Compiler and Interpreter
- Count of nested polygons that can be drawn by joining vertices internally
- Find the speed of the stream from the speed of the man given in both upstream and downstream
- Find the area of rhombus from given Angle and Side length
- Rotate matrix by 45 degrees
- Move Constructors in C++ with Examples
- How to change cursor style using C
- Implementing a Contacts directory in Python
- Calculating Areas Of Different Shapes Using Python
- Python program to sort and find the data in the student records
- Python program for arranging the students according to their marks in descending order
- Find a pair in Array with second largest product
- Find maximum of minimums from Layers of Matrix using numbers 1 to N^2
- Find temperature of missing days using given sum and average