Programs, like data, are encoded in binary in the form of machine instructions.
| Instructions | Comments |
|---|---|
| 0000 X | Store accumulator val in memory loc X |
| 0001 X | Load contents of memory loc X into acc. |
| 0010 X | Set accumulator value to X |
| 0011 | Halt execution |
| 0100 X | Add contents of memory loc X to acc. |
Every computer has its own set of machine instructions.
An "assembly language" is a set of mnemonic names for the instructions in a particular computer's machine language.
| Instructions | Comments |
|---|---|
| STORE X | Store accumulator val in memory loc X |
| LOAD X | Load contents of memory loc X into acc. |
| SET X | Set accumulator value to X |
| HALT | Halt execution |
| ADD X | Add contents of memory loc X to acc. |
An assembler program translates source code in assembly language into object code in machine language. In general, one line of assembly language translates into one instruction code.
| Load x Add y Store x Halt |
==> |
Assembler | ==> |
0001000000001100 100100000001101 0000000000001100 0111 |
==> |
Computer |
| Assembly language program |
Machine code program | |||||
Programming Languages can be classified by their programming paradigm.
| Programming Languages | |||
|---|---|---|---|
| Numeric FORTRAN |
Symbolic LISP Scheme |
||
| Procedural Algol Pascal C |
Business COBOL | ||
| Object-Oriented Smalltalk Objective C C++ Java |
Object-Based (or Event Driven) HyperTalk JavaScript | ||
| if (x==3) total=2+x; | ==> |
Compiler | ==> |
010011 001110 111000 |
==> | Computer |
| High-level code | Machine code | |||||