Review: computer memory

- Recall that the computer memory consists of a series of electical switches and each switch can store/remember one of the value of 0 or 1: We have also learned that:
  The computer memory contains the computer program !
Therefore: a computer program is a bunch of binary numbers !!

How people program a computer around 1945

Programmers would set switches to on/off to write out the computer instruction in binary: Programming was a very tedious task !

How people program a computer around 1950

We invented the assembler programming language which are mnemonics for each binary machine instruction: A (simple) translation program can an assembler translates an assembler program to binary machine code

How people program a computer around 1957

The first programming language (Fortran) was invented: A complex translation program can an compiler translates a Fortran program to assembler code

Demo the C compiler

- I don't have a Fortran compiler I do have a C compiler Here's a small C program:
      int a, b, c;

      int main()
      {
         c = a + b;
      }
I will show you the output (= assembler program) generated by the C compiler (Note to self: do it on a Windows machine)

Another way to run computer programs (How Python execute a program)

There is another way to execute computer programs: An interpreter is a computer program that understands and execute a certain programming language (e.g.: Python) The interpreter reads in one statement from a program at a time and execute it Executing a statement will update variables inside the interpreter

❮ ❯