Language Processing Activities
- What is language processor ? (6 Marks)
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.
This semantic gap has some drawbacks :-
- large development time
- large development efforts
- poor quality of software
These drawbacks are tackled by introducing new domain called as programming domain.
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.
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)
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.
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)
|Compiler convert entire||Interpreter translate code one line at a time|
|It produce optimized code.||Code is not too much optimized|
|Program execution is faster||Program execution is relatively slow.|
|Program analysis time is more||Program analysis time is less|
|Machine code is generated||No machine code|
|Execution gap is present||Execution gap is absent|
Q. Explain problem oriented and procedure oriented languages. (2 Marks)
Problem oriented language :- It is used for specific applications.
Procedure oriented Language :- It is used for general purpose applications.
Q. Explain Language Processing activities in detail . (6 Marks)
Language processor are used to bridge the specification gap as well as execution gap. The language processing activities are divided into two groups
- Program Generation Activities (3 m)
- 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.
- Reduction in the specification gap increases the reliability of the generated program.
- This arrangement also reduces the testing effort.
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.
- Translation :- This bridges the execution gap by translating source program into an target program.
Features of program translation is as follows :-
- Translation of source program is required before execution.
- The translated program is saved in file and executed repeatedly.
- 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.
(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)
Language processing = Analysis of source program + synthesis of target program.
Analysis of source program; It contains three types:
- Lexical Analysis :- It governs lexical rules in the source language (e.g Identifier name is proper or not )
- Syntax Analysis :- It checks validity of statements for syntax in the source language
- Semantic Analysis :- It checks the semantic rules in the source language.
Figure shows phases of language processor.
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 :-
- Ease of use
- Processing and memory efficiency.
In this way language processing takes place.
- WikiNote Foundation