Were high compilers using lower-level language in the present day?
In the past, writing compilers was done in the language being compiled, but nowadays, we usually use C or C++. Often, the initial development of a language is done in an existing programming language. Once the first compiler is relatively stable, it may be rewritten into the language that is being compiled.
The process
Assembly Language
The Assembly Language, also known as assembler, was a language where programmers wrote mnemonics to represent machine code. This meant that they used more human-readable symbols to represent binary codes. The relationship between the instruction symbols and process was one-to-one from machine code to assembler. When the code was executed, the assembler converted it into machine code, which consisted of binary digits of 1s and 0s.
To illustrate this, let’s use the example of computing the addition of two numbers represented by A = B + C, where the numbers (data) for B and C are stored in memory. You may remember that there are four individual steps or tasks that the computer must do to compute the result and save it for later use.
Step 1: Load B
The first step is to load B from stored memory into a working memory location. In machine code, this could look like:
0010 1011 0001
where:
- 0010 is the Load instruction
- 1011 (decimal value 11) is the working memory location of where to store B
- 0001 (decimal value 1) is the storage memory location of B, i.e. where it is stored.
In assembler, you would write it something like this:
LOAD R11,B
where:
- LOAD is the Load instruction
- R11 is the working memory location of where to store B or the register.
- B is a symbol representing where the storage memory location of B is located.
Notice how much more readable this is compared to binary code.
Fast Forward to the Code
Let’s look at the comparison of assembler to machine code.
LOAD R11,B
LOAD R12,C
ADD R13,R11,R12
STOR R13,A
0010 1011 0001
0010 1100 0010
1010 1101 1011 1100
1100 0011 1101
You can imagine how much easier programming became with the use of assembler, which is still used alongside machine code today.
Second-Generation Languages – High-Level Languages
As computers became more powerful, programmers required more advanced languages. The need to move away from machine-level code grew stronger, and more powerful instruction sets were needed. This was the beginning of the high-level language era. In 1954, John Backus of IBM developed FORTRAN (FORMula TRANslator), which was commercially released in 1957. This language was created for numerical applications. Instead of thinking in terms of computer instructions, programmers finally had access to a more natural, meaningful language. They no longer had to worry about computer machine steps, such as loading from memory and storing back in memory. The code is instead converted into the machine code we saw earlier.
For example, let’s look at our previous example of A = B + C.
program arithmetic
a = b + c
end program
LOAD R11,B
LOAD R12,C
ADD R13,R11,R12
STOR R13,A
0010 1011 0001
0010 1100 0010
1010 1101 1011 1100
1100 0011 1101
High-level languages like FORTRAN, allow us to focus on problem-solving instead of problem-solving and machine instructions. Throughout this period, other languages emerged which are still in use today, such as:
- Lisp in 1958
- COBOL (Common Business-Oriented Language) in 1960
- BASIC (Beginner’s All-purpose Symbolic Instruction Code) in 1964
The emergence of high-level programming languages introduced new tools like the compiler. It is a type of software that translates human-readable code into machine language. Initially, these languages were converted to assembly languages before being translated into machine code.
Wow
ReplyDeleteWhat is this 🙃
ReplyDeleteInteresting
ReplyDeleteWow
ReplyDeleteNice one
ReplyDelete