A compiler is a software tool used to translate source code written in a programming language into executable code that can be run on a computer. This is a process that involves several stages, including lexical analysis, syntax analysis, and semantic analysis of the source code. The compiler then generates executable code that is ready to run. While simple language can be used to explain compilers, understanding their operation and translation process can be essential for software engineers and programmers who write software. That's why we separated this topic from the previous post, see here; and gave it special significance.
The first good question you would probably have for us is, in what program is the compiler for the C programming language written? If we go back a little in history, we know that older computers mostly used assembly language, while higher-level programming languages began to develop when the benefits of reusing software on different processors increased. The first higher-level programming language, Plankalkül, was proposed as early as 1943. Since then, several experimental compilers have been developed. Fortran's team, led by John Backus of IBM, introduced the first complete compiler in 1957. Since then, compilers have become increasingly complex as computer architectures have evolved.
Today, it is common practice to implement compilers in the same language that is being compiled. Therefore, it is assumed that the compiler of the C programming language is coded in the C programming language, as for example all .Net programming languages have an open-source Microsoft compiler called Roslyn which is written in the C# programming language. However, to create the first C compiler, its creator Dennis Ritchie used the previous programming language B, which was developed by Ken Thompson.
Dennis Ritchie later expanded the B programming language and created the C programming language, so the original C compiler was also written in B. We mostly use GCC compiler version 14 or newer, this text was written in 2025; and there is no theoretical chance that you will find any command in the B programming language in it. Because the GCC compiler does not support the B programming language, it considers it too obsolete. But we know that the GCC compiler is written in a combination of the C and C++ programming languages, with the possibility that it may also contain some parts written in other programming languages such as Objective-C and some newer ones.
When you flawlessly write C code in any text editor and create a text file, you can call the C compiler to translate it into machine code so that your program can run. The compiler runs a translator or translation unit, known as a Translation Unit, which consists of the source file and header files that are referenced using #include directives. If your code is correct, the translator creates an Object File, which we recognize by the. o or .obj suffix, and we call such object files modules. The standard library of the C programming language contains translated object files in machine language, which allows faster access to standard functions that we call in our programs.
It is important to note that when we say that a file is translated into machine language in the C programming language, it is first translated into assembly programming language in a temporary file, which is then translated into machine language, after which the temporary file is deleted. When compiling a program, we recognize such a file by the . s suffix. The translator separately translates each source file with all the header files it contains into separate object files, i.e., modules. The translator then calls the Linker, which combines all object files and all used functions from the library into an Executable File. Do not confuse this process with .Net technology. In .Net technology and the C# programming language, things are different.
How the C Programming Language 'Understands' Your Code: A Journey Through the Compilation Stages