Site icon TestingDocs.com

What is the difference between compiler and interpreter?

Overview

In this post, we will touch upon the difference between a compiler and an interpreter.

Compiler

A compiler is a program that takes another program written in a high-level language as input and translates it into an equivalent machine language for some machine. The output machine code can be run on the computer directly. Once the program is compiled, it may be run again and again without further need for the compilation process unless the source code is modified.

Javac

For example, Java Compiler. The javac tool shown below reads class and interface definitions, written in the Java programming language, and compiles them into bytecode class files.

 

For more information visit the following link: https://en.wikipedia.org/wiki/Compiler

Interpreter

Interpreter on the other hand is a program that analyzes and executes the source code instruction by instruction. For interpretation, the interpreter and the source are needed every time the code to be run.

For example, Python Interpreter shown below executed the source code instruction. print(“hello”)

For more information visit the following link: https://en.wikipedia.org/wiki/Interpreter_(computing)

 

Java Tutorial on this website:

https://www.testingdocs.com/java-tutorial/

Exit mobile version