0% found this document useful (0 votes)
64 views47 pages

Overview of Programming Languages

Uploaded by

nevak97071
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
64 views47 pages

Overview of Programming Languages

Uploaded by

nevak97071
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd

Programming Languages- Lec.

SEN227
Computer Programming
Language

 Computer:- Is an electronic machine.

 Program:- Program is a set of instructions or set of


statements.

 Language : -System of communication . Computer


language are used to facilitate communication
between computer and the user.
Cont..

 Before learning any language ,it is important to


know about the various types of languages and
their features .

 It is interesting to know what the basic


requirements of the programs where and what
difficulties they faced with the existing
languages
Computer Programming
languages
 A programming language is an artificial
language that can be used to control the
behavior of a machine particularly a computer .

 Programming Languages ,like human languages


are defined through the use of Syntactic and
Semantic rules, to determine structure and
meaning respectively.
Cont..

 Programming language are used facilitate communication


about the task of organizing and manipulating
information ,and to express algorithms precisely.

 Through computer programming language we can create


computer software .
 Software :- Is a set of programs.
 Software are of two types:-

 Application software and system software.

 Application software:- like Ms-word , excel, PowerPoint

 System software:- Is operating system Like Ms-Dos , Unix,


Linux ,Windows XP etc

 Operating system:-Manages all the resources of the


computer system Hardware and software.
Software

Application
System Software
Software

Operating Utility Language


System programs Translation

WORD
FILE PROCESSING
MANAGEMENT, ASSEMBLER SPREADSHEET
UNIX M/S
WINDOWS MAC I/O COMPILERS GRAPHICAL
O/S etc MANAGEENT INTERPRETERS
GAMES
SYSTEM BUSSINESS
UTULITIES SOFTWARE
Programming Language

 First-generation: Machine language


 Second-generation: Assembly language
 Third-generation: High-level language
 Fourth-generation
 (Fifth-generation)
1GL: Machine language
 A set of primitive instructions built into every computer
 The instructions are in the form of binary code
 1101101010011010
2GL: Assembly language
 Low-level programming language to represent machine-
language instructions
 E.g.: ADDF3 R1, R2, R3
 Assembly code need to be converted into machine code by
using an assembler
 Assembly program
 is platform dependent
 Combination of mnemonic and machine instruction
3GL: High-level language
 English-like and easy to learn and program.
 E.g.:
 Area = 5 * 5 * 3.1415;
 COBOL, FORTRAN, BASIC, Pascal, Ada, C, Visual Basic,
Delphi, C++, C#, Java
 Source program is compiled into machine code by a
compiler and linked to supporting library code by a linker
to form an executable file.
4GL / 5GL

 3GL offered greater power to the programmer,


while 4GL open up the development
environment to a wider population.
(Applications Development Without
Programmers)
 Database query languages: SQL…
 Data manipulation, analysis, and reporting
languages: MATLAB, SPSS…
Category (3GL)

 Windows Application
 C, C++, Java, Visual Basic, C#
 Web Application
 Server Side
 PHP, JSP (Java), ASP.NET (Visual Basic, C#), …
 Client Side
 JaveScript, VBScript
The Binary Machine

 A modern computer can run programs


written in JavaScript, Pascal, Visual Basic,
Visual C++, etc.
 However, computers can only understand
one language: the machine language it is
not easy to use.
 The machine language of a Sun workstation
is different from a PC (or other platform),
however, they can run the same C++
program.
Two types of Translators

(3GL to 1GL)
 Interpreter:
 translate and run the source code one line at
a time. Easy to write and easy to find the
errors in the program, but running very slow.
 JavaScript, VBScript, PHP, …
 Compiler:
 translates the source code once and for all,
producing a complete machine language
program. Very fast, but when the program
fails, difficult to show the programmer where
are the errors.
 C, C++, Java, C#, and so on.
Implement a Language

 Generally, the action of any translating program


can be divided into three phases
 Scanning
 Parsing
 Code generation
Implement a Language -
Scanning
 Scanning process: a long string of characters is
broken into tokens.
 Example: sum = a + b is broken into 5 tokens
sum, =, a, +, b
 A token is the smallest meaningful unit of
information.
Implement a Language -
Parsing
 Parsing: the string of tokens is transformed into
a syntactic structure.
 What happens in a compiler or interpreter is
that the list of tokens is converted to a parse
tree in memory via a complicated algorithm.

sum +

a b
Parsing a complicated
equation
 .
Parsing a complicated equation
Computer
Programming
Language

Low Level High Level


Language Language
L.L.L H.L.L

Machine Level
Assembly Translators
Language
Language
( M.L.L)

Assembler Compiler Interpreter


Machine Language
 Computer can understand only machine level language which are in binary digits (0,1).

 Writing a program in machine level language is

difficult task because it is not easy for programmers to write instructions in binary code.

 Machine level language is error-prone and its maintenance is very difficult.

 Machine languages are almost impossible for humans to use they consist entirely of

numbers ,while easily understood by computers it is the lowest level computer

language

 It is very difficult to develop a program in machine language. Because the code is

written binary numbers.


Assembly Language
 The difficulties in faced in machine level
language were reduced to some extent by using
a modified form of machine level language
called assembly language .

 In assembly language instructions are given in


English like words (Symbolic representation
called Mnemonics ) such as ADD ,SUB,
COMP,MOV etc .So it is easier to write and
understand assembly programs.
e.g A add B = C
 Assembly language programs must be
translated into machine language.
Cont..

 The translator that is used for translating Assembly


to Machine Level language is called “Assembler”.

 In assembly language ,data is stored in computer


registers and each computer has different set of
registers.

 Thus the assembly language program is also not


portable .

 Since the low level languages are related with the


hardware.
High level language
 High level language are English like language .

 So it is easy to write and understand the


programs of high level languages.

 These languages are machine independent.

 While programming in a high level language ,


the programmes is not concerned with the low
level details, and whole attention can be paid to
the logic of the program.
Cont..

 For translating a H.L.L program into machine


Level language, compiler or translator is used .

 Every programming language has its own


compiler or translator.

 Example of H.L.L are


FORTRAN,COBAL,BASIC,PASCAL ,C, C++,Java
V.B etc.
Translators
 We know that computers can understand only
machine level language ,which is in binary form
1 or 0.

 The code written in any high-level languages


should be translated into machine level
language and translators are used for this
purpose.

 These translators are just computer programs,


which accepts a program written in High Level
or Low level Language and produce an
equivalent machine language program as
output.
Types of Translators
 Thereare three types of
Translators:-
 Assembler .
 Compiler.
 Interpreter
Assembler

 Assembler is a translator (program) used for


converting the code of low-level language
(Assembly language) into machine level
language
Compiler
 Compiler is a translator used to convert the
code of High Level Language into machine
language .The high level language program is
known as source program and the
corresponding machine language program is
known as object program.

 A compiler searches all the errors of program


and list them.

 If the program is error free then it converts the


code of program into machine code and the
program can be executed separate commands
Interpreter
 Interpreter and compiler performs the same task ,there is
a difference in the working.

 An interpreter are also used to convert H.L.L. into M.L


Language.

 An interpreter is a translator it checks the errors of


program After checking statement by statement (Line by
Line). ne statement it converts that statement into
machine code and then executes that statement .

 This process continues until the last statement of


program or an erroneous statement occurs.
Programming languages Outline

 • Types of software
 Types of programming languages
 Examples
 – Java
 – Y2K
Types of software

 • System software
 – Operating systems
 – Programming languages
 – Database systems
 • Application software
 – General office tasks (word processing, etc.)
 – Accounting
 – Design
 – Factory automation
Unites of Programming
languages

 • Machine language
 • Assembly language
 • High-level languages
 • Fourth-generation languages
A sample Little Man Computer -
LMC program
Machine language

 • Binary
 • Machine dependent
 • Stored in the computer when the program is
running
 • Example:
 01110110001010010010
Assembly language

 • Mnemonic
 • Symbolic addressing
 • One-to-one correspondence with machine
language
 • Example:
 Get X
 Add Y
 Store Z
Automatically translating assembly language to
machine language
High-level languages

 • Closer to how people think about their


problems
 • No one-to-one correspondence to machine
language
 • General purpose
 • Example:
 Z=X+Y
High-level languages - Examples

 • Fortran
 • Basic
 • Visual Basic
 •C
 • C++
 • Java
Automatically translating high-level
language to machine language
“Interpreting” high level
languages
Interpreting high level languages

 • Advantages
 – Can give machine independence
 » (e.g., one machine can “look” like another)
 – Can be easier to debug and modify
 – Can give more flexibility at “run time”
 • Disadvantages
 – Slower
Object-oriented programming

 • A special kind of high-level language


 • Can increase programming efficiency and
software re-use
 • Combines procedures and data into “objects”
 • Arranges objects in “class hierarchies”
 • “Inherits” properties of objects in this
hierarchy
Class inheritance in object-oriented programming
What’s good about Java

 • Highly interactive – Traditional Web - application


software runs on server
 – Java applets dynamically
(e.g., input data validation)
 downloaded and run on client
 • “Nice” programming language
 – Simpler than C/C++
 – Object-oriented
 • Secure programming environment – “Sandbox”
approach
 • Portable (“write once, run anywhere”)
 – Based on Java byte-code interpreter
Java reality check

 • Highly interactive
 or too slow (interpretive)
 • “Nice” programming language
 • Secure environment or too limited
 or (1) not secure enough or
 (2) too secure (restrictive)
 • Portable
 only if consistent Java interpreter available
 (Java “dialects”)
THANK YOU

You might also like