How does a programming language work?

Perhaps they have already seen old music machines, which sound different musical instruments controlled by a pen roller or a perforated strip.This can be described as a precursor to today’s computers. The most important difference between these machines and the computers is that the program of these mechanical automata, i.e. the score in the form of pens or holes, is always linear. A given melody always sounds the same. Computer programs, on the other hand, may contain so-called branches. That is, where, depending on the value of a memory content, either one sequence of commands or the other is executed. All the intelligence of the computers is made possible by this peculiarity.

The two have the binary code together.As is well known, computers only work with zeros and ones, which are represented by electrical or magnetic states. music machines in principle, whereby the two states are connected by absence of a pen or hole.

In the language of the computers one would say that the arrangement of the pens or holes of the automatons represent commands to the mechanical musical instruments.Beat the timpani! Play a C major on the piano! Etc… Computer commands are something like: Get a value from memory! Add it with a different value! Save the result in memory! If the result was greater than zero, continue with this command, otherwise with that! (this is the branching already mentioned).

A program consists of thousands or millions of such primitive commands.Developing programs is extremely tedious, illustrative and error-prone. And this is where our programming languages – more precisely “higherprogramminglanguages” – finally come into play.They are clearly removed from the primitive machine commands in abstraction and complexity. For laymen, they still look very cryptic, but programmers can use them to express complex logical relationships with little text.

Similar to a recipe, you define which ingredients (data in the form of numbers, texts, etc.) are needed to complete a task.Then you describe step by step how these have to be processed until the “court” is ready. Such sequences of instructions are called algorithms.

One task might be, for example, “Create an organization chart from personnel data”.A programmer would define data structures in his programming language that allow him to represent lists of people. He would develop algorithms that would create a tree-like data structure that corresponds to the company’s hierarchical organization. In a further step, he would develop a graphical representation from it by calculating the position of small rectangles and connecting them to lines.

I hope that with this example I was able to give an impression of what can be expressed in a programming language.

That is all well and good, but the computer chips do not understand higher programming languages.They really only understand their zeros and ones. Special programs, so-called compilers, must ultimately produce the primitive machine commands from these program texts and produce almost endless sequences of zeros and ones…

Leave a Reply