Explain the context of a compiler

  • In addition to a compiler, several other programs may be required to create an executable target program 

Preprocessor

Preprocessor produces input to compiler. They may perform the following functions,

  1. Macro processing: A preprocessor may allow user to define macros that are shorthand for longer constructs
  2. File inclusion: A preprocessor may include the header file into the program text
  3. Rational preprocessor: Such a preprocessor provides the user with built in macro for construct like while statement or if statement
  4. Language extensions: this processors attempt to add capabilities to the language by what amount to built-in macros Ex: the language equal is a database query language embedded in C. statement beginning with ## are taken by preprocessor to be database access statement unrelated to C and translated into procedure call on routines that perform the database access.

Assembler

Assembler is a translator which takes the assembly program as an input and generates the machine code as a output. An assembly is a mnemonic version of machine code, in which names are used instead of binary codes for operations.

Linker

Linker allows us to make a single program from a several files of relocatable machine code. These file may have been the result of several different compilation, and one or more may be library files of routine provided by a system.

Loader

The process of loading consists of taking relocatable machine code, altering the relocatable address and placing the altered instructions and data in memory at the proper location.

Leave a Reply