Language Processing Activities

Important Questions

  • What is language processor ?  (6 Marks)

Answer :-
The designer expresses the ideas in terms of application domain. To implement these ideas execution domain is used . For this purpose the rules of meaning of a domain is defined which is called as semantic. The gap between application domain and execution domain is called as semantic gap.

Semantic Gap

This semantic gap has some drawbacks :-

  1. large development time
  2. large development efforts
  3. poor quality of software

These drawbacks are tackled by introducing new domain called as programming domain.

Specification gap & execution gap

Specification gap is gap between application domain and programming language domain. The gap between programming language domain and execution domain is called as execution gap.

Language Processor :- A language processor is a software which either bridges specification gap or execution gap.

Language Processor

Source             Target             Language processor

Program          Program                      used                            Gap which is minimized

. asm               machine code Translator (Assembler )         Execution Gap

. c, . cpp          machine code Translator ( Compiler )          Execution Gap

Machine code .asm/.c/.cpp    De translator                           Execution Gap

.cpp                 .c                     Pre processor                           Execution Gap

.cpp                 .c                     Language Migrator                Specification Gap

The input program for language processor is termed as source program and language use for that is termed as source language. The output program from language processor is termed as target program. A detranslator converts program from one language i.e. machine code to other language. It might he high level or low level program. Preprocessor converts input source program  to output target program other than machine code. Preprocessor and language migrator works same, but preprocessor minimizes Execution gap and Language Migrator minimizes specification gap.

Q.        Explain Interpreter domain ?  (4 Marks)

Answer :-

An interpreter is a language processor which bridges an execution gap without generating a machine language program. Interpreter works as a translator, but it will not generate machine code and thus it generates another domain called as interpreter domain.

Interpreter domain

The absence of a target program implies the absence of an output interface of the interpreter. Thus the language processing activities of an interpreter cannot be separated from its program execution activities. It vanishes execution gap completely and generates new interpreter domain which is combination of PL domain as well as execution domain. In this way interpreter performs its operation.

Q.        Compare compiler and Interpreter.  ( 4 Marks)

Ans:-   

CompilerInterpreter
Compiler convert entireInterpreter translate code one line at a time
It produce optimized code.Code is not too much optimized
Program execution is fasterProgram execution is relatively slow.
Program analysis time is more  Program analysis time is less
Machine code is generatedNo machine code
Execution gap is presentExecution gap is absent

 

Q.        Explain problem oriented and procedure oriented languages.  (2 Marks)

Answer :-

Problem oriented language :- It is used for specific applications.

Problem oriented language

Procedure oriented Language :- It is used for general purpose applications.

Procedure oriented Language

Q.        Explain Language Processing activities in detail .   (6 Marks)

Answer :-

Language processor are used to bridge the specification gap as well as execution gap. The language processing activities are divided into two groups

  1. Program Generation Activities    (3 m)
  2. Program Execution Activities     (3 m)

(a) Program Generation Activities :- The program generator is a software system to be generated and generates a program in the target PL. Because of this new domain is generated between the application and PL domain called as program generator domain. The specification gap is now the gap between the application domain and program generator domain. This gap is smaller than the gap between the application domain and target PL domain.

Program Generator

Advantages :-

  1. Reduction in the specification gap increases the reliability of the generated program.
  2. This arrangement also reduces the testing effort.

                  Specification GapExecution Gap

It is more economical to develop a program generator than to develop a problem oriented language by reducing specification gap.

b) Program Execution Activity :- It is having two groups one is translation and interpretation.

  1. Translation :- This bridges the execution gap by translating source program into an target program.

    TRANSLATION

    Features of program translation is as follows :-

    1. Translation of source program is required before execution.
    2. The translated program is saved in file and executed repeatedly.
  2. Interpretation :- Interpreter reads the source program and stores it in its memory. During interpretation it takes a source statement, determines its meaning and implement it. The interpretation works same as that of instruction execution.

SCHEMATICS OF INTERPRETATION PROGRAM EXECUTION

(a) SCHEMATICS OF INTERPRETATION             b) PROGRAM EXECUTION

The instruction uses program counter to fetch instruction from memory then decode it and execute the instruction. In similar way interpreter fetch the statement from memory. Analyze the statement and determine its meaning. Execute the meaning of the statement. Thus it bridges that execution gap.

Q.        Explain fundamental of language processing ?   (6 Maks)

Answer:-

Language processing = Analysis of source program + synthesis of target program.

Analysis of source program; It contains three types:

  1. Lexical Analysis :- It governs lexical rules in the source language (e.g  Identifier name is proper or not )
  2. Syntax Analysis :- It checks validity of statements for syntax in the source language
  3. Semantic Analysis :- It checks the semantic rules in the source language.

Figure shows phases of language processor.

fundamental

Source program passed through analysis phase and it generate IR which is intermediate representation which is further passed to synthesis phase which finally generates target program.

In analysis phase we are using forward reference. Forward reference of a program entity is a reference to the entity which precedes its definition in the program IR is having following properties :-

  1. Ease of use
  2. Processing and memory efficiency.

In this way language processing takes place.

References

  • WikiNote Foundation

Last modified: Thursday, 19 September 2019, 10:51 PM