responses are not always guaranteed to be accu-
rate. While these tools can generate code, modifying
them may require programming knowledge if they
do not work as intended. Therefore, learning how
to communicate with computers through program-
ming languages is still necessary.
2.3. Programming languages
Programming is defining a series of instructions for
the computer to do something for us. But, as we have
seen, we should use a programming language to de-
fine those instructions.
There are different types of programming lan-
guages, but we can broadly categorize them into
three main groups.
Machine language
This is the native language of a computer. Machine
language instructions are written in binary code,
which means they consist of ones and zeros. Fig-
ure 2-1 shows an example of a program written inmachine language, which adds the numbers 1234
and 4321. This list of ones and zeros contains all
the necessary commands and data to complete that
task. The right column is a continuation of the left
column (taken from: 1997 — Smith, S. W. — The scien-
tist and engineer’s guide to digital signal processing).
1OLLLO0L 00000000
11010010 10100001
00000100 00000000
1001001 00000000
00001110 10001011
00000000 OOO1TIIO
00000000 0000010
1o111001 00000000
11100001 00000011
ooo10000 11000011
10001001 10100011
00001110 00000100
00000010 00000000
Figure 2-1. Binary code representing the sum of
two numbers (taken from Smith, S. W.).
Assembly language
Assembly language was a significant improvement
over machine language as it made programming less
error-prone and faster. It uses a set of mnemon-
ics, which are short descriptive words representing
the instructions. Then, those words and instructions
are translated into machine language. However, onemajor limitation of assembly languages is that they
depend on the machine’s architecture, meaning that
the code written on one machine may not work on
another machine with different specifications. For
example, the following code shows how to add the
numbers 1234 and 4321 using assembly language
(taken from: 1997 - Smith, S. W. - The scientist and en-
gineer’s guide to digital signal processing).
Analyze
MOV CX,1234
MOV DS:[0],CX
MOV CX,4321
MOV Ds:[2],cX
MOV AX,DS;[0]
MOV BX,DS:[2]
ADD AX,BX
MOV DS:[4],AX
High-level language
In the 1950s, anew generation of programming lan-
guages emerged known as “high-level languages.”