CH 01
CH 01
to
SYSTEM SOFTWARE
Categories of System
Software
System Control Programs
System Support Programs
System Development Programs
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
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
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
Language processor
Source
program
Analysis
Synthesis
phase
phase
Errors
29
Errors
Target
program
Forward references
31
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
Source
program
Front end
Back end
Intermediate
representation
(IR)
34
Target
program
Properties of an IR:
Ease of use
Processing efficiency
Memory efficiency
35
36
37
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
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
48
i,real
b, real
i*,real
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
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
IC
Memory
allocation
Symbol table
Constants table
Code
generation
Target program
Back end
54
Other tables