Generations of Programming Languages
- First Generation (late 1940s)
e.g. machine language
- Second Generation (early 1950s)
e.g. assembly language
- Third Generation (late 1950s through 1970s)
e.g. high level languages like COBOL, FORTRAN, BASIC, PASCAL, APL
- Fourth Generation (late 1970 onwards)
e.g. new range of query languages and other tools.
Classification of languages
- Low level
- High level
Low Level Languages:
- Use only primitive operations of the computer.
- Memory and registers have to be taken into consideration before one can write programs.
- Code is machine dependent.
- Examples: Machine Language and Assembly Language
- Computation is totally based on binary numbers; all the instructions including operations, registers, data and memory locations have to be specified in binary form.
- Machine’s circuitry is designed to understand binary without the need of any further interpretation therefore programs are executed directly.
- First Generation Language.
- Instruction essentially consists of:
Operation part: Operation to be performed by the machine, known as opcode.
Address part: Location of data on which operation is to be performed.
Advantages of Machine Language
- Makes most efficient use of system resources like memory, registers.
- No need of translation; directly executable code.
- Very high execution speed due to direct manipulation of memory and registers.
Disadvantages of Machine language
- Non portable or machine dependent code.
- Poor programming productivity as a programmer has to convert everything into binary.
- Requires programmer to control use of each register and storage locations have to be addressed directly and not symbolically.
- High level of programming skill required; increased training costs.
- Programs written are more error prone and really difficult to debug.
- Program size is big due to non-reusable code and use of basic operations to perform complex computations.
- Second Generation language.
- Substitute alphabetic and numeric symbols for binary code of machine language. Mnemonics for all opcodes, registers and memory locations, providing us with a more readable code.
- Provides a facility to write reusable code, known as macros.
Macros has two parts: macro name and macros body(containing the instructions).
A macros name can be called at any point in the program to use the instructions in it’s body.
- Language translator known as Assembler is required for translating the instructions into machine language.
Advantages of Assembly Language
- Optimal use of system resources(registers and memory) because of direct use within the program.
- Easier to use than machine languages as programmed doesn’t need to remember/calculate binary equivalents for everything(opcode, operand, registers etc.).
- Assembler helps in detecting programming errors.
- Facilitates reusable code by means of macros.
Disadvantages of Assembly Language
- Programs are not directly executable as assembler is required to translate them into machine language first.
- Non-portable or machine dependent code.
- Although easier than machine language, it still requires high level of programming skills.
- Knowledge of computer architecture of that particular machine required before one can write a program.
High Level Languages
- Procedure-oriented languages and intended to be machine independent.
- Natural language like structures, a great advancement over mnemonics of assembly language.
- Require translators known as compilers and interpretors.
- Portable irrespective of system architecture.
- Programs are written using English words and familiar mathematical symbols helping the programmers to focus on logic of problem solving rather than worrying about the technical details of the system.
Programs are more readable.
- Are the reusable code which can be called at any point of the program.
- Each procedure is defined by a name and set of instructions accomplishing a particular task.
- The procedure can be called by its name with the list of required parameters which should pass to that procedure.
Advantages of High Level Languages
- Easier to learn than low level languages.
- Less time required to write programs.
- Provide better documentation.
- Easier to maintain programs.
- Extensive vocabulary.
- Libraries of subroutines can be incorporated and used in many of the programs.
- Easier to debug as translators(compilers/interpreters) display errors with proper error messages at the time of translation.
- Programs are largely machine independent therefore require little or no modifications to run on different system architectures.
Limitations of High Level Languages
- Long sequence of instructions for every program.
- Additional memory space for storing compilers and interpreters.
- High execution time as programs written are not directly executable.
Compiler Based and Interpreter based Languages