Since the beginning of time, human beings have had a desire to communicate with each other. We invented language and created rules which establish the meaning of the words and sentences in the languages. Well, we also created languages for computers. These languages allow a programmer to communicate with the computer and write a sets of instructions for the computer to accomplish specific tasks. We call these languages programming languages, and there are several types of programming languages.
The best formal definition I got was from Webopedia, and it says “A programming language is a vocabulary and set of grammatical rules for instructing a computer or computing device to perform specific tasks.”
I like this definition because it highlights the fact that just like any language, programming languages have rules – syntax and semantics. We will discuss this later. This article will explain the types of programming languages.
Table of Contents
Types of Programming Languages
Below are the types of programming languages:
- High level programming languages
- Low level programming languages
- Middle level programming languages
High level programming languages
The common type of programming language is the high level programming language. This type of programming language makes use of English-like statements. These are relatively simple for a person to program i.e. they have a high level of abstraction. This means they are quite easy to learn and use, they are quite easy to debug, and they have portable code – code that is not designed to run on one type of machine or specific hardware. However, the language is rather complex for the machine to understand. Computers only understand a series of 1s and 0s which is commonly referred to as machine code. This therefore means that these high level languages need to be translated to machine language – a process which takes a bit of time. As a result, a program written in a high level programming language performs much slower than one written in a low level programming language.
It is important to note that high level programming languages are converted into machine languages by one of the following:
1. An interpreter
This is a computer program which translates code written in a high level programming language into machine code. The compiler and interpreters perform similar operations, but differ in that a compiler converts the code into machine code and creates an executable file before the program is run. Interpreters convert the code into machine code when the program is run.
2. A compiler
This is a computer program that is designed and developed to translate code written in a high level programming language into machine code before the program written in the high level language is run.
A compiler must adhere to the syntax rules present in the documentation of the programming language. Any errors detected cannot be fixed by the compiler, and they will cause the program not to compile until the error has been addressed.
Examples of high level languages include:
Visual Basic (VB), Python, C++, Java, Pascal, PHP, Swift, Fortran, Objective C
Low Level Programming languages
The other type of programming language is low level programming languages. These are languages that look like a scene from the popular movie – The Matrix. They have a lower level of abstraction, which means you get to do a lot more work during the programming process that you would normally do when using a High level programming language. This language is not suitable for beginners as they will be left bewildered by the complex cryptic-like statements used. These types of programming languages are usually hardware dependent and machine dependent so it often means that a person needs to learn the specific instructions used for each platform. In addition, in these type of programming language it is quite difficult to find errors and debug your code.
Low level programming languages have the advantage that they offer more functionality, and they give more direct control over the computer. A very attractive feature about these languages is that they allow programmers to design and develop detailed and more efficient programs which work faster than they would if they had been written in a high level language. In addition, the programs are more memory efficient.
There are two main categories which are:
1. Machine language
This consists of strings of binary digits – 1s and 0s. The processor directly understands this language, and therefore the speed of execution is pretty fast and there is efficient usage of primary memory.
2. Assembly language
In this case, the programmer needs to know the symbolic operation codes, frequently referred to as mnemonics code. This program is then converted to machine code by an assembler. The resulting program is commonly referred to as the object code.
Examples of low level programs:
Device drivers – these are written by programmers in order to develop code that is specific to their hardware.
Middle Level programming languages
While this type of programming language is not official, it is quite common to hear of it, or stumble across it in textbooks. This refers to the programming languages that exhibit features of both high level and low level programming languages.
The best example of such a language is the C programming language.
Syntax and Semantics
In the beginning, I promised I would explain more on the difference between syntax and semantics. Time for me to honour my promise.
Programming languages are similar to spoken languages in that they have both a vocabulary and a grammar.
The vocabulary refers to the collection of key words from which lines of programming codes are composed.
The syntax refers to the set of rules for the grammar and the spelling. This means that character structure a computer can interpret. It answers the question “How do I construct a valid sentence?” For example the keyword “Using” in the C# programming language would produce a syntax error as this statement is supposed to be used in small letters throughout.
The semantics refers to the meaning of the statement. It answers the following:
- “Is this sentence valid?”
- “If the sentence is valid, then what does it mean?”
An example is the following:
This is code from the C# programming language. This sentence means that there is a variable named a, and this variable is incremented by one each time this code is run.
It is quite common to use a text editor, or an Integrated Development Environment which supports syntax highlighting. This means the keywords of the programming language will all have different colours, thus, making the code easy to read.
This leads us to the end of the article on the different types of programming languages. I hope you enjoyed it!