How does a computer already know certain words?

I understand that certain terms and words make a computer do certain things but where do those words get taught to the computer? If they are somehow pre-coded in, then what language is used in the scenario to teach it that language?

2 Likes

It really depends on how far back you want to go to think about it! All programming languages have been built on some other language to fit different purposes and to be more useful in different ways. For example, Javascript was built using C++, however C++ was built using C. Python was also built using C. C was developed way back in the 70’s and was actually built on the Unix operating system. You can do this all the way back to the first computers that operated using switches to literally input what you wanted in binary language, the language that computers speak.

So when you are using something like python, and the computer understands words such as return, in, or and and, this is because someone used C to program these words to have specific meanings for the context and to perform specific operations. Someone 60-80 years ago had to build the first programming language to use binary, but since then it’s been an iterative process, with each language building on top of another (usually some version of C) and then resulting in the wide variety of languages we have today.

You could build your own new programming language based on something like C++ yourself now, however it would have to serve a new useful purpose as we already have so many languages that you’re usually better just writing functions for your purposes.

11 Likes

Hi, and welcome to the Codecademy forums!

A CPU has something called as an instruction set. An instruction is basically a series of binary codes which when given to the CPU can tell it perform certain tasks. A task can be something simple like adding two numbers or something more complex like moving data from one register to another. By using all of these instructions, we can “create” another set of instructions which may combine one or more instructions to provide more complex functionality. Thus we have created our own programming language!

In the very early days, instructions were written in binary i.e. 0s and 1s. However since we humans cannot read binary directly, we later started writing instructions in hexadecimal so the instructions became somewhat readable. Later, assemblers were built. An assembler is basically a compiler but for assembly language. This allowed us to write instructions in human readable language and we started using words like mov, add, sub, mul, etc. to represent instructions. Thus the levels of abstraction kept on increasing and programming languages kept on getting simpler.

As mentioned by @adamgaffney96 , the earliest well known high level language (as compared to assembly language) created was C. This laid the foundation for many other languages as we know it today.

Fun fact: do you know C language was written in C?
A basic compiler was built using assembly language which was “just enough” to build the remaining C language using the C compiler built so far

If you are interested in learning how assembly language works, I highly recommend you to check out this series by Ben Eater on YouTube. He explains how assembly language actually works.

If you have any doubt, please feel free to ask. I’ll try and answer.

Best regards,
Sanyog Jain

4 Likes

thanks guys, I’ve been wondering that for a while @adamgaffney96 @sanyog_jain

2 Likes