Anda di halaman 1dari 21

Language processors

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.

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 is acceptable because gap id bridge by the translator or interpreter and does not concern with software developer

PL domain
Procedure oriented language provides general purpose facilities required in most application domains. Such a language independent of specific application domain and results in large specification gap which has to be bridged by a application designer.

Language processing activities


The fundamental language processing activities can be divided into those that bridge the specification gap and those that bridge execution gap. The activities are
Program generation activities aims -> automatic generation of program Program execution activities organize execution of program written in PL on a computer system

Program generation
The program generation activities are shown as

The program generator is a software which accepts the specification of a program to be generated and generates a program written in target PL.

Program generation: Example


Screen handling program
Handles screen IO in a data entry environment. It displays the fields in the screen and accepts data values for the field. A screen generator generates screen handling programs. It accepts a specification of the screen to be generated and generates a program that performs the desired screen handling.

Program generation: Example

Screen handling program


Errors in the specification e.g. invalid start or end positions or conflicting specifications for a field, are detected by the generator. The generated screen handling program validates the data during data entry, e.g. age field must be only contains digits.

Program generation
Program generator introduce new domain

Reduction in specification gap increases the reliability of the generated program. Since the generator domain is close to the application domain, it is easy for the designer / programmer to write specification of program to be generated.

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

Program execution activities


Two models for program execution
Translation Interpreter

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 or assembly of the computer system called the target program(TP)

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 following modification.

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 an output interface of interpreter.

Thus the language processing activities of an interpreter can not separated from its program execution activities, hence we say that interpreter executes program written in a PL.

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.

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.

Program execution activities

Program execution activities

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

Program execution activities


Comparison
Translation vs interpreter

Fundamental processing of Language


Language processing:=
Analysis of SP + Synthesis of TP

Anda mungkin juga menyukai