High level and low level programming

Important note: the computer cannot execute high level programming language statements !!!

High level and low level programming
 

The machine instructions (and the related assembler instructions) is what we call: low level programming

Low level programming language
 

Assembler programming language:

 

Translation from High level language to low level language

This is what happens when you compiles a program written in a high level programming language:

The is a one-to-one correspondence between assembler codes and machine codes !

Example to show you the compilation process - DEMO

High level language program (C language): (create a text file prog.c with this content)

   int x, y, z;
    
   int main( )
   {
      z = x + y;                     
   }

Stop the compilation after the compile step:

   /home/cs255001/bin/cc255 -S  prog.c        (Alt: gcc -S prog.c)          

  (Look in the text file  "prog.s" with an editor)

Stop the compilation after the machine code generation step:

   /home/cs255001/bin/cc255 -c  prog.c                  

   (Use /home/cs255001/bin/dump255  prog.o  view binary content)
   (Alt: use  objdump -d prog.o)

Compilation process was developed historically

Taken from this webpage: click here

Before the invention of assembler language, programmers flip switches and enters the program in binary code !!

Compilation process was developed historically

Taken from this webpage: click here

The assembler language simply replaces each (binary) machine code with a unique nmemonic (symbolic name)

An assembler is a (relatively simple) computer program that translates the nmemonics back into their binary code

Compilation process was developed historically

Taken from this webpage: click here

A high level language (like Java) has if-statement and while-statement to enable programmers to concentrate of the logic of the programs

A binary code compiler is a (very complex) computer program that translates the logic statements into an equivalent program in assembler language

Why learn assembler programming ?
 

Some programming language secrets you will learn in CS255