How to Talk to a Computer
One of the greatest inventions in the history of mankind, a computer which can efficiently handle and solve complex tasks that are nearly…
How to Talk to a Computer

One of the greatest inventions in the history of mankind, a computer which can efficiently handle and solve complex tasks that are nearly impossible for humans to complete. A great bunch of transistors and semiconductors are the basic hardware unit behind a computer which operates on electricity. The computer cannot work on its own, we must initiate the computer to perform a specific task.
How do we tell the computer to do something for us? Well a computer cannot understand human language of course, it only understands electrical signals. A voltage signal or not a voltage signal. Now the question arises, How do we interpret those mere electrical signals into something meaningful for us as well as for computers?
Here comes the concept of “Binary Number System” in which we represent commonly used and understood numbers which are called decimal numbers such as 1,2,3,4,5…..100 and so on, by using only 0 and 1. While being the core foundation of Computing, concept of using binary numbers to communicate with the computer hardware is not clearly understood specially among the students and is regarded as some sort of “magic” happening behind the scenes. In this blog, we would try to explain this magic in simple intuitive words.
Fundamental hardware component of a computer :
A transistor is the smallest hardware unit in a computer architecture (those which are widely in use today). It acts as a tiny “switch” controlling the flow of electrical signals. It can let the signal pass through the circuit or not. If it is letting the signal to conduct further it is known as in a state of “ON” otherwise “OFF”.

Graphical representation of states of a transistor/switch
Binary Number System :
We can represent numbers using binary number system where 0 in a binary sequence simply means to switch off the equivalent number represented by base 2 in that place of 0. On the other hand, 1 means to turn On i.e., include the number equivalent to the number represented by base to at the certain position of 1 in a binary sequence. For example the binary representation of number 3 is 0011, read it from right to left the first position is 2⁰ second is 2¹ third is 2² and fourth position represents 2³. The 1 at first position means we are to turn ON ( to include whatever equivalent value of decimal we can get ) the value at that position which is in this case 1 ( of decimal system ). The second position 1 tells us the same story but now the equivalent value (2¹) is 2. Third and fourth position values indicates an OFF signal telling us not to include whatever values present at those positions. Now we add up our values that are indicated as ON and get an equivalent 3 of Decimal system. This intuition is represented graphically below.

Representation and intuition of decimal number 106 in equivalent binary number
Logical Representation and operations :
These conceptual binary numbers are called as “Bits” in terms of computing. Using Binary Number system, we can give some meaning to the ON/OFF electrical signals to represent numbers. The computer is still processing those ON/OFF voltage signals but we have labelled those signals into some meaningful and useful information for us.
By combining various transistors into different ways, we can achieve some great operations which further enable the computers to perform various tasks. By connecting transistors in series we can achieve logical AND operation , by combining in parallel, we can have logical OR operation, and so on.

Graphical representation of logical AND & OR gates along with their respective truth tables
There are other types of logical gates which are formed by various types of combinations of transistors such as Not Gate (Inverter), Exclusive OR and AND ( XOR & XAND). These gates allow the manipulation of electrical signals in various forms which are further used to perform powerful operations besides arithmetic, the concept of memorizing / remembering the data ( sequence of binary ) by memory of a computer is achieved by combining these gates such that they perform the required function.
Communication with Computers :
Since we know computers only process electrical signals or we can say logically they understand binary numbers 0 and 1. Now the question is how do we provide those signals to the computer hardware? Do we manually turn various switches ON/OFF ? Of course not, it is practically impossible for humans to simulate this job. So there is a need of a way, a mechanism or simply a language through which we can communicate with the computer. Can we use logical Bits 0 and 1 directly and let the computer process their meaning ? This is also practically not feasible. So we need some kind of a language/languages which we can use to communicate with the computer. Such language/languages are formed using “Formal Language Theory”
Formal Languages :
A theoretical concept used to define languages through various set of rules. There are different classes of formal languages used in different aspects of Computer Science. Formal languages provides set of rules by which we can create “programming” languages which can be further used to communicate with the computers. A lot of indirect steps just to have some conversation with a computer. We need formal language concepts to define a “grammar” also known as “syntax” for a programming language. Just as in natural languages, there are some rules called grammar to form any sentence so that it makes “sense” to its listeners and speakers.
For every class of formal language we have a hypothetical machine called “Automata”, which we can use to check whether the given sentence of a certain language is according to the rules of that certain language i.e., is it syntactically correct or not. In natural human languages, each word has a specific meaning and collection of such words form a sentence which conveys a meaningful message. Likewise, the expressions, statements, words of a computer language also carry specific meaning but still the computer is not capable of understanding those mere words.
While formal language theory plays the main role in designing a programming language, they are also used to check the correctness of the words of the language. Programming languages go through a series of various steps where they are checked and are broken into parts until they reach their equivalent binary code. That binary code is processed(understood) by the computers. Concepts of formal languages play crucial role in conversion of a computer program safely into its binary equivalent.
G is a grammar containing set of non-terminal symbols, terminal symbols,
start symbol S, and production rules set P respectively in the following
tuple:
G = ({A,B,S},{x,y},S,P)
p = { S -> AyB | λ
A -> x | B
B -> xy | yS }
This is an example of a "Context-free grammar", where S ∈ expression*,
A,B ∈ expression ∨ statement, and x,y ∈ operator ∨ identifier used in
practical programming languages.
This is an example of a formal language with few production rules. These rules can be used to generate words of a language and those words can be verified through an equivalent pushdown automata since it is a context-free grammar.
Low level programming languages :
In early ages of computer invention, low level languages were widely in use they are named so because of the fact that they provide access to the computer hardware resources at a very lowest level e.g., memory, registers. The programmer has a strong command over the computer hardware and can manipulate it/talk to it powerfully. For example, a programmer can use, keep track of usage and allocation/de-allocation of memory freely as he want but of course within a defined set of boundaries. Using low level language provides a programmer with an opportunity of talking to a computer without any additional layer/barrier between them. A programmer can understand the execution of instructions at a very deep/low level. Such an example of a low level programming language is “Assembly”.
;Bubble sort algorithm in assembly
[org 0x100]
jmp start
outer:
cmp si,12
je end
add si,2
mov di,0
jmp inner
inner:
cmp di,12
je outer
mov ax,[bx + di]
cmp ax,[bx + di + 2]
jns swap
jmp noswap
swap:
mov dx,[bx+di+2]
mov [arr + di + 2],ax
mov [arr + di],dx
add di,2
jmp inner
noswap:
add di,2
jmp inner
start:
mov si,0
mov bx,arr
jmp outer
end:
mov ax,0x4c00
int 0x21
arr: dw 8,5,9,3,2,4,0
The above code segment is an example of 16-bit x86 assembly language for sorting elements of an array in ascending order using a simple logic known as bubble sort. While this language contains keywords which are conventions for English words but it uses both registers and memory to perform some task and is not really convenient in readability and also in writing.
Middle level programming language :
It is often referred to the programming language which is neither a low level nor completely a high level such a very famous and widely used example is “C language”. In terms of reading and writing, it is completely different from assembly. C language does not provide any kind of control over registers but they provide great control over memory and a programmer can manipulate it according to need freely.
//Bubble sort algorithm in C
#include <stdio.h>
int main()
{
int arr[] = {8, 5, 9, 3, 2, 4, 0};
int si = 0;
int di;
int arrlen = sizeof(arr)/sizeof(arr[0]);
while (si < arrlen - 1)
{
di = 0;
while (di < arrlen - 1)
{
if (arr[di] >= arr[di + 1])
{
int temp = arr[di];
arr[di] = arr[di + 1];
arr[di + 1] = temp;
}
di++;
}
si++;
}
return 0;
}
This C code snippet is an equivalent of previous assembly code. As we can see this code looks very structured and short, easy to understand as compared to the assembly code. As we move up to the higher levels of programming languages, the code becomes easy to understand and write.
High level programming languages :
These languages are widely used today for developing applications and various other tasks. In such languages, we do not have great command over computer hardware resources and there are various “layers of abstraction” between the programmer and the computer
#Bubble sort algorithm in Python
arr = [8, 5, 9, 3, 2, 4, 0]
si = 0
arrlen = len(arr)
while si < arrlen - 1:
di = 0
while di < arrlen - 1:
if arr[di] >= arr[di + 1]:
temp = arr[di]
arr[di] = arr[di + 1]
arr[di + 1] = temp
di += 1
si += 1
The above code snippet is Python version of our example. How short and easy to write and understand it is, this is the ability provided by high level programming languages.
Abstraction :
Abstraction means to hide the implementation / actual working details and provide only the relevant information needed to do a certain task. In our case of lower to higher level programming languages, the level of abstraction increases i.e., the programmer does not have to care about managing the resources at a lower level.
What and How, the difference :
Higher level programming languages let the programmers understand what is happening i.e., what actually the written code means and for what purpose it is used but it fails to let them understand How the code is doing what it is supposed to do. While low level languages let us understand in very detail step by step the execution of instructions and how actually the code communicates logically with the computer and conveys our message so that the computer understands it and process the equivalent electrical signals ( logical bits ) and that is how our task/tasks are done by the computers.
메타데이터
- post_id
- dd0e357866db
- slug
- how-to-talk-to-a-computer-dd0e357866db
- url
- https://medium.com/@mtalal0954/how-to-talk-to-a-computer-dd0e357866db
- canonical_url
- https://medium.com/@mtalal0954/how-to-talk-to-a-computer-dd0e357866db
- author_url
- https://medium.com/@mtalal0954
- status
- ok
- fetched_at
- 2026-07-24 19:02:38