Pages

Monday, December 26, 2016

Compiler, Interpreter, Linker and Loader

Regardless of what language you use, you eventually need to convert your program into a language that the computer can understand
Two ways for doing that: compile the program or interpret the program

Compiler 

A compiler is a computer program that translates a program in a source language into an equivalent program in a target language. 
OR
A program that translate a source (human-writable) program to an executable (machine-readable) program.

Interpreter

Interpreter is a program that executes instructions written in a high-level language 

OR 

Is a program that converts a source program and execute it at the same time.


An example diagram of Interpreter and Compiler



Compiler and Interpreter diagram

Linker

A program that takes as input the object files (contains machine code for only a procedure or a set of procedures) of one or more separately compiled program modules, and links them together into a complete executable program, resolving reference from one module to another.
Types of Linker:
  • Linking loader: this linker performs all the linking and relocation operations and load the linked program directly into the main memory.
  • Linkage editor: this linker produces a linked version of the program called as a load module or an executable image.
  • Dynamic linker: this. Scheme postpone the linking function until execution time. Any subroutine is loaded and linked to the rest of program when it is first called

Loader

A program that takes an input an executable program, loads it into main memory, and causes execution to being by loading the correct starting address into the computer register.
When the program finished, control must somehow be returned to the operating system
Types of Loader:
  • Absolute loader: absolute loader is a primitive type of loader which does only the loading function. It does not perform linking and program relocation.
  • Bootstrap loader: when the computer is turned on absolute loader is executed. this loader is responsible for loading the operating system and transferring control to it. This loader is present in the ROM area of main memory.
  • Relocatable loader: this loader is responsible for relocation and loading.

1 comment: