Generations of programming languages
| Generation | Type | Features | Examples |
|---|---|---|---|
| 1GL | Machine language | Binary 0s and 1s; only language the CPU understands directly; machine dependent; fastest; no translator | Binary op-codes |
| 2GL | Assembly language | Mnemonics (ADD, MOV, SUB); needs an assembler; machine dependent | x86 assembly |
| 3GL | High-level (procedural) | English-like; machine independent; needs compiler/interpreter | FORTRAN, COBOL, BASIC, C, C++, Java, Python |
| 4GL | Very high-level / non-procedural | Say what you want, not how; database and report tools | SQL, report generators |
| 5GL | Logic / constraint based | Used in AI and expert systems | Prolog, Mercury |
1GL and 2GL are low-level languages; 3GL onwards are high-level languages.
Language translators and tools
| Tool | Job |
|---|---|
| Assembler | Assembly language → machine code |
| Compiler | Translates the whole high-level program at once; lists all errors after compiling; produces object code; execution is faster |
| Interpreter | Translates and executes line by line; stops at the first error; no separate object file |
| Linker | Combines object files and library code into one executable |
| Loader | Loads the executable into memory for running |
| Debugger | Helps find and fix bugs |
| IDE | Integrated Development Environment – editor, compiler and debugger together |
Source code is what the programmer writes; object code is the translated machine code. Java uses both: the compiler produces bytecode, which the JVM (Java Virtual Machine) runs – "write once, run anywhere".
Languages and their creators
| Language | Creator / year | Known for |
|---|---|---|
| FORTRAN | John Backus, IBM (1957) | Formula Translation; scientific and engineering work; early widely used high-level language |
| COBOL | CODASYL committee (1959), influenced by Grace Hopper | Common Business-Oriented Language; banking and business data |
| LISP | John McCarthy (1958) | AI research, list processing |
| BASIC | Kemeny and Kurtz (1964) | Beginner's All-purpose Symbolic Instruction Code |
| Pascal | Niklaus Wirth (1970) | Teaching structured programming |
| C | Dennis Ritchie, Bell Labs (1972) | System programming; Unix was rewritten in C |
| C++ | Bjarne Stroustrup (1983/85) | C with classes; object-oriented |
| Python | Guido van Rossum (1991) | Simple syntax; data science, AI, scripting |
| Java | James Gosling, Sun Microsystems (1995) | Platform independent; Android apps, enterprise and banking systems |
| JavaScript | Brendan Eich, Netscape (1995) | Interactive web pages in the browser |
| Prolog | Alain Colmerauer (1972) | Logic programming, AI |
HTML (HyperText Markup Language) is a markup language for structuring web pages, not a programming language. CSS styles pages; XML stores and transports data with user-defined tags.
Object-oriented programming (OOP)
- Class – blueprint; object – instance of a class.
- Encapsulation – wrapping data and methods together; data hiding.
- Inheritance – a class acquires properties of another (parent) class.
- Polymorphism – one name, many forms (overloading, overriding).
- Abstraction – showing essential features and hiding details.
OOP languages: C++, Java, Python, C#. C is procedural.
Errors
- Syntax error – breaks grammar rules (missing semicolon); caught by the compiler.
- Logical error – program runs but gives wrong output; hardest to detect.
- Runtime error – occurs while running (division by zero).
An error in a program is a bug; removing it is debugging.
Algorithms and flowcharts
| Flowchart symbol | Meaning |
|---|---|
| Oval (terminal) | Start / End |
| Parallelogram | Input / Output |
| Rectangle | Process |
| Diamond | Decision (Yes/No) |
| Arrow | Flow of control |
| Small circle | Connector |
An algorithm is a finite, step-by-step procedure to solve a problem; pseudocode writes it in plain, code-like English.