Beyond awesome | 越而胜己

How do computers understand instructions given by human?

A computer speaks machine language, 0's and 1's. When a computer "thinks", it thinks with 0's and 1's. So at the very first, programmers use punched strips of paper to give the computer orders. But most human beings just don't like to speak in binary. So the Assembly language was invented. The Assembly language is the machine language in a more readable format. But the computer can't read Assembly code directly, so an assembler is used to translate it to machine language. Here's some sample Assembly code:

data segment
tab db 'hello world$'
data ends 
code segment
assume cs:code, ds:data
mov ax,data
mov ds,ax
lea dx,tab
mov ah,9h
int 21h
mov ah,4ch
int 21h
code ends
end start

But the Assembly code is not easy to be understood as well. Now programmers have high-level programming languages. High-level programming languages are based on human languages, mainly English. Therefore, people can learn to program without having to remember a lot of abstruse Assembly codes. Some of the most popular high-level programming languages are C++, Java, etc. A compiler helps translating the high-level programming language into assembly code, then the assembler translates the assembly code into binary. Then the computer will understand the instructions given by human. Now new programming languages are invented every year.

You’ve successfully subscribed to Skyward
Welcome back! You’ve successfully signed in.
Great! You’ve successfully signed up.
Your link has expired
Success! Check your email for magic link to sign-in.