A compiler is a software program that compiles program source code files into an executable program. It is included as part of the integrated development environment IDE with most programming software packages.
The compiler takes source code files that are written in a high-level language, such as C, BASIC, or Java, and compiles the code into a low-level language, such as machine code or assembly code. This code is created for a specific processor type, such as and Intel Pentium or PowerPC. The program can then be recognized by the processor and run from the operating system.
The source code goes through three processes:
Stage 1 - Lexical Analysis where the code is checked to see that only correct programming language keywords have been used.
Stage 2 – Syntactical Analysis where the code from the first stage is checked to see that the language rules have been followed.
Stage 3 – Code Generation where the Machine Code version of the program is created. This code, created from the author’s program, is then linked to standard Machine Code required by the specific language being used, to create an executable program.