Introduction
If you want to get something done by a person,
you tell him what to do in a language that he understand.
Similarly, if you want to make the computer to do some task for you, you have
to tell the computer what to do in a language
that the computer understands machine language, which
in the printed form is apt to be an incomprehensible page after page of ones
and zeros. How can you then communicate with the
computer?
To communicate with the computer is to develop
a third language-a language that can be understood
by both you and the computer. This is what a programming language is —a set of rules that provides a way of instructing the computer to
perform certain operations.
5.1.1
Introduction to Programming Language:
A specification of sequence of step by step
procedures in a particular programming language to
perform certain operation is called program.
A program is generally specific in function. Some
programs are integrated whereas some are very specific and can solve a
particular problem. For example, a program finding the
square roots of a given number of a program for solving quadratic equations
cannot be used to solve other problems. The program are generally problem dependent. For writing various programs,
different computer languages are used, A program is a set of instructions for the
computer that tells it what to do. These instructions
are written in special programming
languages that allow people to communicate With
or instruct the machine.
The
task of developing programs for the solution of a problem using computer is
referred to as computer programming. A programming language is a set, of codes
used to write a program, i.e. it is a formal language designed to communicate
instruction to a machine (computer). Programming languages can be used to
create programs.
Basically,
languages can be divided into two categories according to how the computer
understands them.
Two Basic Types of
Computer Language:
1.
Low-Level Languages: A language that
corresponds directly to a specific machine. Low-level languages are closer to
the hardware
2.
High-Level Languages: Any language
that is independent of the machine i.e. which are closer to human languages.
In
this chapter we shall consider the five levels (or generations) of language.
1. Machine Language / First-generation
Languages (1GL)
2. Assembly Language / Second-generation
Languages (2GL)
3. Procedural Language / Third-generation
Languages (3GL)
4. Problem-oriented Language /
Fourth-generation Languages (4GL)
5. Natural Language / Fifth-generation
Languages (5GL)
5.1.2 Low Level
Language:
Low-level
computer languages are either machine codes or are very close them. A computer
cannot understand instructions given to it in high-level languages or in
English. It can only understand and execute instructions given in the form of
machine language i.e. binary. There are two types of low-level languages:
1. Machine Language: A language that is
directly interpreted into the hardware.
2. Assembly Language: a slightly more
user-friendly language that directly corresponds to machine language.
1.
Machine language:
Machine
language is the lowest and most elementary level of programming language and
was the first type of programming language to be developed. Machine language is
basically the only language that a computer can understand.
It
is almost impossible for humans to use because they consist entirely of number.
The lowest level of programming language in which information is represented as
strings of Os and 1 s (binary digits or bits) is called machine language.
Machine language's instructions typically use some bits to represent operations
such as addition, and some represent operands. Every CPU has its own unique
machine language.
Machine
language instructions typically use some bits to represent operations, such as
addition, and some to represent operands, or perhaps the location of the next
instruction. Machine language is difficult to read and write, since it does not
resemble conventional mathematical notation or human language, and its codes
vary from computer to computer. Machine Language is the only language that is
directly understood by the computer. It does not need any translator program.
We also call it machine code and it is written as string of l's (one) and 0's
(zero). When this sequence of codes is fed to the computer, it recognizes the
codes and converts it in to electrical signals needed to run it.
For
example, a program instruction may look like this:
1011000111101
It
is not an easy language for you to learn because of its difficult to
understand. It is efficient for the computer but very inefficient for
programmers. It is considered to the first generation language. It is also
difficult to debug the program written in this language.
For
example: Consider a line from a program segment, which multiplies two numbers.
00010000 01110000 00101011
11110010 01110011 11010010
Clearly,
working with this kind of code is not for everybody. Commas, semicolons, and
other special character are also represented as combination of 0s and 1s.
Advantage Machine
Language:
1.
The only advantage is that program of machine language run very fast because no
translation program is required for the CPU.
2.
It is directly understood by the computer.
3.
Machine language makes fast and efficient use of the computer.
Disadvantages
Machine Language:
1.
It is very difficult to program in
machine language. The programmer has to know details of hardware tot write
program.
2. The programmer has to remember a lot of
codes to write a program which results in program errors.
3. It is difficult to debug the program.
4. Programs are not portable to other
computers.
s. It is machine dependent, i.e. program
written in machine language for one computer model will not run on a different
model computer.
6. All memory addresses have to be remembered
2.
Assembly language
Assembly
language is one level above than machine language. It uses short mnemonic codes
for instructions and allows the programmer to introduce names for blocks of
memory that hold data. One might thus write "add pay, total" instead
of "0110101100101000" for an instruction that adds two numbers.
Assembly
language is designed to be easily translated into machine language. Although
blocks of data may be referred to by name instead of by their machine
addresses, assembly language does not provide more sophisticated means of
organizing complex information. Like machine language, assembly language
requires detailed knowledge of internal computer architecture. It is useful
when such details are important, as in programming a computer to interact with
input/output devices (printers, scanners, storage devices, and so forth).
The
set of symbols and letters forms the Assembly Language and a translator program
is required to translate the Assembly
Language to machine language. This translator program is called
Assembler'.
Example:
The
machine code is,
11110010 01110011 11010010 00010000 01110000 00101011
This
could be expressed in assembly language statement as, PACK 210(8,13), 02B (4,7)
So,
Assembly language does not replace machine language to execute as it must be
converted to machine code. It uses meaningful and readable symbols. ADD is used
for addition, SUB for subtraction, MUL for multiplication and so on. These are
called mnemonics codes. It is considered to be a second-generation language.
Advantages
Assembly Language:
1.
The symbolic programming of the Assembly Language is easier to understand and
saves a lot of time and effort of the programmer.
2.
It is easier to correct errors and modify program instructions because program
locate and identify.
3.
Assembly Language has the same efficiency of execution as the machine level
language. Because this is one to one translator corresponding machine language
between assembly language program and its corresponding machine language
program.
4.
It is easily modified.
5.
They are more standardized and easier to use than machine language.
Disadvantages
Assembly Language:
1.
It is machine dependent language i.e. a program written for one computer might
not run in other computers with different hardware configuration.
Programs
are not portable to other computers. Assembly language program are very long.
2.
Programs are not portable to other computer
3.
Assembly language program are very long.
4.
Assembly language program are still complex.
5.
To execute, it is slow, less efficient than machine language.
High Level
Languages (HLL):
High
level languages assisted programmers by reducing further the number of computer
operation details they had to specify, so that they could concentrate more the
logic needed to solve the problem.
High-level
computer languages use formats that are similar to English. The purpose of
developing high-level languages was to enable people to write programs easily,
in their own native language environment (English).
High-level
languages are basically symbolic languages that use English words and/or
mathematical symbols rather than mnemonic codes. Each instruction in the
high-level language is translated into many machine language instructions that
the computer can understand. Higher level languages are simple languages that
use English and mathematical symbols like +, %, / etc. for its program
construction. Higher level languages are problem-oriented languages because the
instructions are suitable for solving a particular problem. For example COBOL (Common
Business Oriented) is mostly suitable for business oriented language where
there is very little processing and huge output. There are mathematical
oriented languages like FORTRAN (Formula Translation) and BASIC (Beginners
All-purpose Symbolic Instruction Code) where very large processing is required.
Advantages:
1.
High-level languages are user-friendly
2.
They are similar to English and use English vocabulary and well-known symbols.
They are easier to learn
3.
They are easier to maintain
4.
They are problem-oriented rather than 'machine'-based
5.
A program written in a high-level language can be translated into many machine
languages and can run on any computer for which there exists an appropriate
translator
6.
The language is independent of the machine on which it is used i.e. programs
developed in a high-level language can be run on any computer text
Disadvantages:
1.
A high-level language has to be translated into the machine language by a
translator, which takes up time
2.
The object code generated by a translator might be inefficient compared to an
equivalent assembly language program
Types of
High-Level Languages:
Many
languages have been developed for achieving a variety of different tasks. Some
are fairly specialized, and others are quite general.
The
three different types of high level languages are:
1.
Procedural
Oriented Language (3GL):
General-purpose
programming languages are called procedural languages or third generation
languages. They are languages such as Pascal, BASIC, COBOL, and FORTRAN, which
are designed to express the logic, the procedure, of a problem. Because of
their flexibility, procedural languages are able to solve a variety of
problems.
It
is a list or set of instructions telling computer what to do step by step and
how to perform the first code to second code, second code to third code and so
on. This language makes programmer friendly. These languages are closer to
human language. They are easier to read, write, maintain. These programs could
run on different machines so they are machine independent, more mathematical
and logical expression is used to form statement. English words are used to
denote variables, data types, commands, etc. It is also termed as grouping of
primary. It is called source code program.
Advantages
include:
1. The program statements resemble English and
hence are easier to work with.
2. Because of their English-like nature, less
time is required to program a problem.
3. Once coded, programs are easier to
understand and modify
4.
The programming languages are machine-independent.
5.
It is written in a step-by-step function, smaller programs written this way are
very easy to follow.
Disadvantages
include:
1.
Program executes more slowly.
2.
The languages use computer resources less efficiently. They are mostly CUl
based language.
3.
Procedural coding tends to get very difficult to maintain the larger the code
gets. When the lines of code needed start ending up in the thousands it is very
difficult for a team of people, or even one person to maintain.
4.
Procedural code is difficult to relate with real world objects.
2.
Problem Oriented
Language/Fourth Generation Language (4GL):
Fourth
generation language, also known as problem oriented language, are high level language
designed to solve specific problems or develop specific applications such as
database, web based application.
Fourth-generation
languages may be categorized into several kinds of application development
tools:
·
Personal
computer application software
·
Query
languages and report generators
·
Decision
support systems and financial planning languages
·
Application
generators
It
is used for development of commercial business software. 4GLs are used to
access database. For e.g. find all records where name is "smith". It
can form thinking and conceptualization. The main families of 4GL are database
queries, data manipulation, GUI operators, and mathematical user web
development general purpose language.
It
is more user-friendly and enhances programming efficiently with usage of
English like words and phrases, use of icons, graphical interface, and symbolic
representation. Dbase, Sybase, PHP, JavaScript, ASP, JSP, VBScript, Visual.net,
VB.Net, ORACLE, etc. are the examples of 4GL
Advantages
include:
1. Simplified the programming process.
2. Use natural languages that impose no rigid
grammatical rules
3. They possess friendly interface.
4.
They are easier to use than previously used high level language.
5.
It is closely linked to the English language structure.
Disadvantages
include:
1.
Programs run slower than those of earlier language because their machine Code
longer and more complicated to execute.
2.
The recent popularity of4GL is closely linked to the development of fast
microprocessor.
3.
It requires more memory, disk storage so more execution time.
4.
Not suitable for solving problem.
3.
Natural Language
(5GL):
Natural
languages are still in development stages, but they promise to have profound
effect particularly in the areas of artificial intelligence and expert systems.
Natural languages have two characteristics:
·
They
are designed to make the connections that humans have with computers more
naturals-more humanlike.
·
They
are designed to allow the computer to become "smarter"-to actually
simulate the learning process by remembering and improving upon earlier
information.
A
natural language (or ordinary language) is typically used for communication,
and may be spoken, signed language (manual communication and body language) to
convey meanings, hands, arm, facial expression or written. Natural language
processing is the ability of a computer program to understand human speech as
it is spoken.
Two
popular natural languages are LISP and PROLOG.
Advantages
include:
1.
It answers questions when given a human question.
2.
Language processing is focused on developing efficient algorithm to process
task.
3.
Relieves burden of learning syntax
4.
No training!
Disadvantages
include:
1.
It doesn't recognize homonyms. E.g. RAM, Keyboard, Mouse
2.
May require more keystrokes
3.
May not show context
No comments:
Post a Comment