AllTheTimeWorld.com

computersCompilers

Compilers

After writing the source code (or a section of code), the programmer runs the program. When a programmer runs the program, several steps occurred before the programmer sees the output.

compilers
When source code is sent to the compiler, the preprocessor searches for any compiler directives or preprocessor commands. These are usually special lines of code at the beginning that tell the compiler to include external files, set options or restrictions, or give instructions to modify the code in some way.

Next, the compiler will translate the code into machine language. If there are any errors, they are reported to the programmer. Errors found by the compiler are syntax errors: a missing semicolon, a misspelled name, or using a command wrong.

The programmer must fix the syntax errors and send the program to the compiler again. Finally, when the compiler does not find any errors, the machine language instructions (object code) is created.

Next, the programmer must test the program for logical errors. The programmer may have logical errors even though it compiles and runs. The programmer must thoroughly test the program to guarantee that the results are correct and that the program runs without using unnecessary resources.