Low Level Programming Languages | Assembly level language

Spread the love

Low-Level-Programming-language-assembly-language-examples

Introduction:

There are different types of programming languages like low-level and high-level programming languages. In this Article, We are going to discuss about the low level programming languages.

Low Level Programming Languages:

                   Programming languages which are in the symbolic format are called  as Low-level programming languages. The Symbolic format means usage of hardware specific mnemonics. 

Languages like Assembly language uses the Mnemonics like ADD, SUB, MOV, jmp,  etc. These languages are called Low Level Languages. And low level languages are very hard to learn and understand. 

Low level Languages also hardware dependent. The code you wrote for one hardware chipset won’t work for other hardware. So you have to re-write your application again for new hardware. The low level languages are not portable

Most of the modern programming Languages like Python, Swift, etc. Which looks very close to the English language are called High level languages. We can easily learn and master these high level languages and these languages are portable as well. For more information on High Level Language please check following article – High level programming language

Key Characteristics of Low Level Programming Languages: 

  • Low level programming languages are in the form of mnemonics like sub, add, mov, jmp, retq, popq, and etc.
  • Maintaining code, writing, debugging the low-level code is not easy compared with High level languages code.
  • Low-level languages are Hardware dependent languages we cannot reuse code write for one hardware platform on other hardware platform. So these languages are not portable.
  • Assembly level language is best example for low level programming language

Translating Assembly language in to Machine language:

The low level language code is close to hardware mnemonics but still it need to convert into the Machine Level Code or Binary code so that computer processor (CPU) will understand it. So We need to translate the assembly code to Machine code which is done by Assembler.

Low-level-programming-language-convertion-to-machine-code
Assembly to Binary Code Conversion

Example Program in Low Level Language:

Let’s look at the example low-level program to get better understanding of the concept.

First of we will write a simple addition program in C programming language and then we will convert the C program into the Assembly program.

Here is a C Program to Add two numbers

Add Two Numbers in C:

The above program outputs the sum of two variables 'a'and 'b'

Low Level Programming Language Example:

Let’s convert above C Language code into the Assembly code.

We can convert the C Programming code into the assembly code by using the gcc compiler with option '-S' ( capital 's').

By using the gcc compiler compilation option '-S', Gcc will generate a file with .s extension under the same folder/directory. Which is the Assembly language file.

We saved above C program with sum.c file name. To generate the Assembly code for sum.c file, Use the following command.

The above command create a file named sum.s which is Assembly equivalent of sum.c file.

Here is how our sum.c looks in the assembly language.

Assembly Code of sum.c program:

If you see above assembly language code, which contains lot of mnemonics which are hard to remember and master.

Conclusion:

In this article, We have discussed about the Low Level Languages and with example code snippets.

Related Reading:

Venkat

Hi Guys, I am Venkatesh. I am a programmer and an Open Source enthusiast. I write about programming and technology on this blog.

You may also like...

1 Response

  1. June 5, 2021

    […] our previous article, We discussed about the Low-level programming languages and In this article, We will look into the High level […]

Leave a Reply