Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
62 views

4 LanguageProcessors

System software is the backbone of a computer that manages hardware resources and provides a platform for running applications. It explores the functions, types, and importance of system software in modern computing. Language processors bridge the gap between how software is described and how it is implemented by translating programming languages into executable code. There are two main types of language processors: compilers, which translate entire programs at once into machine code, and interpreters, which translate programs one line at a time.

Uploaded by

Swapnali Pawar
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
62 views

4 LanguageProcessors

System software is the backbone of a computer that manages hardware resources and provides a platform for running applications. It explores the functions, types, and importance of system software in modern computing. Language processors bridge the gap between how software is described and how it is implemented by translating programming languages into executable code. There are two main types of language processors: compilers, which translate entire programs at once into machine code, and interpreters, which translate programs one line at a time.

Uploaded by

Swapnali Pawar
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 40

Introduction to System

Software
System software is the backbone of a computer, responsible for managing
hardware resources and providing a platform for running applications. In this
presentation, we'll explore the functions, types, and importance of system
software in modern computing.

SP by Swapnali Pawar
Language Processor
SWAPNALI R PAWAR

SWAPNALI R.PAWAR~(RIT) 2
Agenda
▪ About Language processor
▪ Language processor Definition
▪ Complier and Interpreter
▪ Comparison between Compiler and Interpreter

SWAPNALI R.PAWAR~(RIT) 3
Language processor
• The manner in which a software designer describes the ideas concerning the behaviour
of the software.
• The designer expresses these ideas in the application domain.
• These ideas are actually implemented in the execution domain
• The gap between the application domain and execution domain is called semantic gap.

Semantic gap

Application domain Execution domain

Fig 1 Semantic gap

SWAPNALI R.PAWAR~(RIT) 4
Language processor
• The semantic gap has many difficulties, some of the important ones
being large development time and efforts, and poor quality of
software.
• These issues are tackled through the use of (PL) Software
implementation using PL introduces new domain as PL domain.
• The semantic gap is bridged by the software engineering steps, that
are specification. design and coding.
• Bridges gap between application domain and PL domain known as
specification gap.
• Bridges the gap between PL domain and execution domain as
execution gap.
SWAPNALI R.PAWAR~(RIT) 5
Language processor

• The specification gap is bridge by the software development team.


• Execution gap is bridged by the designer of the programming language processor. Like
compiler or interpreter.
• Specification gap is semantic gap between two specification of the sametask.
• Execution gap is gap between semantics of programs (same task but different PL).

Specification Gap Execution gap

Application domain PL. Domain Execution domain

Fig.Specification and Execution gap

SWAPNALI R.PAWAR~(RIT) 6
SWAPNALI R.PAWAR~(RIT) 7
Language processor Definition
It is software which bridges a specification or execution gap.
Activity performed by language processor called as Language Processing activities.
▪ Source program
▪ Target program
Arrange of LP is defined to meet practical requirements-
▪ ✓ Language translator - bridges an execution gap to the machine languagelike
assembler and compiler
▪ ✓ Detranslator - bridges the same as the language translator, but in thereverse
manner.
▪ ✓ Preprocessor - is a language processor which bridges an execution gap but
not translator.
▪ ✓ Language migrator - bridges specification gap between two PLs.
SWAPNALI R.PAWAR~(RIT) 8
Think & Write

1.The designer expresses the ideas in terms related to the........ of the software.

A. Application Domain
B. Execution Domain
C. PL Domain
D. Program Generator Domain

SWAPNALI R.PAWAR~(RIT) 9
Think and Write Ans:

A. Application Domain

SWAPNALI R.PAWAR~(RIT) 10
Complier and Interpreter Complier
Compiler:
It is a translator which takes input i.e. High-Level Language and produces an output of low-
level language i.e. machine or assembly language.
A compiler is more intelligent than an assembler it checks all kinds of limits, ranges, errors,
etc

Interpreter:
An interpreter is a program that translates a programming language into a comprehensible
language.
It translates only one statement of the program at a time.

SWAPNALI R.PAWAR~(RIT) 11
Interpreter
Advantages of Interpreter

•Programs written in an Interpreted language are easier to debug.


•Interpreters allow the management of memory automatically, which
reduces memory error risks.
•Interpreted Language is more flexible than a Compiled language.

Disadvantages of Interpreter

•The interpreter can run only the corresponding Interpreted program.


•Interpreted code runs slower in comparison to Compiled code.

SWAPNALI R.PAWAR~(RIT) 12
Compiler
Advantages of Compiler

•Compiled code runs faster in comparison to Interpreted code.


•Compilers help in improving the security of Applications.
•As Compilers give Debugging tools, which help in fixing errors easily.

Disadvantages of Compiler

•The compiler can catch only syntax errors and some semantic errors.
•Compilation can take more time in the case of bulky code.

SWAPNALI R.PAWAR~(RIT) 13
Comparison between Compiler & Interpreter
Interpreter Compiler
Translates program one statement at a Scans the entire program and translates it
time. as a whole into machine code.

Interpreters usually take less amount of Compilers usually take a large amount of
time to analyze the source code. However, time to analyze the source code. However,
the overall execution time is comparatively the overall execution time is comparatively
slower than compilers. faster than interpreters.

Generates Object Code which further


No Object Code is generated, hence are
requires linking, hence requires more
memory efficient.
memory.

Programming languages like JavaScript, Programming languages like C, C++, Java


Python, Ruby use interpreters. use compilers.

SWAPNALI R.PAWAR~(RIT) 14
SWAPNALI R.PAWAR~(RIT) 15
Language Processing Activities

A.Program generation activities

B.Program execution activities


1.Program Translation
2.Program Interpretation

SWAPNALI R.PAWAR~(RIT) 16
Language processing activity
The language processing activities divided into two parts, that
bridges the specification gap and execution gap.
1.Program generation activities
2.Program execution activities

Program generation activities:


Aims to generation of a program. Source is the application domain
and target is the PL domain. It bridges specification gap.

Program execution activities:


Aims to execute a program written in PL source is PL. domain and
target is execution domain.It bridges execution gap.

SWAPNALI R.PAWAR~(RIT) 17
Program generation Activity

• The program generator is a software system which accepts the specification


of a program to be generated and generates program in a the target
PL.Domain.
• This activity is done by program generator domain.
Errors

Program Program Program in Target


Specification Generator PL.

Fig-Program generation Activity

SWAPNALI R.PAWAR~(RIT) 18
SWAPNALI R.PAWAR~(RIT) 19
Program Execution activities
Two popular models for program execution are:
1.Program Translation
2.Program Interpretation
The program translation model bridges the execution gap by translating a program written in a
PL called source program(SP), into an equivalent program in the machine language called
target program(TP). Errors

M/C
Program Target
Translator Language
Specification Program
Program

Fig .Program Translation

SWAPNALI R.PAWAR~(RIT) 20
Program Translation activities
Characteristics of the program translation model are:

1. A program must be translated before it can be executed.

2. The translated program may be saved in file. The saved program


may be executed repeatedly.

3. A program must be retranslated following modifications.

4. It reads the source program and stores it in its memory.


SWAPNALI R.PAWAR~(RIT) 21
Program Translation:
During interpretation it takes a source statement, determines its
meaning, and performs actions like computation and I/O which
implement it.

SWAPNALI R.PAWAR~(RIT) 22
Program Interpretation activities
In the program interpretation the CPU use a program counter(PC) to note
the address of the next instruction to be executed.

This instruction is subjected to the instruction execution cycle consisting


following step:

1. Fetch the instruction


2. Decode the instruction to determine the operation to be performed.
3. Execute the instruction.

SWAPNALI R.PAWAR~(RIT) 23
Program Interpretation activities
• At the end of the cycle. The PC is updated and the cycle is repeated for
next instruction.
• Thus, the PC can indicate which statement of the source program is to
interpreted next.

SWAPNALI R.PAWAR~(RIT) 24
Think and Write
1.______________is a software system which generates a program in the target PL.
A. Program Generator
B. Program Specification
C. Program Execution
D. program Interpretation

2.The CPU use_____________ to note the address of the next instruction to be executed.
A. program counter(PC)
B. Pretty printer
C. static checker
D. None of these

SWAPNALI R.PAWAR~(RIT) 25
Think and Write

1.Program Generator

1.Program counter(PC)

SWAPNALI R.PAWAR~(RIT) 26
Advantage and disadvantage of interpreter

Advantage of interpreter:
is that it is executed line by line which helps users to find errors easily

Disadvantage of interpreter
is that it takes more time to execute successfully than compiler.

SWAPNALI R.PAWAR~(RIT) 27
Fundamentals of Language
Processing

SWAPNALI R.PAWAR~(RIT) 28
Language processing Language processing

Analysis of source program + Synthesis of target program


• The collection of language processor components engaged in the analysis of source
program constitutes analysis phase of a language processor.
• Components engaged in synthesizing a target program constitutes synthesis phase of a
language processor.
• The specification of source language forms the basis of source program analysis
• The specification consists of three components.
• Lexical rules:
• Syntax rules:
• Semantic rules:

SWAPNALI R.PAWAR~(RIT) 29
Language processing

The specification consists of three components-

Lexical rules: These govern the formation of valid lexical units in


the source program.
Syntax rules: These govern the formation of valid statements in
source language,
A Semantic rules: These associate meaning with valid statements
of thelanguage.

SWAPNALI R.PAWAR~(RIT) 30
Language processing
• The specification consists of three components.
• The analysis phase uses each component of source language specification to
determine the relevant information concerning the statement in the source
program.
• Thus the analysis of source program consists of lexical, syntax and semantic
analysis.
• The synthesis phase is concerned with the construction of target language
statements which have same meaning as source statements.
• This consists of two main activities:
1. Creation of data structures in the target program.
2. Generation of target code

SWAPNALI R.PAWAR~(RIT) 31
SWAPNALI R.PAWAR~(RIT) 32
SWAPNALI R.PAWAR~(RIT) 33
SWAPNALI R.PAWAR~(RIT) 34
SWAPNALI R.PAWAR~(RIT) 35
SWAPNALI R.PAWAR~(RIT) 36
Think and Write
What is language processing pass? Illustrate.

SWAPNALI R.PAWAR~(RIT) 37
Think and Write
Language processing pass is the processing of every statement in a
source program, or its equivalent representation, to perform a set of
language processing function.

✔ For example, for a two pass translator, following activities are carried
out in two passes:

✓ Pass 1:
It performs analysis of source program and note relevant information.

✓ Pass 2:
Performs Synthesis of Target Program

SWAPNALI R.PAWAR~(RIT) 38
Thank You !

SP
SWAPNALI R.PAWAR~(RIT) 40

You might also like