A Computer is like a king or queen who is fluent in machine language, but has to ask translators, assemblers, and interpreters to translate languages like C++ into machine language for the reigning monarchs ears.
Computers do not directly understand C++. When compiling your code into machine language, we can talk about the following:
- The source language
- The language in which the compiler is written.
- The target language
A C++ compiler compiles C++ into machine language.
The source language is C++.
The destination language is machine language.
The language in which the compiler is written can be anything available which you enjoy using.
The compiler can be written in python, FORTRAN, Intel x86, or anything that you desire.
The compiler essentially takes a text file as input and outputs a executable binary file (a file written in machine language).
If you make many many new versions of the same language, then you can compile newer versions using older versions.
Originally, people:
- compiled C++ into C
- compiled C into x86 Assembly
- assembled x86 Assembly into a machine language.
Eventually, people started skipping steps in the middle. For example, some code written in C++ is never translated into C before it becomes an executable binary file.
Feel free to edit the following table to make it more historically accurate.
Someone else will pick up where you left off if you get tired.
SOURCE LANGUAGE |
LANGUAGE OF THE COMPILER |
DESINATION LANGUAGE |
C++ version 1.0 |
C |
C |
C++ version 2.0 |
C++ version 1.0 |
C |
C++ version 3.0 |
C++ version 2.0 |
C |
C++ version 4.0 |
C++ version 3.0 |
C |