You are on page 1of 25

INTRODUCTION TO

PRORAMMING LANGUAGE
CHAPTER 1
DFC1023 PROBLEM SOLVING & PROGRAM DESIGN
1.1 EVOLUTION OF PROGRAMMING
LANGUAGE
 Programming language :
 In computer technology, a set of conventions in which
instructions for the machine are written. There are many
languages that allow humans to communicate with
computers
 Programming languages can be used to create
programs to control the behavior of a machine
 Coded language used by progammers to write
instructions that a computer can understand to do what
the programmer (or the computer user) wants.
PROGRAMMING LANGUAGE
TIMELINE
 (attached PLTimeline.PNG)
CATEGORIES OF PROGRAMMING
LANGUAGES
 Machine Language / Machine Code
a set of instructions executed directly by a computer’s
central processing unit(CPU).
 Numerical machine code may be regarded as the
lowest-level representation of computer program or as
a primitive and hardware-dependent programming
language
 Almost all practical programs today are written in
higher-level languages or assembly language, and
translated to executable machine code
CATEGORIES OF PROGRAMMING
LANGUAGES
 Machine Language / Machine Code
 Machine Language is the only language that is directly
understood by the computer.
 When sequence of codes is fed to the computer, it
recognizes the codes and converts it in to electrical
signals needed to run it.
 Example :
CATEGORIES OF PROGRAMMING
LANGUAGES
 Machine Language / Machine Code
 Advantage :
 program of machine language run very fast because no
translation program is required for the CPU.
 Disadvantage :
 It is very difficult to program in machine language. The
programmer has to know details of hardware to write
program
 The programmer has to remember a lot of codes to write a
program which results in program errors.
 It is difficult to debug the program.
CATEGORIES OF PROGRAMMING
LANGUAGES
 Assembly Language
a low-level symbolic code converted by an assembler.
 Assembly language uses a mnemonic to represent each
low-level machine instruction or operation.
 Assembly languages (symbolic language) are only
somewhat simpler to work with than machine languages.
 Low-level language.
CATEGORIES OF PROGRAMMING
LANGUAGES
 Assembly Language
 Advantage :
 easier to understand and saves a lot of time and effort of
the programmer.
 It is easier to correct errors and modify program instructions.
 Assembly Language has the same efficiency of execution as
the machine level language. Because this is one-to-one
translator between assembly language program and its
corresponding machine language program.
CATEGORIES OF PROGRAMMING
LANGUAGES
 Assembly Language
 Disadvantage :
 One of the major disadvantages is that assembly language
is machine dependent. A program written for one computer
might not run in other computers with different hardware
configuration.
 Example :
CATEGORIES OF PROGRAMMING
LANGUAGES
 3rd Generation Programming Language
 Thethird generation brought refinements to make the
languages more programmer-friendly
 machine independent and could run on different
machines
 The comparative ease of use and learning,
improved portability and simplified debugging,
modifications and maintenance led to reliability
and lower software costs.
CATEGORIES OF PROGRAMMING
LANGUAGES
 3rd Generation Programming Language
 Advantage :
 User-friendly
 Similar to English using words and symbols
 Easier to learn.
 Require less time to write
 Easier to maintain.
 Can be converted into many machine language and thus can
run on any computer for which there exists a suitable
translator.
 Independent of the machine on which it is used.
CATEGORIES OF PROGRAMMING
LANGUAGES
 3rd Generation Programming Language
 Disadvantage :
 Needs to be translated into the machine language by a translator.
 The object code
generated by a
translator may be
ineffective.
 Example :
 ALGOL 58,
COBOL, FORTRAN IV
and C
CATEGORIES OF PROGRAMMING
LANGUAGES
 4th Generation Programming Language
a grouping of programming languages that attempt to
get closer than 3GLs to human language, form of
thinking and conceptualization.
 4GLs are designed to reduce the overall time, effort
and cost of software development
 Advantage :
 Have friendly interfaces
 Easier to use than older high level languages
 Linked to the English language
CATEGORIES OF PROGRAMMING
LANGUAGES
 4th Generation Programming Language
 Disadvantage :
 Programsrun slower than those of earlier language
generations because their machine code is longer and more
complex
 Example : IBM's ADRS2, CSP and AS, SQL, Access
CATEGORIES OF PROGRAMMING
LANGUAGES
 5th Generation Programming Language
 Fifth generation languages are normally associated with the
field of artificial intelligence.
 Artificial intelligence, built up through logic programming,
models a real world environment or situation. Artificial
intelligence aims to support flexible and informed patterns
of behavior within a computer.
 Users did not need any programming knowledge.

 Little or no coding and computer aided design with graphics


provides an easy to use product that can generate new
applications.
CATEGORIES OF PROGRAMMING
LANGUAGES
 5th Generation Programming Language
 Advantage :
 Theuse of system automation, which reduces the work load
on the programmer.
 Disadvantage :
 Programs continue to get more complicated and the
automated system is unable to sort through the design of an
original algorithm.
 Example : PROLOG, OPS5 and Mercury
FUNDAMENTALS OF PROGRAMMING
LANGUAGES
 Definitions of :
 Programmer
 someone who write program or computer software
 The term computer programmer can refer to a specialist in
one area of computer programming or to a generalist
who writes code for many kinds of software
 Program
 guide the computer through orderly sets of actions
 is a sequence of instructions, written to perform a
specified task with a computer
 Programming
 The action or process of writing computer programs
LANGUAGE TRANSLATORS
 A program is a set of instructions for performing a
particular task. These instructions are just like English
words. The computer interprets the instructions as 1's
and 0's.
 A program can be written in assembly language as
well as in high-level language. This written program
is called the source program. The source program is
to be converted to the machine language, which is
called an object program.
 A translator is required for such a translation.
LANGUAGE TRANSLATORS
 Assembler :
 Anassembler translates the symbolic codes of
programs of an assembly language into machine
language instructions
 The assembler programs translate the low-level
language to the machine code. The translation job is
performed either manually or with a program called
assembler.
LANGUAGE TRANSLATORS
 Compiler
 translate all the instructions of the program into machine
codes, which can be used again and again
 The program, which is to be translated, is called the source
program and after translation the object code is generated.
 The entire program will be read by the compiler first and
generates the object code.
 Compiler scans the entire program once and then converts it
into machine language
 In short compiler translates the entire program in one go
and then executes it
 Compiler generates error report after translation of entire
code
LANGUAGE TRANSLATORS
 Interpreter
 The interpreter generates object codes for the source
program.
 Interpreter first converts high level language into an
intermediate code and then executes it line by line. This
intermediate code is executed by another program.
 The execution of program is faster in compiler than
interpreter as in interpreter code is executed line by
line.
ANALOGY OF COMPILER AND
INTERPRETER
 Consider an English speaker wishes to communicate with a French
speaker? There are two possible solutions to the problem:
 The English speaker employs an interpreter who translates the
English sentences into French as they are spoken. The English
speaker says a sentence in English, the interpreter hears it,
translates it in his/her brain into French, and the speaks the
sentence in French. This is repeated for each sentence. Progress is
slow: there are pauses between sentences as the translation
process takes place.
 The English speaker writes down (in English) what needs to be said.
The whole document is then translated into French, producing
another piece of paper with the French version written on it.
LANGUAGE TRANSLATORS
 Syntax
 rules and principles that govern the sentence structure of
any individual language
 Syntax error
 a syntax error is an error in the syntax of a sequence of
characters that is intended to be written in a
particular programming language.
 For compiled languages syntax errors occur strictly
at compile-time. A program will not compile until all syntax
errors are corrected.
 For interpreted languages, however, not all syntax errors
can be reliably detected until run-time.
PROGRAMMING LANGUAGE
APPLICATION IN REAL LIFE
 Exercise
 Give one example of programming languages
application in real life.

You might also like