×

Search anything:

Types of Programming Languages

Binary Tree book by OpenGenus

Open-Source Internship opportunity by OpenGenus for programmers. Apply now.

In this article, we discuss the different major types of programming languages that is High and Low-Level Languages, how they are used, and their pros and cons.

Table of contents.

  1. Introduction.
  2. High-level languages.
  3. Mid-level languages.
  4. Low-level languages.
  5. Summary.
  6. References.

Introduction.

There are three major categories of of computer programming languages namely:

  • High level(Java, Haskell, Prolog, FORTRAN)
  • Mid level(C, Assembly).
  • low level(Assembly, Machine code).

prog-2

High level languages.

The languages are machine independent meaning a program written in one system can be executed on any other system.
These languages are human readable, some are close to written english e.g python and hence easily understandable so much so that code written by a different programmer can be changed to perform a different task, they are also easier to debug and maintain.
They provide a high level of abstraction from machine languages.

The focus with high level languages is to be able to solve complex arithmetic operations, increase programmer productivity and optimized programs.

High level programs require compilers and interpreters which translate their source code into low level machine executable code. For example gcc compiler for C or python interpreter for python.

Using compilers we can compile source code written in a high level language into machine code that is specific to any processor architecture and therefore is machine independent.
All this comes at a cost of being slow compared to low level languages since translation of this high level language to low level language takes additional time.

High level languages are divided into two categories, interpreted languages and compiled languages.

Interpreted Languages.

Programs developed by interpreted languages are executed by an interpreter line by line where instructions are directly translated into a sequence of subroutines and then into machine code.

They are very slow compared to compiled languages however there are methods to increase their speed such as, Just-In-Time compilation.
They include, Python, Javascript, PHP.

interpreter

Compiled Languages.

These are languages which are directly converted into machine code which can be executed by a processor and thus they are faster and more efficient compared to interpreted languages.

When we compile a C/C++ program we expect an executable which we then execute with the appropriate inputs.
Examples include C, C++, Rust, Haskell.

compiler

Other than this categorization we can also classify high level languages by their programming paradigms such as logical, procedural, functional, object oriented, event driven, flow driven etc.

The four major paradigms are;

Procedural Languages.

These are also known as imperative languages. They are based on the concept of procedure calls whereby statements are grouped into procedures better known as routines and subroutines.

Generally they are a list of instructions which instruct the computer on what steps to take until a task is accomplished.
Examples include COBOL, FORTRAN.

Logic Languages.

Logic programming paradigm has its roots in mathematical logic whereby program statements are used to express facts and rules about problems within a system.
These rules are written as clauses and follow a declarative approach rather than an imperative one.

In other words, instead of providing a step by step list to tell the system what to do, we just give it an end goal and let it figure out what to do.
Examples include Prolog.

Functional Languages.

The functional programming paradigm views all subprograms as functions, code written in this paradigm will consist of pure functions which take an argument list as input and produce output.

Examples include, Javascript, Haskell, Scala.

Object Oriented Languages.

These represent real world entities as objects which are instances of classes and therefore each object will encapsulate a state and particular behavior.
States can be fields, attributes and behaviors define what we do with the state of the object which is defined by a method.
Examples include, Java, Python, C++.

Note that the languages listed in each paradigm are not limited to the said paradigm for example javascript can also be written in an object oriented paradigm even though we grouped it as functional.

Pros of high level languages.

  • Easy to read, write, debug and maintain.
  • They are portable.
  • They are machine independent e.g, a java program can be executed in any processor architecture.
  • They are less prone to errors, for example, syntax highlighting and compilers help to spot errors.
  • Using high level programming languages results in better programmer productivity, that is, coming up with a program in python is much quicker and productive than coming up with the same in assembly code.
  • They provide a higher level of abstraction from machine languages for example we don't handle memory allocation or deallocation.

Cons of high level languages.

  • They are not memory efficient compared to low level languages.
  • They are slower - they go through a lot of steps before they can actually be executed on a machine.
  • They need to be compiled or interpreted and this takes additional time.
  • They cannot communicate with the hardware directly.

Mid level languages.

These are programming languages which exhibit features of both high level and low level programming languages.
The C programming language is a good example of a mid-level programming language since it has features of both.
We can also place assembly language in this category since it is also readable and can be coded and maintained relatively easily by an expert in a specific processor architecture.

Low level languages.

These are languages which are machine/processor dependent e.g machine code(binary) and assembly code.
They are mostly used to write programs which will work on a specific processor architecture and computer hardware.

Writing low level code is a daunting task and programs written are difficult to read, understand or debug, furthermore they cannot be executed on any other processor however they are very fast and memory efficient.

In most cases they are used for coding operating systems, compilers, databases, malware, drivers or any application which requires direct hardware access.

We can further divide low level languages into two categories namely, machine language or assembly language.

Machine Language.

This consists a set of instructions which are executed directly by the CPU where each instruction performs a small specific task.
These instructions are specific to a machine and therefore will differ from machine to machine.

Assembly Language.

This is a better version of machine language whereby instead of using raw binary sequences to write instructions, we use mnemonics.
These mnemonics are then translated to machine language specific to a processor architecture by an assembler.

Assembly code has the best of both worlds, it is fast and can be read and understood and also communicates with the hardware directly.

assembler

Pros of low level languages.

  • They are in direct communication with hardware.
  • No need for compilers or interpreters since code is ready to be executed by a processor.
  • Provides better use of memory and processing power.
  • They provide direct manipulation of computer registers and storage.
  • Programs developed with low level programming languages are fast and memory efficient.

Cons of low level languages.

  • Difficult to write, read, debug or maintain.
  • They are processor architecture specific and therefore a programmer needs to have a specific knowledge of particular processor architecture in order to write code for it.
  • Coding in low level languages exposes one to a lot of errors.
  • Programming in a low level language results in poor programming productivity.
  • Low level programs are not portable.

Summary.

In this article we have discussed the different major categories of programming languages which are high, middle and low level languages. Within high level languages we have compiled and interpreted languages, we have also grouped high level programming languages in terms of the programming style involved. We have stated that middle level languages are those exhibiting both characteristics of high and low level languages such as C programming languages.

Low level languages such as machine language(binary) and assembly language.

References.

  1. x86 Assembly language
Types of Programming Languages
Share this