DEV Community

Mujahida Joynab
Mujahida Joynab

Posted on

Language Processing System: Code to Execution

When we write a program in a high-level language (HLL) like C, C++, or Java, the computer doesn’t understand it directly. Computers only understand machine language, which is binary (0s and 1s).

Our code passes through a language processing system, which step by step converts high-level code into machine-executable instructions.


The Journey of a Program

Source Code (HLL)PreprocessorCompilerAssemblerLinkerLoaderExecution


🔹 Step 1: Preprocessor

The preprocessor is the first stage. It prepares the code before compilation by handling:

  • Header files
  #include <stdio.h>
Enter fullscreen mode Exit fullscreen mode

→ Replaced with the actual contents of the stdio.h library.

  • Macros
  #define limit 60
Enter fullscreen mode Exit fullscreen mode

→ Every occurrence of limit is replaced with 60.

This process is called macro processing. The preprocessor ensures the compiler receives a clean, ready-to-compile version of the code.


🔹 Step 2: Compiler

The compiler translates the preprocessed high-level code into assembly language (a low-level, human-readable representation).

For example:

int main() {
    int num1 = 20, num2 = 30, total;
    total = add(num1, num2);
    if(total > limit) {
        printf("%d\n", total);
    }
}
Enter fullscreen mode Exit fullscreen mode

gets converted into equivalent assembly instructions.


🔹 Step 3: Assembler

The assembler takes the assembly code generated by the compiler and converts it into relocatable machine code (object file).

At this stage, the program is not yet ready to run—it still needs linking with libraries.


🔹 Step 4: Linker

The linker connects your program with external code (like standard libraries). For example, the printf() function resides in the standard C library, not inside your program.

Types of linkers:

  1. Static Linker
  • Common in C programs.
  • Library code is copied directly into the executable.
  • Execution is faster, but the translation process is slower.
  1. Dynamic Linker
  • Used in languages like Java.
  • Libraries are linked at runtime, making translation quicker but execution slower.

🔹 Step 5: Loader

Finally, the loader loads the executable file into memory and prepares it for execution.

Types of loaders:

  1. Static Loader – Loads the entire program before execution.
  2. Dynamic Loader – Loads parts of the program (like shared libraries) as needed during execution.

Important Concepts

  • Compile Time → Time taken by the compiler and assembler.
  • Load Time → Time taken by the linker and loader.

Why It Matters

Writing in high-level languages is much easier for humans, but it’s the language processing system that ensures our code gets executed at the machine level.

So, next time you run a C program and see the output on your screen, remember—it’s the teamwork of preprocessors, compilers, assemblers, linkers, and loaders that made it possible!


✨ That’s the complete journey of your program—from C code to 0s and 1s running inside your computer.

Top comments (0)