Programming
Languages
Language
 A system of communication.
Computer Language
 Means of communication used to
communicate between people and the
computer.
Difference between natural
language and computer language
 Natural language has a very large
vocabulary whereas computer
languages mostly have a very limited
vocabulary.
Classification of Computer
Languages
Computer Languages
Machine Language Assembly Language High Level Language
Machine Language
 Fundamental language understood
by computer.
 Also known as Machine Code.
 Written as strings of binary 0’s and 1’s.
 No translation program is required.
 Not really easy to learn.
Instruction Format
 Instruction prepared in machine language
has 2 parts
 Operation Code: Specifies operation to
be performed.
 Operand: specifies address of
operand.
Opcode Operand
(Operation Code) (Address)
Advantages of Machine
Language
 Programs written in machine language
are very fast to execute as
instructions written in Machine
language are directly understood by
CPU and no translation program is
required.
Limitations of Machine
Language
 Machine dependent.
 Difficult to program
 Error prone.
Assembly Language
 To simplify the program writing
process used in machine language,
the numeric operation codes of
Machine language were substituted by
letter symbols(Mnemonics).
Mnemonics
 It is any kind of mental trick we use to
help us remember.
 For example: machine code of 111
can be interpreted as subtract but it is
still easier for us to remember it as
SUB.
Addition of two numbers
 Machine Language
0001100100
…………
…………
…………
…………..
 Assembly
Language
CLA A
ADD B
STA C
TYP C
HLT
Assembly Language
 The language which substitutes letters
and symbols for the numbers in the
machine language program is called
an ASSEMBLY LANGUAGE or
SYMBOLIC LANGUAGE.
Assembler
 The translator program that translates an
assembly code into machine code is
called an Assembler.
Assembly
Language Program
(Source Program)
Assembler
Machine Language
Program
(Object Program)
Advantages of Assembly Language over
Machine Language
 Easier to understand and use.
 Easy to locate and correct errors.
 Easier to modify.
 No worry about addresses.
Limitations of Assembly
Language
 Machine dependent.
 Knowledge of hardware required.
Machine and Assembly Languages
being machine dependent are called
as Low Level Languages.
High Level Language(HLL)
 High level languages instead of being machine
based are oriented more towards the problem to be
solved.
 HLL are basically symbolic languages that use
English words and/or mathematical symbols rather
than Mnemonic codes.
 HLL are known as Problem Oriented Languages.
 Every instruction written in HLL is translated into
many machine language instructions. This is one to
many translation whereas in Assembly Language
there is one to one translation.
Compiler
 The translator program that translates the
instructions of HLL into Machine Language
is called Compiler.
High Level
Language Program
(Source Program)
Compiler
Machine Language
Program
(Object Program)
Interpreter
 An Interpreter is a type of translator used for translating HLL into
Machine Code.
 It takes one statement of HLL and translates it into a Machine
instruction which is immediately executed.
High Level
Language Program
(Source Program)
Interpreter
Machine Language
Program
(Object Program)
Difference between Interpreter
and a Compiler
 In case of Compiler, whole source program is translated into
equivalent machine language program. The object code thus
obtained is permanently saved for future use. So, repeated
compilation is not necessary whereas in Interpreter no object
code is saved because translation and execution process
alternate.
 Advantage of an Interpreter over Compiler is that it
responses fast to changes in source program.
 Interpreters are easy to write and do not require large
memory space.
 Disadvantage of interpreter over compiler is that interpreter
is a time consuming translation method because each
statement must be translated every time it is executed from
source program.
 Assemblers, Interpreters and
Compilers are System Software that
translate a source program into object
program and are known as Language
Processors.
Advantages of High Level
Languages
 Machine independent.
 Easy to learn and use.
 Fewer errors.
 Easier to maintain.
Thank you

4programming-languages.ppt

  • 1.
  • 2.
    Language  A systemof communication.
  • 3.
    Computer Language  Meansof communication used to communicate between people and the computer.
  • 4.
    Difference between natural languageand computer language  Natural language has a very large vocabulary whereas computer languages mostly have a very limited vocabulary.
  • 5.
    Classification of Computer Languages ComputerLanguages Machine Language Assembly Language High Level Language
  • 6.
    Machine Language  Fundamentallanguage understood by computer.  Also known as Machine Code.  Written as strings of binary 0’s and 1’s.  No translation program is required.  Not really easy to learn.
  • 7.
    Instruction Format  Instructionprepared in machine language has 2 parts  Operation Code: Specifies operation to be performed.  Operand: specifies address of operand. Opcode Operand (Operation Code) (Address)
  • 8.
    Advantages of Machine Language Programs written in machine language are very fast to execute as instructions written in Machine language are directly understood by CPU and no translation program is required.
  • 9.
    Limitations of Machine Language Machine dependent.  Difficult to program  Error prone.
  • 10.
    Assembly Language  Tosimplify the program writing process used in machine language, the numeric operation codes of Machine language were substituted by letter symbols(Mnemonics).
  • 11.
    Mnemonics  It isany kind of mental trick we use to help us remember.  For example: machine code of 111 can be interpreted as subtract but it is still easier for us to remember it as SUB.
  • 12.
    Addition of twonumbers  Machine Language 0001100100 ………… ………… ………… …………..  Assembly Language CLA A ADD B STA C TYP C HLT
  • 13.
    Assembly Language  Thelanguage which substitutes letters and symbols for the numbers in the machine language program is called an ASSEMBLY LANGUAGE or SYMBOLIC LANGUAGE.
  • 14.
    Assembler  The translatorprogram that translates an assembly code into machine code is called an Assembler. Assembly Language Program (Source Program) Assembler Machine Language Program (Object Program)
  • 15.
    Advantages of AssemblyLanguage over Machine Language  Easier to understand and use.  Easy to locate and correct errors.  Easier to modify.  No worry about addresses.
  • 16.
    Limitations of Assembly Language Machine dependent.  Knowledge of hardware required. Machine and Assembly Languages being machine dependent are called as Low Level Languages.
  • 17.
    High Level Language(HLL) High level languages instead of being machine based are oriented more towards the problem to be solved.  HLL are basically symbolic languages that use English words and/or mathematical symbols rather than Mnemonic codes.  HLL are known as Problem Oriented Languages.  Every instruction written in HLL is translated into many machine language instructions. This is one to many translation whereas in Assembly Language there is one to one translation.
  • 18.
    Compiler  The translatorprogram that translates the instructions of HLL into Machine Language is called Compiler. High Level Language Program (Source Program) Compiler Machine Language Program (Object Program)
  • 19.
    Interpreter  An Interpreteris a type of translator used for translating HLL into Machine Code.  It takes one statement of HLL and translates it into a Machine instruction which is immediately executed. High Level Language Program (Source Program) Interpreter Machine Language Program (Object Program)
  • 20.
    Difference between Interpreter anda Compiler  In case of Compiler, whole source program is translated into equivalent machine language program. The object code thus obtained is permanently saved for future use. So, repeated compilation is not necessary whereas in Interpreter no object code is saved because translation and execution process alternate.  Advantage of an Interpreter over Compiler is that it responses fast to changes in source program.  Interpreters are easy to write and do not require large memory space.  Disadvantage of interpreter over compiler is that interpreter is a time consuming translation method because each statement must be translated every time it is executed from source program.
  • 21.
     Assemblers, Interpretersand Compilers are System Software that translate a source program into object program and are known as Language Processors.
  • 22.
    Advantages of HighLevel Languages  Machine independent.  Easy to learn and use.  Fewer errors.  Easier to maintain.
  • 23.