Quantcast
Channel: Tweaks
Viewing all articles
Browse latest Browse all 66

Compilers, Assembler and Machine Code. Are they same?

$
0
0

Programmers and Consultants very frequently use Compilers and Assemblers jargons. We even interchange the usage as per our convenience. Are compilers, assemblers and machine code synonymous to each other? Unfortunately, No.

Are you one of the culprits who use these words to impress others? 😛

Let us take a step back and look into the history of the development of Programming Language and computer. We all know there are some generations of Programming Language.

1. First Generation Language (Machine Code)

Machine Codes are the First Generation Language which the Computers use. The first computer developed in the USA in Feb 1946 was as big as a standard living room (actual image below) and could only perform the calculations which the present day pocket calculator does. The first computer which was christened as ENIAC (Electronic Numerical Integrator and Computer) was popularly called the “Great Brian” by the then media/press.

Electronic Numerical Integrator And Computer

The first computer could be programmed in only one language i.e. machine code.

With the advent of other programming languages, are machine codes extinct?

No. Computers of even this day understands only machine codes. So whatever programming language you use, at the end when it communicates with the computer, it only used machine codes. As Computers only understand Machine Codes.

001D4680, 70143048, 30FC95F9 are some example of machine codes. Terrifying codes. Isn’t it? Now do not ask me what does it mean. 😀 I am not a computer. 😛

Do all computers talk the same machine code?

No. Every machine has its own machine code. The machine code depends on the processor used in the machine. You can say machine code is processor dependent.

For your curiosity, machine codes only use registers and distances(offsets). They do not use names for the variables.

Ex: ‘D202 5022 7089’ in S/370 Assembler means 3 Bytes addressed through Register 7, offset 89 has to be moved into Register 5 offset 22.

Also Read: Back to Basic

2. Second Generation Language (Assembler)

The first generation language was not user-friendly They were not easy to remember and understand. To surpass the problem, someone proposed the idea of replacing the machine codes with symbolic names covering one instruction each. They are called ‘mnemonics’.

In the second generation language, it became possible to use Symbolic names for the variables along with the first generation Registers. Offsets, i.e. distances were still supported but the system was able to partially calculate these distance by itself.

This mixture of first generation language along with symbolic names and auto calculation makes the second generation of computer language i.e. Assembler.

As any invention, the primitive (first release) Assembly language was not that advanced. But it made a very important introduction i.e. the idea of translating one language into another (symbolic commands to machine code). This concept is still used till date in each and every single computer system.

In an assembler, the translation of one language into another is done in the relation 1:1 (one is to one). What is typed into the machine by the programmer is exactly what is executed later.

Now the code ‘D202 5022 7089’ and command ‘MVC AFELD,BFELD’ do the same thing of moving couple of bytes.

3. Third Generation Language (HHigh-LevelProgramming Language like BASIC, COBOL, FORTRAN, C, PASCAL, PL/1, Ada)

The second generation Assembler was user-friendly. Then somebody got the idea to collect few commands into one command and make up a whole new language. Few sharp brains implemented this philosophy and thus the birth of programming languages like Ada, BASIC, C, COBOL, FORTRAN, PASCAL and PL/1 happened.

Now we needed a Compiler. Please note, Compiler and Assembler are two different things. Assembler has 1:1 relation while Compiler has 1: N relation depending on the language.

Let us clarify it a little more.

By now, many programming languages were developed but the computer still understood the machine code only (even till date computers only understand machine codes). These programming languages now need to be translated i.e the command needs to be translated into more assembler commands or machine code instructions. So the new name was coined to this translator to separate it from the earlier translator (Assembler) which only did 1:1 translation. It was christened as Compiler.

Compiler – 1: N Translation

Assembler – 1:1 Translation

Compilers can translate multiple languages to machine codes.

Also Check: Interesting details of Application Server

4. Fourth Generation Language (4GL)

Although the third-generation language became user-friendly, we needed to instruct how to do a certain task the In the fourth generation, there was one step up. The idea was to tell only which task is to be done. This technique came to be known as ‘Non-Procedural Programming’. The popular 4GL are ABAP/4, AS, CSP, DataFlex, Natural, Oracle etc.

You guessed it right. All generations before 4GL were Procedural Programming Language.

Let us not confuse fourth generation languages with fourth generation SYSTEMs. Systems are much more powerful. Systems have data dictionary, program generator and also tools for knitting different applications to one single application.

5. Fifth Generation Language

The Artificial Intelligence Systems can be programmed in an easier way. The 5GL are AI Languages. LISP and Prolog are two most popular AI languages.

Summary:

1GL were machine codes.

2GL were machine codes in symbolic language. Assemblers (1:1).

3GL were Procedural Programming. Tell the system how to do (collection of commands to create a whole new command). Compilers (1:N). Example BASIC, FORTRAN, C etc.

4GL were Non-Procedural Programming. Tell the system what to do. Example ABAP, Oracle, DataFlex etc

With SAP giving stress on Machine Learning, Artificial Intelligence, and IoT (Internet of Things), we at SAPYard thought of doing some homework on basics of Programming Language History.

We are sure, you all already knew about it but still, we wanted to do a refresher for all.

Do you have anything to add?

Please feel free to comment, criticize, encourage and provide your feedback. If you have some stories to tell, please do not hesitate.

Please browse our page for FioriSAPUI5ODataHANA-ABAPOOPsWorkflowWeb Dynpro etc tutorials.

Please Subscribe, Like & Share our Page


Viewing all articles
Browse latest Browse all 66

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>