Introduction
to
SYSTEM SOFTWARE
What is system software?
Designed to control the operations
of computer.
Tasks performed such as
controlling storage devices,
monitoring CPU, I/O devices and
also provide basic operations for
Application Soft wares to operate.
System programs were developed
to make computers better adapted
to the needs of their users.
3
Categories of System
Software
System Control Programs
System Support Programs
System Development Programs
System Control Programs
Controls execution of programs
Manage storage devices
Manage processing resources
Eg:-Operating System, DBMS
System Support Programs
Routine services are provided to
the computer programs and users
Eg:- libraries, task manager.
System Development
Programs
Helps in creation of application
programs
Eg:- compilers,
Interpreters,debugging aids
IS IT ENOUGH ??????????
This is only
what
comprises
system
software??
8
NO IT COMPRISES
WITHIN A LOT WHAT WE
CAN THINK
Language processors
To understand this we need
to define application domain
and execution domain..
Application
domain:-When
the designer expresses the
ideas in his terms
Execution
domain:Implementation of the ideas
and their interpretation.
10
Differences do arise in
performing/implementing the
ideas , when these differences
arise the activities we perform
are known as Language
Processing Activities.
This difference is known as
Semantic gap.
11
Consequences of
Semantic Gap
Large development times
Large development efforts
Poor quality of software
Solution was Programming Languages
Specification,design and coding steps
PL Implementation steps
HENCE ONE NEW DOMAIN INTRODUCED::::PL DOMAIN
12
Semantic Gap divided into two i.e
Specification and Design Gap
Execution gap
Specification Gap:- It is the semantic
gap between two specifications of
the same task.
Execution Gap:- It is the gap
between semantics of programs
(that perform the same task) written
in different programming languages.
13
A LANGUAGE PROCESSOR
is a software which bridges
a specification or execution
gap.
&
LANGUAGE PROCESSING is
the activity performed by a
language processor.
14
Source Program
(INPUT)
LANGUAGE
PROCESSOR
Target Program
(OUTPUT)
15
Types of Language
Processors
16
Language Translator
Detranslator
Preprocessor
Language Migrator
Interpreter
Problem-oriented languages
&
Procedure-oriented
languages
Problem-oriented languages are
one which have large execution
gap i.e PL domain is very close
to application domain.
Procedure oriented languages
are
which
provide
general
purpose facilities required in
most application domains. It
results in large specification gap.
17
Types of Language
Processing Activities
Program Generation Activities
Program Execution Activities
18
Program Generation
It is a software system which
accepts the specification of a
program to be generated, and
generates a program in the target
PL.
It introduces a new domain i.e
program generator
domain.
Errors
Program
specification
19
Program
generator
Program in
target PL
Program Execution
Two models are proposed i.e
translation and interpretation.
Program Translation :- Bridges
the execution gap by
translating a program written in
PL i.e. source program into a
machine or assembly language
program of a computer system
i.e. target program.
20
Errors
Source program
Translator
Data
m/c language
program
Target program
Characteristics of program
translation:
A program must be translated
before it can be executed.
The translated program may be
saved in a file.
A program must be retranslated
following modifications.
21
Program Interpretation
Reads the source program, stores in its
memory.
Determines the meaning and performs
actions reading the source statement.
Instruction execution cycle:
Fetch the instruction
Decode the instruction
Execute the instruction
22
Interpretation cycle
Fetch the statement
Analyze the statement and
determine its meaning, viz. the
computation to be performed and
its operands.
Execute the meaning of the
statement.
23
Interpreter
Memory
PC
Source
Errors
program
+
Data
(a)
Memory
CPU
Machine
language
PC
program
Data
(b)
24
Characteristics of
Interpretation
Source program is retained in the
source form itself, i.e no target
program exists,
A statement is analyzed during its
interpretation.
25
Fundamentals of
Language Processing
Language Processing Analysis
of SP + Synthesis of TP
26
A specification of the
source language forms the
basis of source program
analysis
Specification consists of
three components:
. Lexical rules
. Syntax rules
. Semantic rules
27
Synthesis Phase
It constructs target language
statements which have the same
meaning as a source statement. It
consists of: Creation of data structures in the
target program (memory
allocation)
Generation of target code (code
generation)
28
Phases and passes of a
language processor
Language processor
Source
program
Analysis
Synthesis
phase
phase
Errors
29
Errors
Target
program
Analysis of a source statement
can be immediately followed
by synthesis of equivalent
target statements. But two
things might interrupt it.
Forward References
Issues concerning memory
requirements and organization
of a language processor.
30
Forward references
A forward reference of a program
entity is a reference to the entity
which precedes its definition in
the program.
31
Language processor pass
It is the processing of every
statement in a source program, or
its equivalent representation, to
perform a language processing
function.
Pass I: Perform analysis of the
source program and note relevant
information.
Pass II: Perform synthesis of target
program
32
Intermediate
Representation
It is a representation of a source
program which reflects the effect
of some, but not all, analysis and
synthesis tasks are performed
during language processing.
33
First pass is also known as front
end and second pass is also
known as back end.
Source
program
Front end
Back end
Intermediate
representation
(IR)
34
Target
program
Properties of an IR:
Ease of use
Processing efficiency
Memory efficiency
35
The front end analyses the source
program and constructs an IR. All
actions performed by the front
end, except lexical and syntax
analysis, are called semantic
actions.
36
Semantic actions are:
Checking semantic validity of
constructs in SP
Determining the meaning of SP
Constructing an IR.
37
Output of front end
IR consists of:
Tables of information
Intermediate code(IC) which is a
description of the source program.
38
Tables
It
contain
the
information
obtained during different analyses
of SP.Most important table is the
symbol table which contains
information
concerning
all
identifiers. It is built during lexical
analysis. Semantic analysis adds
information concerning symbol
attributes
while
processing
declaration statements.
39
Intermediate Code
It is a sequence of IC units, each
IC unit representing the meaning
of one action in SP. IC units may
contain references to the
information in various tables.
40
Example:Following shows the IR produces by
the analysis phase.
i : integer;
a,b: real;
a:=b+i;
41
Symbol Table
symbol
42
type
int
a
real
real
i*
real
temp
real
length
address
Intermediate code
1. Convert(Id,#1) to real, giving
(Id,#4)
2. Add(Id,#4) to (Id,#3), giving
(Id,#5)
3. Store (Id,#5) in (Id,#2)
43
Lexical analysis(Scanning)
It identifies the lexical units in a
source statement.Then classifies
into different lexical classes.e.g.
ids,constants, reserved ids, etc.
and enters them into different
tables.
It builds a descriptor, called a
token, for each lexical unit.A
token contains two fieldsclass
code and number in class.
44
Syntax analysis(Parsing)
It processes the string of tokens
built by lexical analysis to
determine the statement class.e.g
assignment statement, etc.
Then IC is build and passed to
semantic analysis.
45
Semantic
analysis(Scanning)
Declaration statements: results in
addition of information to the
symbol table i.e type, length and
dimensionality of variables.
Imperative statements: identifies
the sequence of actions necessary
to implement the meaning of a
source statement.
46
Semantic analysis of
a:=b+i
47
Information concerning the type of the
operands is added to the operand tree.
Rules of meaning an assignment
statement indicate that the expression
on the right hand side should be
evaluated first. Hence focus shifts to
the right subtree rooted at +.
Rules of addition indicate that type
conversion of i should be performed to
ensure type compatibility of the
operands of+. This leads to the
action
Convert i to real, giving i*.
which is added to the
sequence of actions. The IC
tree under consideration is
modified to represent the
effect of this action. The
symbol i* is now added to the
symbol table.
a,real
+
a,real
+
:=
:=
b, real
48
i,real
b, real
i*,real
Rules of addition indicate that the
addition is now feasible. This leads to
the action ---Add i* to b, giving temp.
The IC tree is transformed and temp
is added to the symbol table.
:=
o The assignment can be performed
a, real
temp, real
now.This leads to the action---Store
temp in a.
49
Source
program
Lexical
errors
Scanning
Tokens
Syntax
errors
Parsing
Trees
Semantic
errors
Semantic
analysis
IC
IR
Front end of the compiler
50
Symbol table
Constants table
Other tables
The Back End
It performs memory
allocation and code
generation.
51
Memory allocation
It is done by simple presence of
symbol table.
Memory
requirement
of
an
identifier is computed from its
type, length and dimensionality,
and memory is allocated to it.
The address of the memory area
is entered in the symbol table.
52
Code generation
It uses knowledge of the target
architecture,
i.e.
knowledge
of
instructions and addressing modes in
the target computer, to select the
appropriate instructions. The important
issues in code generation are:
Determine the places where the
intermediate results should be kept, i.e.
whether they should be kept in
memory locations or held in machine
registers.This is preparatory step for
code generation.
53
Determine which instructions should
be used for type conversion operation.
Determine which addressing modes
should be used for accessing variables.
IR
IC
Memory
allocation
Symbol table
Constants table
Code
generation
Target program
Back end
54
Other tables