What is Compiler and Interpreter?

High-level language (source code): understandable by humans.

Machine code (written in binary (0’s and 1's)): understandable by computers.

Compilers and Interpreters: convert source code into machine code.

Compiler converts the whole source code into machine code at a once. Interpreter converts line by line.

Compiler gives the error messages after scanning the entire code. Interpreter stops at the first error, so debugging is easier.

Compilers are used by: C, C++, C#, basic, ada …

Interpreters are used by: javascript, python, ruby, matlab

Compiler and interpreter work together in Java:
- Java Compiler, called Javac, converts the source file (.java) to (.class) file, written in Java bytecode.
- Java interpreter, called java, converts the (.class) file into natural machine codes.