A source program may be divided into modules stored in separate files. The task of collecting the source program is entrusted to a separate program called pre-processor. It may also expand macros into source language statement.
Compiler is a program that takes source program as input and produces assembly language program as output.
Assembler is a program that converts assembly language program into machine language program. It produces re-locatable machine code as its output.
Loader and link-editor
• The re-locatable machine code has to be linked together with other re-locatable object files and library files into the code that actually runs on the machine.
• The linker resolves external memory addresses, where the code in one file may refer to a location in another file.
• The loader puts together the entire executable object files into memory for execution.