Fundamentals of the language processor
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 :-
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 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.
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.
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.
Language Processing Activities:
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
2. Program Execution Activities
(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.
Advantages :-
1. Reduction in the specification gap increases the reliability of the generated
program.
2. 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.
1. Translation :- This bridges the execution gap by translating source program into
an target program.
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.
(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.