PROGRAMMING LANGUAGES AND LANGUAGE TRANSLATOR

Programming languages are sets of commands and instructions used to create a program. It is an artificial language that can be used to control the behavior of a computer.

Generally, there are three levels of programming language: Machine language, assembly language, and high-level language

Machine language

This is the only language that is understood by the computer. Machine language is made up of instruction code written in strings of 0 and 1. The computer does not need any language translator to understand machine language.

Advantages of machine language

1. A computer user does not need any language translator to understand program written in machine language, hence, it makes for easy and efficient utilization of the computer system

Disadvantages of machine language

1. Time-consuming and irksome: Program could have thousands or millions of binary instructions. Writing such a program is monotonous and time-consuming.

2. Debugging problem: Putting 0 or 1 in the wrong place would cause an error. This error, however, cannot be easily traced since a machine-language program could have thousand or even million strings of 0 and 1. Hence, debugging is difficult.

Assembly language

Though the CPU only understands machine language, writing a program in machine language is difficult, if not, impractical. 

Hence, the need for a programming language that is very easy to use. This gave rise to the introduction of assembly language.

Assembly language is simply the mnemonic representation of machine language. Mnemonics are English words or symbols used to denote a long string of 0 and 1.

So, instead of using 0s and 1s for instructions, we used mnemonics in assembly language. 

For example, mnemonic ADD is used to tell the computer to add numbers. MUL tells the computer to multiply numbers in assembly language

Advantages of assembly language

1. Programs written in assembly language are executed faster than those written in a high-level language.

2. Due to the fact mnemonic is used in place of binary, debugging in assembly language is easy as compared to machine language.

3. Compared to machine-level language, it is easier to write programs in assembly language. This is because it is easier remembering mnemonic than learning strings 0s and 1s

Disadvantages of assembly language

1. As with machine language, assembly language is machine-dependent in that it is usually built for a specific computer. Plus, you must know how the CPU works to write programs in assembly language.

2. Programmers need to remember a large set of syntax and mnemonics. You will agree with me that this is not an easy task

High-level language

High-level languages allow the program to be written in a form that is easily readable and understandable by a human. 

A high level allows you to create a program without knowing how the CPU works.

The following are examples of high-level languages

  1. BASIC: Beginner all-purpose symbolic instruction code(BASIC) is a programming language created in the 1960s. It is used for teaching purposes.

  2. COBOL: Common business-oriented language(COBOL) was created in the 1960s. As the name suggests, this program used for business applications

  3. FORTRAN: Popular for its title as "the world's first high-level language", the Formula translator(FORTRAN) is mostly used for complex mathematical calculations.

  4. Pascal: This programming language, named after famous mathematician and physicist, Blaise pascal, was created in 1970. Pascal was created for teaching programming.

  5. Visual Basic: This programming language was created by Microsoft in the 1990s. It allows you to create windows based application.

Other high-level languages are C, C++, Python, C#. etc.

Advantages of a high-level language

1., Unlike assembly language, users do not need to learn high-level languages before they can use them. 

2. High-level language is easy to write as compared to assembly language

Disadvantages of a high-level language

1. Slow execution: Program written in a high-level language are slowly executed because they would have to be translated into machine codes before they can be executed

2. Though high-level programmer does not need to have basic knowledge of how the CPU works, However, they are still required to know a large number of semantics before they can successfully write a program. You would also agree with me that is not an easy task.

As earlier asserted, The computer only understands one language: machine language. This means a program written in assembly language or high-level language needs to be translated to machine language.

For this reason, a special program called language translator is used. A language translator is an intermediate program that translates a program written in one language to another language. Three language translators exist Assembler, compiler, interpreter.

While assembly convert program written in assembly language into machine language, compiler and interpreter is used to convert from high-level language to machine language. 

Assembler

This is system software that translates assembly language programs to machine language programs.


Interpreter

An interpreter is system software that translates high-level language into low-level language line-by-line.

An interpreter reads each line of instruction on a program, converts it to a machine instruction, and then immediately executes it. 

An advantage of using an interpreter is that it allows for faster error detection as it generates an error message immediately error is encountered, as opposed to a  compiler that only detects an error after scanning the whole program. 

The interpreter is not without its drawback. The overall execution time for interpreted programs is relatively slower than their compiled counterpart.

BASIC, Javascript, python are all interpreted programming languages.

Related post

Compiler

This is system software that converts the high-level program to machine language at a go instead of line by line. 

Compiler analyzes the entire code and then translates it to machine language. 

An advantage of using a compiler is that overall execution time for interpreted programmed is relatively faster than an interpreter

An inherent disadvantage of using a compiler is that an error is only detected when the whole program is scanned. Pascal, COBOL, C, C++, C# are compiled languages.

In short, while the assembler translates programs written in assembly language to machine language, compiler and interpreter is used to convert from high-level language to machine language. 

See you in the comment box 😁

Help us grow our readership by sharing this post

Related Posts

Post a Comment

Subscribe Our Newsletter