WORKING
OF PROGRAMMING LANGUAGES PKRE SE N T ED B Y
R I S H N A C H A K RA B
RO LL N O .: 1
Programming Languages
A computer language is used by a programmer to instruct a
computer what to do, or in other words, to write a program for a
computer.
People use languages that are similar to human language. The programs
are translated into machine code, which computers understand.
Over the years computer languages have evolved from machine
language to Natural languages.
Characteristics of a programming language
1. Readability: A good programming language allows programs to be
written in some way that resemble a quite-English description of the
underlying algorithms.
2. Portability: High-level languages, being essentially machine
independent, should be able to develop portable software.
3. Brevity: Language should have the ability to implement the algorithm
with less amount of code.
4. Error checking: Being human, a programmer is likely to make many
mistakes in the development of a computer program. Many high-level
languages enforce a great deal of error checking both at compile-time and
at run-time.
Characteristics of a programming language
7. Familiar notation: A language should have familiar notation, so it can be
understood by most of the programmers.
8. Quick translation: It should admit quick translation.
9. Efficiency: It should permit the generation of efficient object code.
10. Modularity: It is desirable that programs can be developed in the
language as a collection of separately compiled modules, with appropriate
mechanisms for ensuring self-consistency between these modules.
11. Widely available: Language should be widely available and it should
be possible to provide translators for all the major machines and for all the
major operating systems.
Programming languages fall into three broad categories:
Machine Languages Low Level
Assembly Level Language Languages
High-Level Languages
e
ag
gu
an
lL
ve
Le
y
bl
m
se
As
Computer Language Evolution
The Evolution of Programming Languages -
Machine Language
• Machine languages (first-generation languages) are the
most basic type of computer languages, consisting of
strings of numbers (binary 0s and 1s), the computer's
hardware can use.
• Different types of hardware use different machine
code. For example, IBM computers use different
machine language than Apple computers.
PROGRAM The Multiplication Program in Machine Language
Note
The only language understood by computer
hardware is machine language.
The Evolution of Programming Languages –
Assembly Language
• Assembly language (second-generation language) is
somewhat easier to work with than machine
language.
• To create programs in assembly language, developers
use cryptic English-like phrases, called mnemonics, to
represent strings of numbers.
• Eg. ADD, MUL, LOAD
• One of the major disadvantage is that assembly
language is machine dependent.
PROGRAMThe Multiplication Program in Assembly Level Language
AREA program, code, read only /Directives, this allow programmer to specify
memory
entry /Enter into the specified memory to create program
main
MOV R1, #0X000000004; /GET 1st VALUE
MOV R2, #0X000000004; /GET 2nd VALUE
MUL R3, R1, R2; /R3=R1*R2
END
Note
Assembly Level language uses symbols, or mnemonics, to
represent the various machine language instructions.
The Evolution of Programming Languages -
Higher-Level Languages
Higher-level languages are more powerful than assembly
language and allow the programmer to work in a more
English-like environment.
Higher-level programming languages are divided into
three "generations," each more powerful than the last:
• Third-generation languages
• Fourth-generation languages
• Fifth-generation languages
Higher-Level Languages -
Third-Generation Languages
• Third-generation languages (3GLs) are the first
to use true English-like phrasing, making them
easier to use than previous languages.
• 3GLs are portable, meaning the object code
created for one type of system can be
translated for use on a different type of
system.
• The following languages are 3GLs:
FORTRAN C
COBOL C++
BASIC Java
Pascal ActiveX
PROGRAM The Multiplication Program in C
12
Higher-Level Languages -
Fourth-Generation Languages
• Fourth-generation languages (4GLs) are even easier
to use than 3GLs.
• 4GLs may use a text-based environment (like a 3GL)
or may allow the programmer to work in a visual
environment, using graphical tools.
• The following languages are 4GLs:
Visual Basic (VB)
VisualAge
Authoring environments
Higher-Level Languages -
Fifth-Generation Languages
• Fifth-generation languages (5GLs) are an issue
of debate in the programming community – some
programmers cannot agree that they even
exist.
• These high-level languages would use artificial
intelligence to create software, making 5GLs
extremely difficult to develop.
• Solve problems using constraints rather than
algorithms, used in Artificial Intelligence
• Prolog
HIGH LEVEL LANGUAGE
TRANSLATORS
One of the disadvantages of a high-level language is that it must be
translated to machine language.
High-level languages are translated using language translators.
A language translator is that translates a high-level language program
or an assembly language program into a machine language program.
There are three types of translators:
1. Assemblers.
2. Compilers.
3. Interpreters.
HIGH LEVEL LANGUAGE
TRANSLATORS
Assemblers
An assembler is a program that translates an assembly language
program, written in a particular assembly language, into a particular
machine language.
Assembly
code
Assembler
Object code
HIGH LEVEL LANGUAGE
TRANSLATORS
Compilers
A compiler is a program that translates a high-level language program, written
in a particular high-level language, into a particular machine language.
A program written in high level language is called source program. After the
source program is converted into machine language by the compiler, it is
called an object program. It can be saved and reloaded several times.
This is especially useful for larger programs that have to be executed several
times without having to be modified.
A compiler can translate the programs of only that language for which it is
written.
HIGH LEVEL LANGUAGE
TRANSLATORS
Interpreters
An interpreter is a program that translates a high-level language program, one instruction (line) at a
time, into machine language.
As each instruction is translated it is immediately executed. At every execution the translation is
redone.
This is interesting to debug programs or for small programs.
Source code takes much less space than object code.
Interpreted programs are generally slower than compiled programs because compiled programs can be
optimized to get faster execution.
Note that:
Some high-level languages are compiled while others are interpreted. Compiled – C language,
Interpreted - Foxpro
There are also languages, like Java, which are first complied and then interpreted
REFERENCE
1. GOOGLE
2. WIKIPEDIA
3. worldofcomputerlaunguage.com