ch1 language processors

Upload: truptikodinariya9810

Post on 04-Jun-2018

227 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/13/2019 Ch1 Language Processors

    1/21

    Language processors

  • 8/13/2019 Ch1 Language Processors

    2/21

    PL domain

    Three consequences of semantic gap are in

    fact consequences of a specification gap.

    Large development time

    Large development effort

    Poor software quality

    Solution

    Develop PL such that PL domain is very close or

    identical to application domain.

  • 8/13/2019 Ch1 Language Processors

    3/21

    PL domain

    Such PLs can only be used for specific applications,hence they are called problem oriented language

    They have large execution gap, however this isacceptable because gap id bridge by the translator orinterpreter and does not concern with softwaredeveloper

  • 8/13/2019 Ch1 Language Processors

    4/21

    PL domain

    Procedure oriented languageprovides general

    purpose facilities required in most application

    domains.

    Such a language independent of specific

    application domain and results in large

    specification gapwhich has to be bridged by a

    application designer.

  • 8/13/2019 Ch1 Language Processors

    5/21

    Language processing activities

    The fundamental language processing

    activities can be divided into those thatbridge

    the specification gap and those that bridge

    execution gap.

    The activities are

    Program generation activities aims -> automatic

    generation of program

    Program execution activitiesorganize execution

    of program written in PL on a computer system

  • 8/13/2019 Ch1 Language Processors

    6/21

    Program generation

    The program generation activities are shownas

    The program generator is a software which

    accepts the specification of a program to begenerated and generates a program written intarget PL.

  • 8/13/2019 Ch1 Language Processors

    7/21

  • 8/13/2019 Ch1 Language Processors

    8/21

    Program generation: Example

    Screen handling program

    Errors in the specification e.g. invalid start or end

    positions or conflicting specifications for a field, aredetected by the generator.

    The generated screen handling program validates thedata during data entry, e.g. age field must be only

    contains digits.

  • 8/13/2019 Ch1 Language Processors

    9/21

  • 8/13/2019 Ch1 Language Processors

    10/21

    Program generation

    This arrangements also reduce testing efforts

    To test an application generated by using the

    generator, it is necessary to only verify

    correctness of the specification of input to

    the program generator.

    This is much simpler task than verifying

    correctness of the generated program

  • 8/13/2019 Ch1 Language Processors

    11/21

    Program execution activities

    Two models for program execution

    Translation

    Interpreter

  • 8/13/2019 Ch1 Language Processors

    12/21

    Program execution activities

    Program translation

    It bridges the execution gap by translating a

    program written in a PL, called source program

    (SP), into an equivalent program in the machine orassembly of the computer system called the target

    program(TP)

  • 8/13/2019 Ch1 Language Processors

    13/21

    Program execution activities

    Characteristics of the Program translation

    models are:

    A program must be translated before it can be

    executed

    The translated program may be saved in a file.

    The saved program may be executed repeatedly

    A program must be translated followingmodification.

  • 8/13/2019 Ch1 Language Processors

    14/21

    Program execution activities

    Program interpreter An interpreter is a LP which bridges an execution gap without

    generating a machine language program.

    The absence of target program implies the absence of anoutput interface of interpreter.

    Thus the language processing activities of an interpreter can notseparated from its program execution activities, hence we saythat interpreter executes program written in a PL.

  • 8/13/2019 Ch1 Language Processors

    15/21

  • 8/13/2019 Ch1 Language Processors

    16/21

    Program execution activities

    Program interpreter

    During interpretation, it takes a source statement,

    determines its meaning and performs actions

    which implements it.

    This include computational and input-output

    actions.

  • 8/13/2019 Ch1 Language Processors

    17/21

    Program execution activities

  • 8/13/2019 Ch1 Language Processors

    18/21

    Program execution activities

  • 8/13/2019 Ch1 Language Processors

    19/21

    Program execution activities

    Characteristics of Program interpretation

    The source program is retained in the source

    from itself, i.e. no target program from exists.

    A statement is analyzed during its interpretation

  • 8/13/2019 Ch1 Language Processors

    20/21

    Program execution activities

    Comparison

    Translation vs interpreter

  • 8/13/2019 Ch1 Language Processors

    21/21

    Fundamental processing of Language

    Language processing:=

    Analysis of SP + Synthesis of TP