Oop Course 1
Oop Course 1
MODULE 1:
The languages we use to communicate with other people are called natural
languages.
Artificially created languages, such as Esperanto or even Quenya (the language used
by elves in Tolkien's world)
Another set of rules determines the appropriate ways of collating the symbols - this
is the syntax of the language.
to recognize the meaning of every statement expressed in the given language, and
this is what we call semantics
rules determine which symbols (letters, digits, punctuation marks, and so on) could
be used in the language. This part of the definition of language is called lexicon.
Any program we write must be error-free in these three ways: lexically,
syntactically and semantically,
A complete set of well-known commands is called an instruction list, sometimes
abbreviated to IL.
The IL is in fact an alphabet that is commonly known as machine language. This is
the simplest and the most primary language we can use to give commands to our
computer. We can say it's the computer’s mother tongue.
It is possible (and this is often done in practice) for a computer program to be coded
directly in machine language using elementary instructions (orders).
That bridge is also a language – an intermediate common language for both humans
and computers working together. Such a language is often called a high-level
programming language.
the programs written in high-level languages can be translated into any number of
different machine languages, and thus enable them to be used on many different
computers. This is called portability.
The translation we are referring to is made by a specialized computer program called
a compiler.
The process of translating from a high-level language into a machine language is
called compilation.
We already know that the main task is to write a program in accordance with the
rules of the chosen programming language. Such a program (which in fact is just
text) is called the source code, or simply source, while the file which contains the
source is called the source file.
If the compiler doesn't find any mistakes in your source, the result will be a file
containing your program translated into machine language. That file is commonly
called an executable file.
The name of the file depends on the compiler you use and the operating system you
are working with. For example, most compilers designed for Unix/Linux system
create an output file named "a.out" by default. Compilers designed for use in MS
Windows® can name the same name to this file as the source file, while only
changing the suffix from .cpp to .exe.
It may also be that the program was not written by you alone, but by a whole team,
in which case the division of sources into multiple files is simply a must. In this case,
the compiling process splits into two phases: a compilation of your source in order
to translate it into machine language and a joining (or gluing) of your executable
code with the executable code derived from the other developers into a single and
unified product. The phase of "gluing" the different executable codes is commonly
known as linking, while the program that conducts the process is called a linker.
This type of structured and semi-formal description of each step of the program is called
an algorithm. Sources of the word algorithm can be traced back to the Arabic language and
originated in early medieval times, and for us, this represents the beginning of computer
programming.
The changes the preprocessor will introduce are fully controlled by its directives. In
our program, we are dealing with the include directive. When the preprocessor
meets that directive, it replaces the directive with the content of the file whose name
is listed in the directive (in our case, this is the file named iostream). The changes
made by the preprocessor never modify the content of your source file in any way.
Any alterations are made on a volatile copy of your program that disappears
immediately after the compiler finishes its work.