Computer Programming Languages Overview
What is Language?
Language is the method of human communication, either written or spoken, consisting of the use of words in a structured and conventional way.
What are Computer Languages?
•Computer Languages are system of communication or interaction with a computer.
•Such languages are used to create computer code or program code, the set of instructions forming a computer program which is executed by the computer.
What is Program?
Program is a set of instructions that can be executed by a computer to perform a specific task.
What are Programming Languages?
•A program is written in some particular language called programming language.
•Particular language means any language like C/C++/Java/Python etc.
•Computer understands programs written in these languages. These languages can be easily translated into machine level language, which a computer understands using compilers, interpreters and assemblers.
•A person who writes a program is called a Computer Programmer.
Types of Programming Languages
Machine Language
• Based on Binary digits (Bits) 0s and 1s.
• Directly understand by computer.
• All instructions given in Binary digits.
• It is 1st Generation of Computer Language also known as 0GL or 1GL.
• There are 16 bits used to define one Instruction (instruction size may be change according to machine architecture (upto 128 bits).
• 4 bits are used to OP-Code (operation code) and 12 bits are used to OPERAND (address / Location of value (data)).
e.g. 0001 101011111011 One instruction
OP Operand
code (address/Location)
Advantage:
• It can be executed very fast because no translator program used, computer machine instructions are directly understanding.
Disadvantages:
• Machine Dependent
• Difficult to program
• Difficult to modify
• Error Prone.
• Time Consuming
Assembly Language
• It is also known as a 2nd Generation Programming Language (2GL).
• In this language use mnemonic code (short names) instead of binary digits. e.g. LDA – Means load Accumulator.
HLT- Halt, used at the end of program to stop
ADD, MUL, DIV, SUB for arithmetic operations
• The assembly language allows us to refer to instructions and memory locations by letters and symbolic names.
• A program written in an assembly language is called an assembly language program (source code of assembly language).
• Assembler (translator Program) is used to convert assembly language program into a machine language program. Because computer can only understand machine language and no other language.
Advantage:
• Easier to read and write.
• Easier to modify.
• Easily re-locatable.
• No worry about addresses.
Disadvantages:
• Machine Dependent
• Knowledge of hardware required.
• Machine level coding
Assembler-
• Assembler is a software or programs that translates as assembly language program into an equivalent machine language program of a computer.
• Assembler is actually a complicated program written in machine language.
• A program written in assembly language is called Source Program.
• The assembler converts the source program into machine language program known as object program or code.
High Level Language (HLL)
• In these languages, instructions are specified as simple English like phrases and familiar mathematical symbols and expressions.
• It is user friendly language.
• These languages have owned its grammar and vocabulary.
• These phrases are then defined into low level language code by a compiler or an interpreter.
• Compiler and interpreter are low level language programs.
• A program written in a High-Level Language is called a Source code or Source Program.
• Compiler/Interpreter (translator Program) is used to convert High Level Language program into a machine language program known as Object Code.
Types of High-Level Language
There are three types of High-level Language-
1. 3rd GLs (Third Generation Languages)
• It is procedural Languages.
• A program written in a procedural language consists of detailed steps for doing a task (Developed Algorithm or logic).
• 3rd GLs can be classified into three types–
– Imperative Languages:
o Imperative language is also known as procedural language. Imperative programs are made up of sequence, selection and iteration blocks. e.g. FORTRAN, BASIC, COBOL, PASCAL, C
– Functional Language:
o Functional programming is a way of thinking about software construction by creating pure functions. e.g. LISP, Scheme.
– Declarative Language:
o Also called nonprocedural or very high level, are programming languages in which (ideally) a program specifies what is to be done rather than how to do it. ProLog is notably a so-called nonprocedural, or declarative
2. 4th GLs (Fourth Generation Language)
• 4th GLs are non-procedural Languages suited for developing commercial applications.
• A 4th GL is an object oriented & event Driven language.
• Object Oriented language organize coding around objects.
• Also known as a 4th generation language, a domain specific language, or a high productivity language.
• 4 GLs are designed to reduce the overall time, effort and cost of software development.
• A 4th GLs does not require detailed programming.
• Example of 4th GLs are: SQL, Focus, Visual Basic, Java, C#, Python etc.
3. 5th GLs (Fifth Generation Language)
• 5th GLs are an outgrowth of research in the area of artificial intelligence.
• A fifth-generation programming language is a programming language are designed to make the computer solve the problem of you.
• Fifth generation computing devices, based on AI.
• Are still in development, through there are some applications, such as voice recognition.
• The goal of 5th GL computing is to develop devices that respond to natural language input and are capable of learning and self-organization.
• Fifth generation language comes in 1986 –onward
• They are more reliable, works faster, easily portable, different features, different sizes, extra high processing speed, parallel processing and wireless.
• Prolog, OPS5 and Mercury are the best known fifth generation languages.
Advantage:
• Easy to write and understand
• Easy to isolate an error
• Machine independent language
• Easy to maintain
• Better readability
• Low Development cost
• Easier to document
• Portable
Disadvantages:
• Needs translator
• Requires high execution time
• Poor control on hardware
• Less efficient
Difference between Machine, Assembly, High Level Languages
LANGUAGE PROCESSORS(TRANSLATOR PROGRAMS)
• Language Processors also known as Translator Programs.
• A Language Processors are special translator System Software is used to translate the program written in high-level language (Source-Code) into machine code is called Language Processor and the program after translated into machine code (object program / object code).
• The program translated by language processor is understood by the hardware of the computer
• There are three types of translators. These are:
§ Assembler
§ Compiler
§ Interpreter
1. Assembler
• It is Translator Programs that translates as assembly language program into an equivalent machine language program of a computer.
• Assembler is actually a complicated program written in machine language.
• A program written in assembly language is called Source Program.
• The assembler converts the source program into machine language program known as object program or code.
2. Compiler
• Compiler is a Translator Programs that translates as High-Level Language program into an equivalent machine language program of a computer.
• It converts entire program at a time.
• A program written in HLL is called Source Program.
• The Compiler converts the source program into machine language program known as Object Program or Object Code.
3. Interpreter
• An Interpreter is a Translator Programs that translates (converts) a High-Level Language program into an equivalent machine language program.
• It converts line by line (one statement) of a program at a time.
• It is slower than the compiler process.
• Immediately executes he resulting machine language instruction.
Difference between Compiler and interpreter
Compiler |
Interpreter |
Compiler Takes Entire Program as input and Convert Entire Program at a time. |
Interpreter Takes one instruction as input and convert line by line (one instruction at a time |
Intermediate Object code is Generated |
No Intermediate Object code is Generated |
Executes Faster (Fast Processing) |
Executes slower (Slow Processing) |
Program need not be compiled every time |
Every time higher level program is converted into lower level program |
Errors are displayed after entire program is checked |
Errors are displayed for every instruction interpreted |
More Memory Required |
Less Memory Required |
Example: C/C++ compiler, COBOL, PASCAL |
Example: BASIC, SQL, VB |
Generation of Programming Languages
There are five generation of Programming languages. These are:
1. First Generation Languages: (1940-50)
Low-level languages like machine language.
2. Second Generation Languages: (1950-58)
Low-level assembly languages used in kernels and hardware drives.
3. Third Generation Languages: (1958-85)
High-level languages like BASIC, FORTRAN, COBOL, PASCAL, C, C++.
4. Fourth Generation Languages: (1985-onwards)
Similar to statements in the human language. These are used mainly in database programming and scripting. Example of these languages include Perl, Python, Ruby, SQL, MatLab.
5. Fifth Generation Languages: (Present and Beyond)
These are the programming languages that have visual tools to develop a program. Examples of fifth generation language include Mercury, OPS5, and Prolog.
Making Programs
• Computer is a machine.
• It is machine with memory
• It is calculating machine having memory
• It does not have a brain
• It therefore cannot think
• Computer need guidance to work
• Guidance is given through program.
• Program is written in a binary code.
• This code is known as machine code
• Machine code is very difficult.
• This program is written in English-like
language So we write a program in simple language.
• This language is called high level language.
• One such language is C.
• It is easy to learn
• Very close to English
• It is learnt in all countries
• It has a simple grammar
• We need program for every work
• We can work well if program is there.
• We can save time, if we work as per a program
• In a program, we make the list of action to be taken i.e. instructions.
• Then we arrange them in some sequences (order) one by one.
• That is which action to be taken first and which next.
• Instructions arranged in a sequence are known as program
• When drawn in a sketch form it is known as flowchart.