Definition and types of software compiler

Definition
A compiler is a software program that transforms high-level source code written by a developer in a high-level programming language into low-level object code (binary code) in machine language that can be understood by the user. processor.
What is it for?
A compiler is a program that is used to translate the source code of another program from a programming language into executable code. The source code is usually in a high-level programming language (eg Pascal, C, C++, Java, Perl, C#, etc.). Executable code can be a sequence of machine instructions that can be executed directly by the CPU, or it can be an intermediate representation interpreted by a virtual machine (for example, Java bytecode).
How does it work?
A compiler converts a program from a human-readable format (source code) to a machine-readable format (executable code). Compilers unite source programs in high-level languages with the underlying hardware. For the compiler to work, it requires:
- Determine the correctness of the syntax of programs.
- Generate correct and efficient object code
- Organize at runtime
- Form the output according to the assembler.
Example
The following is a conceptual example of source code being converted to assembly language and machine code by the compiler:
Source code
IF COUNT=10
GOTO END-OF-JOB
ELSE
GOTO COMPUTE-AGAIN
ENDIF
machine assembly language
Compare A to B Compare 3477 2883
If equal go to C If = go to 23732
Go to D Go to 23119
Machine
code 10010101001010001010100
10101010010101001001010
10100101010001010010010