Introduction

What is the purpose of using a computer? If we ask this simple question, we will realize that we use it to do tasks. But those tasks are done using computers because of their ease of use. For example, we do our assignments or document our work using various programs like Microsoft Office, OnlyOffice, LibreOffice, Google Docs, etc. Well, those are programs or applications we use. Those programs or applications are made using programming languages. As humans, we speak different languages. Similarly, there are different programming languages. But why are there so many different languages? Won’t it be easy if there is only one programming language? Well, it surely would be. But different languages have different strengths and weaknesses. Some languages are better suited for front-end development, others for back-end development, still others for application development, and so on. 

Talking to the computer

Now, if we think more deeply, the question will arise: how can computers understand our languages? In simple words, it doesn’t understand our languages. It only understands its own language. which is machine language. Programming languages come into play here. Programming languages are like an intermediary. Think of it as when we try to speak with a person who speaks a different language; someone who understands what I say and what the other person says can do the intermediary task of translating it between the two people. Similarly programing languages do the same job between us and the machine. We write in a certain programming language, which a compiler compiles and translates to machine language to do what we have ordered it to do.

Elements of language

Like anyother languages, whether it be programming or human language it has follow language elemants. Which are:

  • An alphabet is a set of symbols used to construct words in a specific language (e.g., the Latin alphabet for English, the Cyrillic alphabet for Russian, Kanji for Japanese, and so on). If we translate it into programming, a program needs to be written in a recognizable script.
  • A lexis (also known as a dictionary) a collection of words that a language provides to its users (for example, the word “computer” appears in the English language dictionary, but “cmoptrue” does not; the word “chat” appears in both the English and French dictionaries, but their meanings differ). For programming each programming language has its own dictionary, which you must learn. Fortunately, it is much simpler and smaller than any natural language dictionary;
  • A syntax is a set of rules (formal or informal, written or intuitively felt) used to determine whether a particular string of words forms a valid sentence (for example, “I am a python” is a syntactically correct phrase, whereas “I a python am” is not). In case of programming each language has its rules and they must be obeyed;
  • Semantics a set of rules that determines whether a phrase makes sense (for example, “I ate a doughnut” makes sense but “A doughnut ate me” does not). In case of programming the written program has to make sense.

Types of execution

Now we assume that we learned a programming language and followed the mentioned elements to write a programm. The written text and files for the program can be noted as the source code. There are two different ways of transforming a program from a high-level programming language into machine language. One is called compilation and interpretation.

Compilation

The source program is translated once. However, this must be repeated each time modifications are made to the source code. After compilation, a file or multiple files are generated containing the machine code. Now you can distribute the file or files worldwide; the program that performs this translation is called a compiler or translator.

Interpretation

Any user of the code can translate the source program each time it needs to be run; the program that performs this type of transformation is known as an interpreter, since it interprets the code each time it is supposed to be executed. It also means that you cannot simply distribute the source code because the end user did require the interpreter to run it.

Summary

To summarize the whole procedure, we can say that to do a task on a computer, a program or application is needed. That application or program is a product of a written text file using a desired programming language. Those written text file or files are converted to machine-readable form, also known as “binary.” That binary can be executed to run that application.