🧳Language Classification

The limited speed and memory of early computers forced programmers to write programs using low-level languages. These languages directly manipulated the processor, required a great deal of effort on the part of the programmer and were prone to errors.

High-level languages were developed to allow for instructions to be communicated to a computer’s processor, making the job of programming far easier.

Low Level Languages

Machine code

Machine code is the set of low-level instructions directly understood and executed by the CPU. It represents the native language of the processor, and it is made up of binary that correspond to specific operations and data manipulation.

In machine code, a typical instruction holds an operation code (opcode) in the first few bits and an operand in the rest of the bits. Nowadays computers typically use 16, 24, 32 or 64 bits for a machine code instruction.

An instruction set

An instruction set is a set of instructions which can be understood and executed by a computer system. If each instruction is held in 8 bits, 4 bits will be used for the opcode and the other 4 bits for the operand. The operand can either be an actual value or an address in memory to the value.

Here is an example of opcodes in machine code:

Opcode
Meaning

0000

Load the value stored in memory location specified by the operand into the accumulator

0001

Store the value in the accumulator in memory location specified by the operand

0010

Add the value specified in the operand to the value in the accumulator

0011

Compare the contents of the accumulator with the contents of the location specified by the operand

Assembly Language

Assembly Language was developed to simplify the process of writing computer programs. Each opcode was replaced by an easy-to-remember mnemonic which gave a clue on what the operation did. This made assembly language more compact and less error-prone than machine code. The operand was replaced by a denary number instead of binary.

Each assembly language instruction has a 1-to-1 correlation to a machine code instruction. For example, the assembly language instruction MOV R2, R1 might be the exact equivalent of the machine code instruction 11011101.

Here is an example of opcodes in assembly language:

Opcode
Meaning

LDA

Load the value stored in memory location specified by the operand into the accumulator

STO

Store the value in the accumulator in memory location specified by the operand

ADD

Add the value specified in the operand to the value in the accumulator

CMP

Compare the contents of the accumulator with the contents of the location specified by the operand

Assembly Language vs Machine Code

Assembly code is easier to write, understand and debug programs that are written in assembly language. However, a drawback of assembly code is that it must be translated into machine code by an assembler

High Level Languages

High-level languages are the type of programming language that you’re most likely used to using. Examples of high-level languages include C#, Python and VB.Net.

This implies that the programmer can think and code in terms of algorithms rather than worrying about how the computer will execute each tiny step, this is an example of abstraction.

Unlike low-level languages, high-level languages are not platform specific. However, high-level languages must be translated into machine code by a compiler or an interpreter before they can be executed. Also most high-level languages allow programmers to make use of built-in functions. These can save vast amounts of time when programming.

Imperative vs Declarative High Level Languages

Imperative high level languages contains a range of commands for the computer to perform in a specific order to give out a specific result, examples include C#, Python and VB.Net.

In contrast, declarative high level languages focus on what the program should do, without listing the steps needed to achieve the result. Database query languages such as SQL are declarative languages.

_
Machine Code
Assembly Lang
High Level Lang

Portability

Programs are processor specific

Programs are processor specific

Programs are not specific to certain processors.

Usage

Difficult for humans to understand.

Mnemonics help to make code slightly easier for humans to understand.

Code uses English, making it easy for humans to understand.

Debugging

Errors are very difficult to spot and correct.

Debugging is easier than with machine code but still far more difficult than with high-level languages.

Named variables, indentation and commenting make debugging fairly easy.

Execution

Can be directly executed by processors.

An assembler must be used before a program is executed, but each instruction has a 1-to-1 correlation to a machine code instruction so translation is quick.

A compiler or interpreter must be used to translate source code into object code before it can be executed. This can be time consuming.

Last updated