Friday, October 28

CHAPTER 6: LANGUAGE OF THE COMPUTERS - INTRO

In this blog post, we will look into the language that is use in computers. Roughly, computers have 2 major types of programming languages - low-level and high-level.

The Central Processing Unit (CPU) of a computer reads a computer programming language known as the machine code or machine language. Machine language are known as low-level language. The term "low" is represented because they are very close to how different hardware of the computer communicates with each other. It does not need any conversion or translation to execute instructions set.

Picture source: https://www.learnnpractice.com/generation-programming-languages.html
Machine language is a type of computer programming language that consists of binary and hexadecimal instructions which can be executed directly by the CPU. It is also the only language computer hardware understands. However, the binary notation are hard for humans to understand.

Even though low-level languages do not require any compiler to translate the instructions, some do need a simple processor called "assembler" to convert it to machine code and that is known as Assembly Language. Assembly language makes machine language more readable to humans. Instead of using long binary notation, assembly language uses a set of symbols and letters. Low-level language are categorized into first-generation and second-generation programming language. Assembly language is the second-generation as it no longer use 1s and 0s to write instructions.

Picture source: http://www.slideserve.com/karlyn/machine-assembly-language

Now for high-level language. High-level language are much more understandable to humans as it uses English and mathematical symbols in its instructions. Programming language is often referred to high-level language as it is mostly used by programmers nowadays such as C++, Java, Fortran and Python.

Being a low-level language, both machine code and assembly language are hardware specific and not portable. Meaning, the program can only be run on one specific computer and needs to be modified to run in other computers. 

Where as high-level language, they are portable and hence, are able to run on multiple computer system without modification. However, modification may be necessary due to different operating systems such as  for Windows which are typically different for Mac.

Unfortunately, high-level language is not directly understood by computers and needs to be translated into machine code. There are 2 ways to how it can be translated which are either compiled or interpreted. 

Compiling is a translation of the whole set of instruction into machine code as a compiled code (such as an .exe extension), prior to the insertion of input data during execution. Simply said, the result from compiling can be run as many times afterwards without having to compile them again. Example of compiled languages are C language and its derivatives - C++ and C#, COBOL and Fortran.

Interpretation on the other hand means the high-level program is interpreted line by line to produce an output data. Therefore for every execution, it is required to interpret the code again and again as there is no compiled code to use. Example of interpreted languages are Java, Perl, Python and Ruby. 

Alright, that's all for the introduction! Hope all the terms are well-written out.

Do comment if you have any doubts as we are all still learning as well! Til' the next post, keep computing! ;)

References:

Source 1
Source 2
Source 3

1 comment:

  1. Compact and concise, again, very helpful! Thank you 👍🏻

    ReplyDelete