Compiler Program

Definition – What is Compiler Program

A compiler is a computer program that converts program source code into either machine code, assembly code, or object code that can be executed on the computer or machine. Every mid and high-level programming language has its own compiler for converting the source code into object code.

Since no machine/computer can’t understand high-level instructions like C, C++, C#, Java, Python syntax so that every language must have a compiler to convert the source code into machine code for execution on the computer.

In general, compiler means translating one programming language (the source language) to another language (the target language). But, primarily when a program translates a high-level program code (ex: C, C++) to low-level program code (ex: Machine code, assembly code) is called a compiler. And if a low-level program code translates into a high-level program code is called a decompiler.

Cross-compiler

If a compiler able to compile a program to a machine-executable file that runs on multiple machines is called cross-compiler. For example, a python compiler translates a block of python code from Windows operating system and if the compiled python file opens in Linux OS then the compiler used in Windows operating system is called cross-compiler.

Cross-compilers are very popular because it makes compilers machine-independent. Nowadays all modern compilers are cross-compilers. Compilers implementers are focusing closely on machine independency.

Compiler Types

In general, we think compiler means translating high-level code into low-level code. That’s not true. There are different types of compiler out of the box. Probably they can be:

  • Bytecode compilers
  • Source to source compiler
  • Transcompiler
  • Binary compiler
  • Hardware compiler
  • Just in time compiler
  • Assembler Compiler, etc