Compilers are translation software
All in machine language
This section will discuss that in more detail.
To begin with, the program you just described is nothing more than an ordinary string of characters.
You've probably heard that computers run on binary numbers.
Why would a computer running on binary numbers recognize and work with strings?
Essentially, for a computer, the only instructions it can understand are those written in binary numbers.
The instruction ・・・・, written in binary, is what is called machine language (machine language ).
This is just a bunch of bullshit 0s and 1s, but it is the image.
Any computer, ancient or modern, can only recognize this form of instruction.
Emergence of programming languages
In fact, such programs were used in the early days of computers.
A vast number of zeros and ones were entered by flipping a toggle-type switch.
However, any amount of this is going to be daunting.
So, the first thought was to shrink the digits of the numbers.
01 85 AD 7F 7C A4 FA 6B AD
06 f5 ab 74 7e dc 18 fa a4
01 7F A7 C5 D8 6B 4E A4 FA
This is the so-called hexadecimal representation.
Four binary digits can be represented by a single hexadecimal digit, which is shorter.
Then, an assembler was also conceived that symbolized each of these numbers.
MOV AH, BH
ADD AX, 70
JPN AF, 01
Although this symbolization has made programming much more efficient, the
They are still symbols that are difficult for ordinary people to understand and handle.
The world's first programming language, FORTRAN, changed this dramatically.
DO 10 I=1,000
READ *, X
At this point, it is quite close to English text and formulas, and even ordinary people can understand it if they study it.
The C language is also one of these high-level languages, languages that are close to human language.
A programming language that can be written in a way that is easy for humans to understand.
In contrast, machine language and assembly are called low-level languages.
C Language Translation Software
In order for a computer to understand this, translation is necessary.
It is basically the same as translating English into Japanese.
This task, of course, can be done manually by humans.
That is not much different from programming in machine language after all.
Therefore, software exists to perform the translation.
There are two main translation methods. In the case of the C language, the method that translates everything at once is used.
Some types of languages other than C also perform simultaneous translation.
They are called interpreters and are
Flexible configurations are possible, but the disadvantage is slow speed.
It is possible to run the program one by one, checking each step.
Although it is very convenient for fixing bugs
C's greatest advantage, speed, is sacrificed.
It is not used for practical purposes.
The software that compiles and translates this translation is called a compiler.
We have already explained how to obtain and use a compiler, and this software is necessary for this purpose.
Software that translates a string file written in C into machine language.
The compiler actually works in a three-step mechanism.
First, the string is adjusted by software called a preprocessor.
Whitespace and line breaks are combined and symbols are replaced to make the program easier to analyze.
The #define pseudo instruction and other instructions described below are also processed here.
Next, the compiler compiles the file, and optimization is performed at this time.
The same C program can run at different speeds depending on how it is translated.
The compiler translates the data to be faster.
The ability to translate into machine language by devising a faster operation.
Finally, the translated machine language programs are combined by software called a linker.
Combining with a linker is called linking.
Linking turns machine language data into an executable file.
Pre-processing (string adjustment)
Executable software (executable file)
*Pre-processing, compilation, and linking are sometimes collectively referred to as compilation.
Also, even the creation of an executable file is sometimes collectively referred to as build.
The file that becomes an executable (in essence, an EXE file) is
It can be run as an application.
These series of tasks are now fully automated, so that
We are usually not particularly aware of this, but software is created that can operate at the push of a button.
About this Site
The C language (bitter C), which is learned by suffering, is
This is the definitive C language introductory site.
It systematically explains the basic functions of the C language and
It is as complete as or more complete than any book on the market.