DIZNR INTERNATIONAL

Language processing system – Pre-processor/Compiler Assembler /Linker/ Loader/Relocatable.

Language processing system – Pre-processor/Compiler Assembler /Linker/ Loader/Relocatable.

https://www.gyanodhan.com/video/7B2.%20GATE%20CSEIT/Compiler%20Design/279.%20Language%20processing%20system%20-%20Pre-processor%20%20%20Compiler%20%20%20Assembler%20%20%20Linker%20%20%20Loader%20%20%20Relocatable.mp4

 Language Processing System

The Language Processing System is responsible for converting high-level programming code into machine-executable code. It consists of various phases, including Pre-processing, Compilation, Assembly, Linking, and Loading.

 Stages of the Language Processing System

Stage Function
Pre-Processor Handles macro expansion, header files, and conditional compilation.
Compiler Converts high-level code (C, Java, Python) into assembly language.
Assembler Translates assembly language into machine code (object code).
Linker Combines multiple object files & libraries into a single executable.
Loader Loads the executable file into memory for execution.
Relocatable Code Code that can be loaded at any memory location instead of a fixed one.

 1. Pre-Processor

 Handles macro processing, file inclusion, conditional compilation, and inline expansion.
 Works before compilation.

Example in C (Using Preprocessor Directives):

#include <stdio.h> // File Inclusion
#define PI 3.14 // Macro Expansion

Output after Pre-processing:

 2. Compiler

 Translates high-level code → assembly code.
 Checks for syntax errors & optimizations.

Example:

int main() {
printf("Hello, World!");
return 0;
}

Compiler Output: Assembly Code

 3. Assembler

 Converts assembly language → machine code (binary 0s & 1s).
 Generates an object file (.obj or .o).

Example Assembly Code:

MOV AX, 05h
ADD AX, 03h

Assembler Output: 0101 0010 1100 ... (Binary Machine Code)

 4. Linker

 Combines multiple object files & libraries into a single executable file.
 Resolves external symbols (like printf() from stdio.h).

Example:

Without a linker, a program won’t run!

 5. Loader

 Loads the executable file into memory before running it.
 Assigns memory addresses to program segments.

Example:

OS uses loaders to manage program execution.

 6. Relocatable Code

Flexible code that can be loaded at any memory address.
 Needed in modern operating systems for dynamic memory allocation.

Example:

 Complete Workflow of Language Processing System

[Source Code][Pre-Processor][Compiler][Assembler][Linker][Loader][Execution]

 Summary

Pre-Processor – Expands macros, includes header files.
Compiler – Translates high-level to assembly language.
Assembler – Converts assembly into machine code.
Linker – Combines object files & libraries.
Loader – Loads the executable file into memory for execution.
Relocatable Code – Allows execution at different memory locations.

Would you like detailed examples or diagrams?

Language processing system – Pre-processor/Compiler Assembler /Linker/ Loader/Relocatable.

compiler design lecture notes