First, Second, Third, Fourth Generation Computer Languages
First generation Language (Read, Write, Add, Branch)
- It uses a specific number for each command in the instruction set hard-wired into the machine.
- Each command works with one or more data words that are placed in processor registers.
- A data word is defined as a "bunch of bits" by the command, with the maximum number of bits limited by the register's maximum size
e.g. 36 bits on early mainframes that used early 6-bit characters,
4 bits on certain tiny processors,
8, 16, 32 or 64 bits on early PCs through to modern PCs. Each bit is like an on/off switch, which when placed inside a processor register, can be viewed as a binary number or as a "hexadecimal" character string.
- An important register, called the program counter, is the memory address containing the first bit of the next command. Importantly, this register can be overwritten by the program for branching purposes when running. That is what makes a computer different from a basic calculator.
- A timing device or "clock", along with a "Data Ready Y/N" control line, oversees each instruction.
Neither Microsoft Windows, Google Android, or Apple's iOS operating systems will permit programs to communicate with its hardware directly.
Today, in fact for the past 20-30 years or so, machine code refers to code interfacing with the operating system's kernel through the intermediary of an application binary interface (or ABI).
The operating system kernel is able to manage memory when multiple tasks are running, oversee program "exception" conditions when an unexpected event occurs, and importantly, handle multiple processor "threads".
Click here for further details on "What is a processor thread?".
See more on operating systems below.
Second Generation Language for Low-Level, Stored programs
Assembly Language which requires an Assembler (Translator):
- Written using English-like abbreviations instead of those numeric commands. The Assembler converts the abbreviations back to those numeric commands.
- It started a formal symbol "lookup" table in memory, an integrated part of an "object file" created by the Assembler from the "source file" listing.
- The lookup table contained a list of these reserved abbreviations and their numeric command equivalents, plus a list of variable names with each one's corresponding memory address pointer.
- Note, each numeric variable will always be specified as having a fixed number of words including a "Sign" bit, positive or negative
- Character variables, on the other hand, will have their string length specified in the lookup table and / or use a special character such as a "Null" character (binary zero) as a terminator for the string.
- Also a list of memory addresses for "branching" commands that may occur inside the program. Normally commands are loaded using the "next command" memory address held inside a program counter.
- Became useful for building device drivers for operating systems.
Click here for an early example of a Microsoft assembly program displaying the words "Hello World" on the screen in the days Microsoft allowed hardware & software interrupts.
Click here for the same assembly program written in "protected" mode on a modern Windows computer.
Click here to see BIOS firmware
Third Generation Languages for High-Level, Stored programs
FORTRAN (1957): a great formulaic language for scientists and engineers. Developed at IBM using Assembly language over many man years.
BASIC (1964): a great, simpler form of FORTRAN for schools, colleges and small - medium sized businesses, was developed using Assembly language.
Microsoft implemented the original BASIC interpreter (1975) along with its later variants GW-Basic (1983), the QuickBasic compiler (1985), and QBasic (1991) using Intel's x86 Assembly language.
Their VisualBasic compiler (1991) on the other hand along with its graphical user interface (GUI), was written by them using C, and their Visual Basic.NET (2002) was written using C++. See more about C and C++ below.
COBOL (1960): a great language for governments and medium - large businesses, for Payrolls, Debtors, Audits etc.
- Language based chiefly on working prototypes written using Assembly language by US Naval officer, Grace Hopper, over many years.
- Language standards then published by US Dept of Defence for all computer manufacturers to follow (if they wanted US Govt business).
- COBOL takes longer to initially code than BASIC or FORTRAN, but its layout insisted that the file system's input/output of permanent variables, also all temporary variables, are to be defined (in English words) at the front of the program in a Data Division.
Procedures, using those variables, are then to be defined (again in English words) at the back of each program in a Procedure Division.
- Made each program much easier to maintain, if well-written, for years and years.
C (1972) based on FORTRAN but with ALGOL-like language-building extensions, and also 8-bit byte memory addressing.
Followed eleven years later by the more graphics-oriented C++ (1983).
Two great languages to build
- New Languages and Operating Systems — a program that could run programs
- "Look-alike" operating systems and processing platforms — known as virtual machines
- 4GL run-time systems where the language is tied to an application such as a SQL database.
In the old days prior to the concept of byte addressing, machines fetched bits in memory by using its word address. So, to change the 16th character in a long character string of 6-bit characters using a 36-bit register, the program had to figure out that this occurred in the third word, fetch the third word, figure out that it wanted the fourth character in that word, mask out the old character from the value held in the register, put in the new one, and then store back the amended word. At least six machine instructions. Usually these were relegated to a subroutine, so every store or fetch of a single character involved the overheads of calling a subroutine and returning. With byte addressing that was achieved in one instruction: store this character code at that byte address. Text programs were immediately easier to write, smaller, and ran faster.
Then with C and C++, the individual commands that built entirely new language commands get passed through its own machine code, and in the process built up an associated library of templates (classes), and other files.
To elaborate on these templates or classes: Each C++ class in a class library provides reusable code that runs inside a program in the form of an "object", an "instance" of a specific class. These objects are called on to perform specific actions. The actual library itself is referred to as the "Application Programming Interface" or API.
JAVA (1995): A great example of a new language and its libraries, initially created through a C++ compiler.
- Originally owned by SUN, now owned by Oracle.
- The operating system requires a separate JVM — a Java virtual machine — to process the intermediate code (called bytecode). It works with dynamically loaded library files and additional resources such as a "Just-in-time" compiler ("Hotspot") for extra speed. This JVM, the class libraries, and other files make up a JRE (Java Runtime Environment).
- It runs in stand-alone mode as well as in web-based browsers on smartphones, tablets and desktops. The intermediary JVM interfaces with the underlying hardware through the operating system.
- Originally owned by Netscape Communications (now Mozilla Firefox), its standard list of commands get overseen by ECMA International, with its "trademark" now owned by Oracle.
- Also became the standard web interface language for Google Docs (Word processing), Google Sheets (Spreadsheets), Google Slides ("Powerpoint"-like presentations) on smartphones, tablets and desktops.
C# (2002): Microsoft's most popular latest language and its libraries, that were initially created through a specialized Microsoft C compiler.
- The .NET Framework that runs on Windows desktops provides a Common Language Runtime (CLR) to interpret the common intermediate language (CIL) that each program is compiled into.
- CIL and Java bytecode are thus similar conceptually, with the Windows Runtime corresponding to Java's JVM, interfacing with the underlying hardware through the Windows kernel.
- Another popular Microsoft language that compiles into this CIL bytecode is VB.Net (2002).
Based on the BASIC language.
4th Generation Language
Fourth Generation Languages providing Easier, High-Level, Stored programs using External Databases
Extract from Computers Ahead Cbse Class Ix by Rajiv Mathur
** End of file