Assalamu Alaikum, I hope everyone is well, although I am not a regular writer of Sizan Tech, I try to write about something that I like when I learn something new. Moreover, writing for other blogs or for some other work is not regularly written here. But today I got an answer to a long-old question that I could not write about. Many people like me may have the question that if a programming language is written with another programming language, how did the first programming language originate?
programming language
Programming languages are not actually written. What is written is a compiler or translator.
A compiler actually does the job of making different codes written in a language understandable to a particular model of processor. You are asked to write programs as the compiler understands a language.
compiler
Now since the compiler itself is a software program, it has to be written. Suppose, Java is a language, its syntax is fixed for human convenience. Now that you write something in Java, it needs to be translated to make it machine readable. You can write this translation program in any language.
Now for context, remember that Fortran was an early programming language that had no compiler. At that time, you write some code on a white paper following the keywords and syntax specified for that language. The language is there, the code is there, but there is no translator. Then the computer will not understand that code. That's the problem we're referring to in this question, isn't it? How a computer will understand a program written in the first programming language!
How a computer will understand a program written in the first programming language
The answer is that in the early days (1946-1960) translation was not done by a computer program, but by humans. That is, man himself was the translator or compiler. The job of programmers was to solve problems by writing code by arranging logic, then writing code accordingly. And the job of compilers was to take a list and translate it into machine code. That's why the compilers of that era -
- The keywords and syntax of that language had to be known.
- Had to know processor specifications.
- One had to know the technique of translation into machine code.
- The machine code had to be loaded and run on the punch card.
- I had to work all night and report in the morning.
Coming to that story later. But before that we will try to understand the matter a little deeper. For that we want to know what a program actually is. Machine code or something that does not need any translation, the machine can understand him as soon as he reads it! For that let's go back 20-30 years from today. I mean I am talking about 1990-99.
Concept of machine code
Many of you may have seen the popular entertainment medium of the 1980s-90s, the cassette player . Even if you don't see it yourself, you will have heard about the cassette player. See the picture below.
Cassette tape. Image source: google.com
Now think about how a cassette player works. Think for yourself. Then follow the steps below-
- The signal is engraved on a long ribbon inside the cassette. Think of these as machine code.
- When this cassette is inserted into the player, a mechanical motor starts pulling the tape from one side.
- As the tape moves from side to side, a reader is able to sequentially read the signals etched into the body of the tape.
- According to what the reader is reading, the electrical signal goes to the microphone of the cassette player.
- Then in the presence of an electrical signal, the mic converts the electrical energy into sound by vibrating a vibrating magnet with electricity.
became diameter Do you see programming here anywhere? No, there is no programming here. However-
- A standard financial technique, albeit of a very primitive type, was used to write the signal onto the cassette tape.
- And the tape speed of the cassette is also very specific. That means a fixed amount of data is read from a cassette tape at a fixed time with the help of a cassette player.
The CDs or DVDs that we have used since then work in essentially the same way. They were based on rather older ideas. But he goes back to the cassette anyway.
The characteristic of the cassette reader head is that it can produce light-heavy electrical signals according to the location of the cassette while tracking the cassette tape. The function of this device is to conduct the current of power as it is felt by touching the ribbon.
Then creating an electrical signal - only that signal goes to the circuit connected to the head. At the other end of the circuit is the mic, from where the sound is generated.
That means that the signals written on the tape are being read in sequence, and almost instantaneously they are being fed into the speaker on the way to the head, meaning that the magnitude of the power received by the speaker is essentially being controlled from the cassette.
Here signal reading, signal sending, sound generation, all are done in analog mode. The entire process is accomplished by coordinating the different functions of several different devices. There is nothing to program, the devices are connected as is.
computer signal
A computer is a machine which, when turned on, will continue to read one byte (actually a bit more) from a row of data-signals stored in a certain place and send those data-signals somewhere with the help of electrical circuits. But that computer does not know what will happen by sending in this way, it just automatically reads one signal after another, and while reading it, sends it to a specific device.
As I said so far, there is not much programming here, right?
Now back to the cassette player. Now consider the cassette player to be a slightly more advanced species. That means it has two mics on the left and right. Cassette is only one. In this case, the reader device of the cassette player sends one of the readings from the cassette tape to the left mic and the other to the right mic. Then again sending one to the left, and the other to the right. This is how stereo sound is produced.
Does he have to understand programming for this? not at all It is only told to read and send signals. A filter in the sending path divides the signals to the right or left. Very straightforward matter. Seeing something within the signal can automatically split the information in two different ways.
Think about machine language
None of you should have any problem understanding this far. Now let's complicate the problem a step further. Now you can think of three or four mics at once.
Or suppose all four devices don't have mics . Rather the 4 divas include-
- two mics,
- A memory, r
- An equalizer display
If you can somehow convince the cassette reader that, in what he will read—
- A block will send to the left mic,
- will send the other to the right mic,
- Furthermore, the equalizer will send all of them to the display,
- And if memory is switched on, it will send all to memory as well.
And there are two volume regulators on the signal path to the two mics. With them, the volume of both mics can be controlled independently.
In this condition, the experience of listening to music will be much better than before. But you must realize that the cassette reader doesn't need to show any special programming skills to gain this extra control. Only if a particular road is open at a particular moment will the signals go that way, not if the road is closed. Accordingly, different tasks (or sets of tasks) will be completed at different times.
On the other hand, if you talk about the computer, it also has a reader, a microphone, and many other different types of work tools. These devices
- which may produce sound,
- Which adds up mathematically,
- which lights the lamp,
- Which trigonometric function,
- which again sends a numeric value to memory,
- which may send to disk,
- etc.
Operation code or opcode
The extra stuff in the machine code of a computer program (compared to the cassette) is called operation code or opcode. That is, the signals that the computer is asked to read sequentially contain two types of information.
- Some have opcodes, which mean what to do now. Various roads will open or close accordingly.
- And there is some information. These are meaningless values. The opcode will decide where to send this meaningless data.
The opcodes are all the same lengthwise, but their values are different. As soon as the opcode is read, a specific path is opened among all the paths connected to the reader according to its value. At the other end of that path is the machine that does the appropriate work for that opcode.
- So the opcode tells you which path to open.
- And then there's the data, which means what to send on the currently open path.
This is done, there is no programming here either. Just reading data at a certain speed and sending that data to one of many paths.
All in all, this is the same cassette player. right? But the opcodes are as per the processor specification. And thus the ability to dynamically control paths with opcodes (along with the ability to apply some other digital logic) is what we call a programmable device or computer.
What is programming!
Now let's take a good look at what programming is! Again, think of cassette tapes.
Now if you can write such a large number of opcodes and data in a row on a long cassette tape, that is what we can call a program.
At the lowest level, the computer's comprehensible instruction or program language is a sequence of encoded signals. Apart from this language as a programming language there is nothing to write, nothing to compile.
There is only one specification. The processor will understand only if arranged accordingly. Whatever is written on the tape, a particular type of processor interprets that information as a specific instruction.
The processor will take the data from there, and send it to someone according to the processor's specifications. There is no programming language to be used here either. What you need to understand is:
- Which device you want to send the key to and
- How do you want them to communicate to the processor, that is.
You don't have to be a programmer to do this, however
- The processor needs to know,
- The computer needs to know,
- You have to know what you want to do.
- Then they should be arranged and written on the tape of the cassette.
This is called machine language . It is the lowest level programming language. Computers themselves can still only understand this one language.
Modern computer
Modern computers do not read a program directly from a cassette player or hard disk. First, the program is loaded into memory, then the program instructions are read one after the other. The opcodes of this program tell the program whether to take data from it, or read from somewhere else, and where to send it. The rest of the work is done according to the quality of the connected electrical circuit. Just as a computer can send data in many directions, it can also read from many sources.
Computers do not multitask. Rather, when the road is open depends on where the information will go and from where it should be read. That is, between sending somewhere and bringing it back (can't bring it), an event will happen in between, i.e. addition or multiplication will happen or sound will be generated. There is a separate device (hardware) for each task, and each device is assigned a numerical address. The computer does not know what to do with the information to whom it is sending it. Its job is to send the information where it was supposed to be sent according to the instructions of the program.
program
Now this string of aligned instructions, this is a program. You don't need to know any language to write it. All you have to do is know how a processor recognizes a number. If any person has studied a little about that processor, then he will write only numbers and numbers on such a long tape and send it to the computer reader. Programming was also done, the computer was explained and made to work. Computer works in this language. The birth of this language actually means the design of a processor . Its name is machine language. Just like the sequentially engraved signals on a cassette tape.
compiler
A high-level programming language based on this you can write however you want. But you have to write a compiler to convert the program written in that language into computer language (machine code). The compiler is not for running your program, but for converting your program into computer language. In the fifties, these translation works were done by people themselves. They were then called compilers. Later the compiler itself became a separate program.
memory
Now back to the cassette player. Suppose your cassette player can read signals from two cassettes simultaneously. Remember, at first he didn't do much with the information he read from a cassette, just stored it in stages on a memory stick. There is no restriction to store in the memory, just send it to the memory instead of sending it to the mic. But let me tell you the reason why it was stored in the memory.
The problem with cassettes is that you always have to read in the same order. It is difficult to jump from one place to another. Anyone who has changed tracks while listening to a song on a cassette player knows. But if you keep it in memory (actually Random Access Memory) you can later quickly jump to any place in the memory and read from there. Each cell of memory has a different address, memory has its own gateman (guard). If we tell him R 20034, he stupidly associates the exit door with room number 20034 and says - here it is. And if I say W 20040 5534, then it opens the entry to cell 20040, so 5534 is written there. However, one of our cassettes was copied to one such memory. Now it's time to read from another cassette.
As usual, instructions, data, addresses are coming from the cassette one by one and the stupid player is reacting accordingly. Assume that there are some opcodes that ask to read something from memory. Now see that one program starts fetching data from another program stored in memory. If you want, you can use one program to shuffle every bit of information from another program and put it back in memory. If you can keep it in memory, you can also keep it on disk. You can read from there and insert it into the memory again. That's what the compiler does .
The program you are writing in any Uchumann language is actually a string of data that we can read in plain language. And through a specific cassette, I can convert it into a program. Then you have to prepare a cassette to make the computer understand the first program you write in whatever language you write it in. The first thing you must do is hold her hands and feet. You have to write all the steps of the instructions on the cassette tape, in exactly the language that the computer can understand on its own.
Finally
I hope I have understood, I will try to read it myself later and write it in a simpler way. But we all know one thing, the early languages had very few understandable words for humans, so simple conversion tables had to be memorized to translate them. As I said before, once these translation works were done by people themselves and those people were called compilers, and almost all of them were women.
The programmers used to sit all day and write programs in some primitive language, writing on paper, far from catching a computer, they were not allowed to enter the room where the computer was. He used to write programs in notebooks all day and in the evening he would bring them to the compilers. Compilers used to convert them into machine code by looking at charts, then put that code on a punch card, then tell the computer (modern cassette player) - read, you will understand what to do, and the result should be shown on a display.
Punch card. Image source: Wikipedia
So the summary of all the words is-
- The first language is machine code, which computers always know. Computers are designed that way. No other language was needed to write this language, not yet. By looking at the specifications of any processor, arranging byte by byte instructions and leaving them to the computer will work.
- Outside of machine code, the first language (or languages) used by humans had nothing to write. They are just languages for communicating the thoughts of programmers with compilers. Just make a dictionary for him.
- Everything is still based on such a dictionary. Only compilers aren't what they used to be. Whatever language you write in will eventually be translated into machine code.
- A programming language is not a program itself. It's just a grammar. Now another program or human can take over the task of converting your written code into machine code following that grammar.
If you like my writing then you can visit my small site. It means a lot!