why do we need a language processor
Language Processor

Why do we need a language processor

LANGUAGE PROCESSORS activities arise due to the differences between the manner in which a software designer describes the ideas concerning the behavior of software and the manner in which these ideas are implemented in a computer system.

 The designer expresses the ideas in terms related to the application domain of the software. To implement these ideas, their description has to be interpreted in terms related to the execution domain.

Language Processors have two types of Gap.

  1. Semantic Gap
  2. Specification and Execution Gaps

1. Semantic Gap

Semantic Gap
Semantic Gap

Semantic Gap has many consequences

  • Large development time
  •  Large development effort
  • Poor quality of software

2. Specification and Execution Gaps

Specification And Execution Gap
Specification And Execution Gap

The software engineering steps aimed at the use of a PL can be grouped into

  •   Specification, design and coding steps
  • PL implementation steps

Specification and Execution Gaps

Specification Gap

 It is the semantic gap between the two specifications of the same task.

Execution Gap

It is the gap between the semantics of programs (that perform the same task) written in different programming languages.

Language Processors

A language processor is a software which bridges a specification or execution gap

The program form input to a language processor as the source program and to its output as the target program.

The languages in which these programs are written are called source language and target language, respectively

Types of Language Processors

A language translator bridges an execution gap to the machine language (or assembly language) of a computer system. E.g. Assembler, Compiler.

 A DE translator bridges the same execution gap as the language translator, but in the reverse direction.

 A pre-processor is a language processor that bridges an execution gap but is not a language translator.

 A language migrator bridges the specification gap between two PLs.

Language Processors – Examples

Language Processors Examples
Language Processors Examples

Language Processing Activities

1. Program Generation Activities

This activity generates a program from its specification. Thus program generation bridges the specification gap.

An example is Form Filling Program

2. Program Execution Activities

This activity aims at bridging the execution gap by organizing the execution of a program written in PL.

An example is Translation or Interpretation of the program.

Program Generation

Program Generation
Program Generator

Program Execution

Two popular models for program execution are translation and interpretation.

Program translation

Program Translator
Program Translator

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 retranslated following modifications.

Program Execution

Program Execution
Program Execution

Fundamentals of Language Processing

Language Processing = Analysis of SP + Synthesis of TP

Collection of LP components engaged in analysis of a source program as the analysis phase and components engaged in synthesizing a target program constitute the synthesis phase.

1. Analysis Phase

The specification consists of three components:

  • Lexical rules which govern the formation of valid lexical units in the source language.
  • Syntax rules which govern the formation of valid statements in the source language.
  • Semantic rules which associate meaning with valid statements of the language.

Consider the following example:

percent_profit = (profit * 100) / cost_price;

  • Lexical units identifies =, * and / operators, 100 as constant, and the remaining strings as identifiers.
  • Syntax analysis identifies the statement as an assignment statement with percent_profit as the left-hand side and (profit * 100) / cost_price as the expression on the right-hand side.
  • Semantic analysis determines the meaning of the statement to be the assignment of profit X 100 / cost_price to percent_profit.

Synthesis Phase

The synthesis phase is concerned with the construction of target language statements which have the same meaning as a source statement.

It performs two main activities:

  • Creation of data structures in the target program (memory allocation)
  • Generation of target code (code generation)


  •  MULT        AREG, 100
  •  …
  • PERCENT_PROFIT       DW        1
  • PROFIT                      DW        1
  • COST_PRICE              DW        1

Phases and Passes of LP

Language Processors
Language Processor

Analysis of source statements cannot be immediately followed by the synthesis of equivalent target statements due to the following reasons:

  • Forward Reference Issue (Multi-pass organization of LP)
  • Issues concerning memory requirements and organization of an LP

Forward Reference

  • percent_profit = (profit * 100) / cost_price;
  • ……
  • Long profit;

A Two-Pass Schematic for LP

Language Processor
Language Processor
  • PASS I:  Perform analysis of the source program and note the deduced Information
  •   PASS II: Perform Synthesis of the target program.

Leave A Reply

Your email address will not be published. Required fields are marked *