What is a computer program?
A computer program is a series of commands that are executed by the computer. However, the computer
is only capable of processing binary, i.e. a series of 0s and 1s. Therefore we require
a programming language to be able to write commands that the computer can execute, but in a
legible manner, i.e. commands that are understood by humans.
These programs are then translated into machine code (in binary) by a compiler.
The method of writing a program is closely linked to the programming language chosen, there being
many different types. Furthermore, the compiler should match the chosen language: each programming language has its
own compiler (except interpreted languages).
Generally speaking, the program is a simple text file (written using a word processor or a text
editor), this is called the source file).
The source file contains lines of program called
source code. Once the source file has been completed it must be compiled. Compilation takes place in two stages:
- The compiler transforms the source code into object code, and saves it in an object file, i.e. it translates
the source file into machine code (some compilers also create a file in assembler),
a language similar to machine code as it possesses basic functions but is legible by humans)
- The compiler then makes a call to a link editor (or linker or binder)
which enables it to embed all additional elements (functions or libraries)that are referenced in the program into the final file
but which are not stored in the source file.
Then an executable file is created which contains all items required for the program to run on its own
(in Microsoft Windows or MS-DOS this
file will have the extension .exe).