MMGameslogo  MMGames
TwitterSharebutton  FacebookSharebutton   
learn through sufferingC Language
learn through sufferingC Language

A compiler is a translation software.

Everything is machine code.
"In the previous section, we casually said that the program would run,"
Here, I will explain this in more detail.

"Actually, the program you all described earlier is just a regular string."
You've probably heard that computers operate on binary as well, have you?
Why can computers operating in binary recognize and process strings?

Originally, computers can only understand instructions written in binary code.
Instructions written in binary, what is commonly referred to as machine code.

Machine code imagery
000101001101010100101010
000101010101010010110100
101010001010101101010110
000101001010101001001101
000101001010101000000101

This is just a random string of zeros and ones, but it captures the idea.
No matter what computer, east or west, it can only recognize commands in this format.
The emergence of programming languages
Only machine code can be understood by computers.
In fact, programs like this were used in the early days of computing.
I was rapidly toggling a switch, inputting a massive amount of zeros and ones.

However, this is getting disheartening, no matter how you look at it.
So, the first thing that was considered was reducing the number of digits.

Hex machine code
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 what is known as a hexadecimal representation.
Binary numbers require 4 digits to represent a value that can be expressed in one digit in hexadecimal.
And assemblers were also conceived that could symbolize each of these numbers individually.

Assembler
MOV  AH,BH
ADD  AX,70
JPN  AF,01

This tokenization has significantly improved programming efficiency, but...
It remains a symbol that is still difficult for ordinary people to understand.
The first programming language to significantly change the world was FORTRAN.

FORTRAN
DO 10 I=1,10000
READ *,X
IF (X,GT,MAX)MAX=X
10 CONTINUEA

At this point, it's become quite close to English sentences and equations, and anyone can understand it with a bit of study.
C is also counted among high-level languages, those closer to human languages.

キーワード
【High-level language】

人間にわかりやすく書くことができるprogramming言語。
これに対して、マシン語やアセンブリを低級言語と呼ぶ。


C Language Translator
Nuance languages are human-created, and therefore, computers cannot understand them.
A translation is necessary to make this understandable to a computer.
It's essentially the same as translating Japanese into English.

While this task could certainly be done manually by humans,
"So, in the end, it's not much different from programming in machine code."
Therefore, there is software available to facilitate translation.

There are mainly two translation methods, but for C, we use the method of translating everything at once.

Simultaneous interpretation

C Language以外の言語の中には、Simultaneous interpretationを行うタイプもあります。
それらはインタプリタと呼ばれており、
It can be configured flexibly, but its disadvantage is slow speed.


C Language Interpreter
There are also interpreted environments available for the C language.
プログラムを一つ一つ確認しながらrunでき、
バグ修正には大変便利なのですが、
C Language最大の利点である速度が犠牲になるため、
It will never be used for practical purposes.

We call the software that performs this translation a compiler.
"Although I've already explained how to obtain and use the compiler, this software is what you need for that."

キーワード
【Compiler】

A software that translates C language-written string files into machine code.


This compiler actually operates with a three-stage process.

First, a software called a preprocessor adjusts the strings.
It refines the program by handling issues like combining whitespace and line breaks, and replacing symbols, to make it easier to analyze.
Furthermore, the #define pseudo-command, described later, is also processed here.

Next, it's compiled by the compiler, and during that process, optimization takes place.
Even with the same C program, the execution speed can vary depending on the translation method.
The compiler is translating to optimize for speed.

キーワード
【Optimization】

A feature that translates code into machine language optimized for faster execution.


Finally, this translated machine code program will be linked by a linker.
Combining with a linker is called linking.
By being linked, machine code data becomes an executable file.

Compilation process
C Languageのプログラム(Source code)

プリプロセス(文字列のadjustment)

コンパイル(翻訳)

リンク(結合)

run可能なソフトウェア(run可能File)

Sometimes, preprocessing, compiling, and linking are collectively referred to as compiling.
It's also common to refer to the creation of executable files as part of the build process.

The file, now an executable (essentially an EXE file),
It can be run as an application.

These tasks are now fully automated.
We often take for granted that software can be created that simply works with the press of a button.


About This Site

Learning C language through suffering (Kushi C) is
This is the definitive introduction to the C language.
It systematically explains the basic functions of the C language.
The quality is equal to or higher than commercially available books.

Part 0: Program Overview
  1. What is a program?
Chapter 3: Displaying on the Screen
  1. String Display
  2. newline character
  3. Practice Problem 3
Chapter 4: Displaying and Calculating Numbers
  1. Display of numbers
  2. Basic calculations
  3. Numeric types
  4. Practice Problem 4
Chapter 6: Input from the Keyboard
  1. input function
  2. The fear of input
  3. Practice Problem 6
Chapter 9: Repeating a Fixed Number of Times
  1. Iterative sentence
  2. How Loops Work
  3. Practice Problem 9
Chapter 10: Repeating Without Knowing the Number of Times
  1. Unspecified loop
  2. Input validation
  3. Practice Problem 10
Chapter 13: Handling Multiple Variables at Once
  1. Handling multiple variables collectively.
  2. Arrays
  3. Practice Problem 13
Chapter 19: Dynamic Arrays
  1. Create arrays freely.
  2. Practice Problem 19