# Fundamentals

## Natural Languages vs Programming Languages

&#x20;A complete set of known commands is called an **instruction list**, sometimes abbreviated to **IL**. Different types of computers may vary depending on the size of their ILs, and the instructions could be completely different in different models.

## What makes a language?

We can say that each language (machine or natural, it doesn't matter) consists of the following elements:

*   &#x20;**AN ALPHABET**

    a set of symbols used to build words of a certain language (e.g., the Latin alphabet for English, the Cyrillic alphabet for Russian, Kanji for Japanese, and so on)&#x20;
*   **A LEXIS**

    (aka a dictionary) a set of words the language offers its users (e.g., the word "computer" comes from the English language dictionary, while "cmoptrue" doesn't; the word "chat" is present both in English and French dictionaries, but their meanings are different)&#x20;
*   **A SYNTAX**

    a set of rules (formal or informal, written or felt intuitively) used to determine if a certain string of words forms a valid sentence (e.g., "I am a python" is a syntactically correct phrase, while "I a python am" isn't)&#x20;
*   **SEMANTICS**

    a set of rules determining if a certain phrase makes sense (e.g., "I ate a doughnut" makes sense, but "A doughnut ate me" doesn't)

The IL is, in fact, **the alphabet of a machine language**. This is the simplest and most primary set of symbols we can use to give commands to a computer. It's the computer's mother tongue.

&#x20;A program written in a high-level programming language is called a **source code** (in contrast to the machine code executed by computers). Similarly, the file containing the source code is called the **source file**.

## Compilation vs. interpretation

&#x20;There are two different ways of **transforming a program from a high-level programming language into machine language**:

* **COMPILATION** - the source program is translated once (however, this act must be repeated each time you modify the source code) by getting a file (e.g., an .exe file if the code is intended to be run under MS Windows) containing the machine code; now you can distribute the file worldwide; the program that performs this translation is called a compiler or translator;
* **INTERPRETATION** - you (or any user of the code) can translate the source program each time it has to be run; the program performing this kind of transformation is called an interpreter, as it interprets the code every time it is intended to be executed; it also means that you cannot just distribute the source code as-is, because the end-user also needs the interpreter to execute it.

Due to some very fundamental reasons, a particular high-level programming language is designed to fall into one of these two categories.

There are very few languages that can be both compiled and interpreted. Usually, a programming language is projected with this factor in its constructors' minds - will it be compiled or interpreted?

![](https://3018064759-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LudO0LP3BbNbyBiBB3l%2F-MG0ftIWXXM4lEGrTAmE%2F-MG2eFh-LRmHurDqa2cC%2Fimage.png?alt=media\&token=9f8d365c-4138-47c5-9aec-aa23a23e89ee)

