Compilation of different languages will be explored here. All programming languages are compiled and processed by compiler right. Each language has different steps to execute the code into machine language. First will start with .Net (C#).
.Net (C#)
.NET application executed by CLR (Common Language Runtime) execution engine. Compiler convert the source code into IL(Intermediate Language) and store in an assembly (.exe or .dll). Then CLR loads the assembly and Just-in- time compiler converts IL code into native machine code. Then it will be executed by CPU.CLR also provide the memory management, security, exception handling and garbage collection.
Step 1: write C# source code
class Program
{
static void Main()
{
Console.WriteLine("Hello World");
}
}
Step 2: Compiled into IL
(.cs) convert to Intermediate language by CIL (Common Intermediate Language)
Step 3: Create assembly
This assembly is platform independent.
MyApp.exe
├── IL Code
├── Metadata
└── Manifest
Step 4: Load assembly
CLR Loads the assemblies and verify the security then Performs garbage collection process.
Step 5:
The Just-In-Time (JIT) Compiler convert (Intermediate language IL code into native machine code. Then CPU executes the generated native machine code. During execution, CLR services will support the application running.
In one-line steps:
Source Code → IL → Assembly → CLR → JIT → Native Code → Execution
Python
Python source code complied by Python Virtual Machine (PVM).its handles function execution, Memory management, Imports and runtime environment. Source code(.py) files first compiled to (.pyc) platform-independent bytecodes. Then PVM read and execute this bytecode. Only two step process simple and flexible also across operating systems.
Step 1: Create python code
Example:
print("Hello Python")
Step 2: Compiled to byte codes
compiled bytecode is stored in the pycache folder as .pyc files
pycache/ hello.cpython-313.pyc
Step 3: Execute code

Join the conversation! Your thoughts help the community grow.