0% found this document useful (0 votes)
5 views46 pages

System Software: Macro Processors Overview

Module V of the System Software course covers key concepts such as macro preprocessors, text editors, debuggers, and device drivers. It details the functions and algorithms of macro processors, including macro definition, invocation, and expansion, as well as types of macros like simple, parameterized, nested, and recursive macros. Additionally, it discusses machine-independent features of macro processors and provides insights into their design and implementation.

Uploaded by

binomotrade7850
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views46 pages

System Software: Macro Processors Overview

Module V of the System Software course covers key concepts such as macro preprocessors, text editors, debuggers, and device drivers. It details the functions and algorithms of macro processors, including macro definition, invocation, and expansion, as well as types of macros like simple, parameterized, nested, and recursive macros. Additionally, it discusses machine-independent features of macro processors and provides insights into their design and implementation.

Uploaded by

binomotrade7850
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Module V System Software(CST 305)

MODULE V
 Macro Preprocessor
o Macro Instruction Definition and Expansion.
o One pass Macro processor Algorithm and data structures
o Machine Independent Macro Processor Features
 Concatenation of Macro Parameters
 Generation of unique labels
 Conditional Macro Expansion
 Keyword Macro Parameters
o Macro processor design options
 Recursive Macro Expansion
 General-Purpose Macro Processors
 Macro Processing within Language Translators
 Text Editors
o Overview of Editing
o User Interface
o Editor Structure.
 Debuggers
o Debugging Functions and Capabilities
o Relationship with other parts of the system
o Debugging Methods
 By Induction
 Deduction
 Backtracking
 Device drivers
o Anatomy of a device driver
o Character and block device drivers
o General design of device drivers

 Macro Instruction (Macro)


o It is simply a notational convenience for the programmer to write a
shorthand version of a program.
o It represents a commonly used group of statements in the source program.

 Macro Preprocessor
o Function: Substitution of one group of characters or lines for another.
o It does not perform analysis of the text it handles.

1 CS KTU LECTURES
Reference Book: System Software: An Introduction to System Programming, Leland L Beck
Module V System Software(CST 305)

o It doesn‟t concern the meaning of the involved statements during macro


expansion.
o The design of macro pre-processor is machine independent.
o Macro processors are used in
 Assembly language
 High-level programming languages, e.g., C or C++
 OS command languages
 General purpose

 BASIC MACROPROCESSOR FUNCTIONS


o The fundamental functions common to all macro processors are:
 Recognize Macro Definition
 Recognize Macro Invocation/ Macro Calls
 Expand Macro Calls

o Macro Definition
 Assembler directives used in macro definition
 MACRO: specifies the be n ginning of a macro definition
 MEND: specifies the end of a macro definition
 Syntax of Macro:
Macro_Name MACRO parameters
-----
----- Body
-----
MEND
 Macro Prototype statement: The first line of the macro definition
is called macro prototype statement.

2 CS KTU LECTURES
Reference Book: System Software: An Introduction to System Programming, Leland L Beck
Module V System Software(CST 305)

 The symbol in the label field of the prototype statement is the macro
name.
 Parameters are begins with „&‟
 Body: The statements that will be generated as the expansion of the
macro

o Macro Invocation (Macro Call)


 A macro invocation statement contains the name of the macro being
invoked and the arguments to be used in expanding the macro.
Macro_Name parameters
 Difference between macro call and procedure call
 Macro call: Statements of the macro body are expanded each time
the macro is invoked.
 Procedure call: statements of the subroutine appear only one,
regardless of how many times the subroutine is called.

o Macro Expansion
 Each macro invocation statement will be expanded into the statements
that form the body of the macro.
 Arguments from the macro invocation are substituted for the parameters
in the macro prototype (according to their positions).
 In the definition of macro: parameter
 In the macro invocation: argument
 Comment lines within the macro body will be deleted.
 Macro invocation statement itself has been included as a comment line
 The label on the macro invocation statement has been retained as a label
on the first statement generated in the macro expansion
 Example:
Source Code Expanded Code
PGM START 0 PGM START 0
ABC MACRO &A,&B . ABC P,Q //Comment line
STA &A STA P
STB &B STB Q
MEND .ABC R,S //Comment line
ABC P,Q STA R
ABC R,S STB S
END END

3 CS KTU LECTURES
Reference Book: System Software: An Introduction to System Programming, Leland L Beck
Module V System Software(CST 305)

4 CS KTU LECTURES
Reference Book: System Software: An Introduction to System Programming, Leland L Beck
Module V System Software(CST 305)

 After macro expansion the code will be as follows

5 CS KTU LECTURES
Reference Book: System Software: An Introduction to System Programming, Leland L Beck
Module V System Software(CST 305)

 Problem of the label in the body of macro:


 If the same macro is expanded multiple times at different places in
the program. There will be duplicate labels, which will be treated as
errors by the assembler.
 Solutions:
o Do not use labels in the body of macro.
o Explicitly use PC-relative addressing instead.
 Eg:
 JEQ *+11 //jump to the location LOCCTR + 11
 JLT *-14 //jump to the location LOCCTR – 14
o It is inconvenient and error-prone.

o Example:
 The following program shows an example of a SIC/XE program using
macro Instructions.
 This program defines two macros:
 RDBUFF: Similar to RDREC subroutine
 WRDUFF: Similar to WRREC subroutine
 Line 10 and 100 are the beginning of first and second macro definition.
 The instruction on line 55 is JEQ *-3
 Means jump to 3 location back.
 This type of PC relative addressing mode is used to avoid labels in
the macro body.
 The MAIN program contains 3 macro calls on line 190, 210 and 220.
 Each macro invocation statement has been expanded into the statements
that form the body of the macro, with the arguments from macro
invocation substituted for the parameters in macro prototype.
 The arguments and parameters are associated with one another
according to their positions.
 The macro definition has been deleted since they have been no longer
needed after macros are expanded

 TYPES OF MACROS
o Simple Macro
o Parameterized Macro
o Nested Macro
o Recursive Macro

6 CS KTU LECTURES
Reference Book: System Software: An Introduction to System Programming, Leland L Beck
Module V System Software(CST 305)

 Simple Macro
o A macro without argument is called simple macro.
Source Code Expanded Code
ABC MACRO . ABC
STA A STA A
STB B STB B
MEND . ABC
ABC STA A
ABC STB B

 Parameterized Macro
o A macro with argument is called parameterized macro.
o Two types of Parameterized Macros
 Positional Parameters
 Keyword Parameters

o Positional Parameters
 The programmer must specify the arguments in proper order.
 Parameters and arguments are associated according to their position
in the macro prototype and invocation.
 When the macro is called, the parameters will be replaced within the
macro body by the value specified.
 If an argument is to be omitted, a null argument should be used to
maintain the order in the macro invocation statement.
Source Code Expanded Code
ABC MACRO &A,&B . ABC P,Q
STA &A STA P
STB &B STB Q
MEND . ABC Q,P
ABC P,Q STA Q
ABC Q,P STB P

o Keyword Parameters
 Arguments may appear in any order.
 Each argument value is written with a keyword that names the
corresponding parameter. Each parameter name is followed by =
 Null arguments no longer need to be used.

7 CS KTU LECTURES
Reference Book: System Software: An Introduction to System Programming, Leland L Beck
Module V System Software(CST 305)

Source Code Expanded Code


ABC MACRO &A=,&B= . ABC A=P,B=Q
STA &A STA P
STB &B STB Q
MEND . ABC B=Q,A=P
ABC A=P,B=Q STA P
ABC B=Q,A=P STB Q

 Nested Macro
o A macro body may contain another macro definition
o Example: Here the macro SWAP defines another macro STORE inside
it.
SWAP MACRO &X,&Y //Outer Macro Definition
LDA &X
LDX &Y
STORE MACRO &X,&Y //Inner Macro Definition
STA &Y
STX &X
MEND
MEND
o The expansion of nested macro calls follows the last-in-first-out
rule(LIFO).
o The expansion of latest macro call is completed first.

 Recursive Macros
o A macro definition contains another macro call. This call may be the
same macro or a different macro.
ABC MACRO &A,&B
--------
--------
PQR X,Y
--------
--------
MEND
PQR MACRO &P,&Q
--------
--------
MEND

8 CS KTU LECTURES
Reference Book: System Software: An Introduction to System Programming, Leland L Beck
Module V System Software(CST 305)

 MACRO PROCESSOR ALGORITHM AND DATA STRUCTURES


o Macro Processors can be implemented in two ways
 Two Pass Macro Preprocessor
 Pass 1: All macro definitions are processed
 Pass 2: All macro invocation statements are expanded
 Disadvantage: Nested macros definitions are not allowed.

 Single Pass Macro Preprocessor


 Nested macro definitions are allowed but nested calls are not
allowed.
 The definition of a macro must appear in the source program before
any statements that invoke that macro.

 Data Structures for One Pass Macro Preprocessor


o Three Data Structures
 Definition table (DEFTAB)
 The macro definition is stored in definition table
(DEFTAB), which contains
o Macro prototype statement
o Macro body statements
 Comment lines from macro definition are not entered into
DEFTAB.

 Name table (NAMTAB)


 Stores macro names
 For each macro definition, NAMTAB contains pointers to
beginning and end of definition in DEFTAB.

 Argument table (ARGTAB)


 When macro invocation statements are recognized, the
arguments are stored in ARGTAB according to their
position in argument list.
 As the macro is expanded, arguments from ARGTAB are
substituted for the corresponding parameters in the macro
body.

9 CS KTU LECTURES
Reference Book: System Software: An Introduction to System Programming, Leland L Beck
Module V System Software(CST 305)

 The position notation is used for the parameters.


o &A has been converted to ?1
o &B has been converted to ?2, and so on.
 When the ?n notation is recognized in a line from
DEFTAB, a simple indexing operation supplies the
property argument from ARGTAB.

 Algorithm for One Pass Macro Preprocessor


ONE_PASS_MACRO()
{ EXPANDING= FALSE
while OPCODE !=’END’
{
GETLINE()
PROCESSLINE()
}
}

PROCESSLINE()
{ Search NAMETAB for OPCODE
If found then EXPAND()
Else if OPCODE=’MACRO’ then DEFINE()
Else Write source line to expanded file
}

DEFINE()
{ Enter macro name into NAMTAB
Enter macro prototype into DEFTAB
LEVEL = 1
While LEVEL > 0
{ GETLINE()
If this is not a comment line
{ Substitute positional notation for parameters
10 CS KTU LECTURES
Reference Book: System Software: An Introduction to System Programming, Leland L Beck
Module V System Software(CST 305)

Enter line into DEFTAB


If OPCODE=’MACRO’ LEVEL = LEVEL+1
Else If OPCODE=’MEND’ LEVEL = LEVEL-1
}
}
Store in NAMETAB pointers to beginning and end of definition
}

EXPAND()
{ EXPANDING = TRUE
Get prototype statement from DEFTAB
Set up arguments from macro invocation in ARGTAB
Write macro invocation to expanded file as comment
While not end of macro definition
{ GETLINE()
PROCESSLINE()
}
EXPANDING = FALSE
}

GETLINE()
{ If EXPANDING==TRUE
{
Get next line of macro definition from DEFTAB
Substitute arguments from ARGTAB for positional notation
}
Else Read next line from input file
}
o The procedure DEFINE, which is called when the beginning of a
macro definition is recognized, makes the appropriate entries in
DEFTAB and NAMTAB.
o When a macro definition is being entered into DEFTAB, the
normal approach is to continue until an MEND directive is
reached.
o This would not work for nested macro definition because the
first MEND encountered in the inner macro will terminate the
whole macro definition process.
o To solve this problem, a counter LEVEL is used to keep track of
the level of macro definitions.
 Increase LEVEL by 1 each time a MACRO directive is read.
 Decrease LEVEL by 1 each time a MEND directive is read.
o A MEND terminates the whole macro definition process when
LEVEL reaches 0.

11 CS KTU LECTURES
Reference Book: System Software: An Introduction to System Programming, Leland L Beck
Module V System Software(CST 305)

o This process is very much like matching left and right


parentheses when scanning an arithmetic expression.

o EXPAND is called to set up the argument values in ARGTAB


and expand a macro invocation statement.

o The procedure GETLINE gets the next line to be processed


 This line may come from DEFTAB or from the input file,
depending upon whether the Boolean variable EXPANDING
is set to TRUE or FALSE.

 MACHINE INDEPENDENT MACRO PROCESSOR FEATURES


o Following are the features that are not directly related to the architecture of
computer for which the macro processor is written
 Concatenation of Macro Parameters
 Generation of unique labels
 Conditional Macro Expansion
 Keyword Macro Parameters

o Concatenation of Macro Parameters


 Parameters to be concatenated with other character strings.
 Suppose a program contains a set of series of variables:
 XA1, XA2, XA3,…
 XB1, XB2, XB3,… etc.
 If similar processing is to be performed on each series of variables, the
programmer might want to incorporate this processing into a macro
instruction.
 The parameter to such a macro instruction could specify the series of
variables to be operated on (A, B, C …).
 The macro processor constructs the symbols by concatenating X, (A, B,
…), and (1,2,3,…) in the macro expansion.
 Such parameters are begins with & and ends with . ( is a
concatenation operator. It will not appear in the macro expansion).

12 CS KTU LECTURES
Reference Book: System Software: An Introduction to System Programming, Leland L Beck
Module V System Software(CST 305)

 Example:

o Generation of unique labels


 Labels in the macro body may cause “duplicate labels” problem if the
macro is invocated and expanded multiple times.
 Use of relative addressing at the source statement level is very
inconvenient, error-prone, and difficult to read.
 It is highly desirable to
 Let the programmer use label in the macro body
 Let the macro processor generate unique labels for each macro
expansion.
 Labels used within the macro body should begin with $.
 During macro expansion, the $ will be replaced with $xx, where xx is a
two-character alphanumeric counter of the number of macro instructions
expanded.
 For the first macro expansion in a program, xx will have the value
AA.
 For succeeding macro expansions, xx will be set to AB, AC etc.
 This allows 1296 macro expansions in a single program
 Example:
Source Code Expanded Code
PGM START 0 PGM START 0
ABC MACRO &X ………..
……….. $AAL1 ………..
$L1 ……….. JEQ $AAL1 1st macro expansion
JEQ $L1 ………..
……….. ………..
MEND $ABL1 ………..
ABC A JEQ $ABL1 2nd macro expansion
ABC B ………..
END END
13 CS KTU LECTURES
Reference Book: System Software: An Introduction to System Programming, Leland L Beck
Module V System Software(CST 305)

o Conditional Macro Expansion


 Normally same macro calls will generate same set of statements.
 Conditional Macro Expansion (Conditional Assembly): Sequence of
statements generated for macro expansion is depends on the arguments
supplied in the macro invocation.
 Conditional assembly depends on parameters provides
 Macro-time variables
 Any symbol that begins with symbol & and not a macro instruction
parameter inside a macro definition is considered as macro-time
variable.
 Used to store working values during the macro expansion
o Usually store the evaluation result of Boolean expression
o Control the macro-time conditional structures
 It is initialized to 0
 SET macro processor directive is used to assign a particular value to
a macro time variable.
o Ex: &EORCK SET 1
&EORCTR SET &EORCTR + 1
Here EORCK is a Macro-time variable and this statement will
not be in the expanded code.

 Macro-time conditional structure


 IF-ELSE-ENDIF
 WHILE-ENDW

 IF-ELSE-ENDIF structure
 The macro processor must maintain a symbol table
 This table contains the values of all macro-time variables used
 Entries in this table are made or modified when SET statements are
processed.
 This table is used to look up the current value of a macro-time
variable whenever it is required.
 When an IF statement is encountered during the expansion of a
macro, the specified Boolean expression is evaluated. If value is
o TRUE
 The macro processor continues to process lines from
DEFTAB until it encounters the next ELSE or ENDIF
statement.
 If ELSE is encountered, then skips to ENDIF
14 CS KTU LECTURES
Reference Book: System Software: An Introduction to System Programming, Leland L Beck
Module V System Software(CST 305)

o FALSE
 The macro processor skips ahead in DEFTAB until it finds
the next ELSE or ENDIF statement.
 Ex:
MACRO &COND
………….
IF (&COND NE „‟)
PART I
ELSE
PART II
END IF
………….
ENDM
o Part I is expanded if condition part is true, otherwise part II is
expanded
o Compare operator: NE, EQ, LE, GT
 IF, ELSE and ENDIF statements will not be in the expanded code.

 WHILE-ENDW structure(Macro-time looping statement)


 When a WHILE statement is encountered during the expansion of a
macro, the specified Boolean expression is evaluated. If the value is
o TRUE
 The macro processor continues to process lines from
DEFTAB until it encounters the next ENDW statement.
 When ENDW is encountered, the macro processor returns to
the preceding WHILE, re-evaluates the Boolean expression,
and takes action based on the new value.
o FALSE
 The macro processor skips ahead in DEFTAB until it finds
the next ENDW statement and then resumes normal macro
expansion.

 WHILE and ENDW statements will not be in the expanded code.

15 CS KTU LECTURES
Reference Book: System Software: An Introduction to System Programming, Leland L Beck
Module V System Software(CST 305)

 Example:
Macro Definition:

Macro Call:

Expanded Code:

16 CS KTU LECTURES
Reference Book: System Software: An Introduction to System Programming, Leland L Beck
Module V System Software(CST 305)

Macro Call:

Expanded Code:

Macro Call:

Expanded Code:

17 CS KTU LECTURES
Reference Book: System Software: An Introduction to System Programming, Leland L Beck
Module V System Software(CST 305)

 Example:
Macro Definition:

%NITEMS is a macro processor function that returns the number of


members in the argument list.

Macro Call:

Here &EOR is (00, 03, 04). Then %NITEMS(&EOR) is 3.


On the first iteration the expression &EOR[&CTR] on line 65 has the
value 00. On the second iteration it has the value 03, and so on.

18 CS KTU LECTURES
Reference Book: System Software: An Introduction to System Programming, Leland L Beck
Module V System Software(CST 305)

Expanded Code:

o Keyword Macro Parameters


 Positional parameters
 Parameters and arguments are associated according to their positions
in the macro prototype and invocation.
 The programmer must specify the arguments in proper order.
 If an argument is to be omitted, a null argument should be used to
maintain the proper order in macro invocation statement.
 For example: Suppose a macro instruction ABC has 10 possible
parameters, but in a particular invocation of the macro only the 3rd
and 9th parameters are to be specified. The macro call statement is
ABC ,,DIRECT,,,,,,3
 Disadvantage: It is not suitable if a macro has a large number of
parameters, and only a few of these are given values in a typical
invocation.
 Solution: Use Keyword parameters instead of Positional parameters.
 Keyword parameters
 Each argument value is written with a keyword that names the
corresponding parameter.
 Arguments may appear in any order.
 Null arguments no longer need to be used.
 Each parameter name is followed by =

19 CS KTU LECTURES
Reference Book: System Software: An Introduction to System Programming, Leland L Beck
Module V System Software(CST 305)

 After the =, a default value can be specified for some of the


parameters. The parameters are assumed to have this default value if
its name does not appear in the macro invocation statement.
 For example: Suppose a macro instruction ABC has 10 possible
parameters, but in a particular invocation of the macro only the 3rd
and 9th parameters are to be specified. If the 3rd parameter is named
&TYPE and 9th parameter is named &CHANNEL. The macro call
statement will be
ABC TYPE=DIRECT,CHANNEL=3
or
ABC CHANNEL=3, TYPE=DIRECT
 Advantage:
o Easier to read
o Less error-prone than the positional method

 Example:
Macro Definition:
The following macro definition contains 5 parameters. Three of them
(&INDEV,&EOR,&,MAXLTH) having default value.

20 CS KTU LECTURES
Reference Book: System Software: An Introduction to System Programming, Leland L Beck
Module V System Software(CST 305)

Macro Call:

Expanded Code

 MACROPROCESSOR DESIGN OPTIONS


o Recursive Macro Expansion
o General-Purpose Macro Processors
o Macro Processing within Language Translators

o Recursive Macro Expansion


 Invoke a macro from another macro definition
 Example:

21 CS KTU LECTURES
Reference Book: System Software: An Introduction to System Programming, Leland L Beck
Module V System Software(CST 305)

 RDBUFF and RDCHAR are the 2 macro definitions.


 RDCHAR is used to read a character from an input device to
register A.
 Macro Call: RDBUFF BUFFER, LENGTH, F1
 One pass macro processor cannot handle such kind of recursive macro
invocation and expansion
 Reasons:
 The procedure EXPAND would be called recursively, thus the
invocation arguments in the ARGTAB will be overwritten.
o The procedure EXPAND would be called when the macro was
recognized. The arguments from the macro invocation would be
entered into ARGTAB as follows.

o The Boolean variable EXPANDING would be set to TRUE, and


expansion of the macro invocation statement would begin. The
processing would proceed normally until statement invoking
RDCHAR is processed. This time, ARGTAB would look like

 The Boolean variable EXPANDING would be set to FALSE when


the “inner” macro expansion is finished, that is, the macro process
would forget that it had been in the middle of expanding an “outer”
macro.
22 CS KTU LECTURES
Reference Book: System Software: An Introduction to System Programming, Leland L Beck
Module V System Software(CST 305)

o At the expansion, when the end of RDCHAR is recognized,


EXPANDING would be set to FALSE. Thus the macro
processor would forget that it had been in the middle of
expanding a macro when it encountered the RDCHAR
statement. In addition, the arguments from the original macro
invocation (RDBUFF) would be lost because the value in
ARGTAB was overwritten with the arguments from the
invocation of RDCHAR
 A similar problem would occur with PROCESSLINE since this
procedure too would be called recursively.
 Solutions:
 Write the macro processor in a programming language that allows
recursive calls, thus local variables will be retained.
 Use a Stack to save ARGTAB.
 Use a counter to identify the expansion

 Single Pass Macro Processor Algorithm to handle recursive calls


ONE_PASS_MACRO()
{
EXPANDING= FALSE
SP = -1
N=0
while OPCODE !=’END’
{ GETLINE()
PROCESSLINE()
}
}
PROCESSLINE()
{ Search NAMETAB for OPCODE
If found then EXPAND()
Else if OPCODE=’MACRO’ then DEFINE()
Else Write source line to expanded file
}
DEFINE()
{ Enter macro name into NAMTAB
Enter macro prototype into DEFTAB
LEVEL = 1
While LEVEL > 0
{ GETLINE()
If this is not a comment line
{ Substitute positional notation for parameters
Enter line into DEFTAB

23 CS KTU LECTURES
Reference Book: System Software: An Introduction to System Programming, Leland L Beck
Module V System Software(CST 305)

If OPCODE=’MACRO’ LEVEL = LEVEL+1


Else If OPCODE=’MEND’ LEVEL = LEVEL-1
}
}
Store in NAMETAB pointers to beginning and end of definition
}
Procedure EXPAND
{ set S ( SP + N + 2) = SP
set SP = SP + N + 2
set S ( SP + 1 ) =DEFTAB index from NAMTAB
setup macro call argument list array in S( SP + 2)……….S(SP + N + 1) where N =
total number of arguments
while not end of macro definition and Level !=0 do
{
GETLINE
PROCESSLINE
}
N = SP – S( SP) – 2 //reset previous calls number of arguments
SP = S( SP ) // previous calls starting index of S
}
procedure GETLINE
{
if SP != -1 then
{
increment DEFTAB pointer to next entry
set S ( SP + 1) = S (SP + 1) + 1
get the line from DEFTAB with the pointer S( SP+1)
Substitute arguments from macro call S (SP + 2)……….. S(SP + N + 1)
}
else
read next line from input file
}

o General-Purpose Macro Processors


 Macro processors that do not dependent on any particular programming
language, but can be used with a variety of different languages.
 Example: ELENA macro processor
 Advantages
 Programmers do not need to learn many macro languages.
 Although its development costs are somewhat greater than those for
language specific macro processor, this expense does not need to be
repeated for each language, thus save substantial overall cost.

24 CS KTU LECTURES
Reference Book: System Software: An Introduction to System Programming, Leland L Beck
Module V System Software(CST 305)

 Disadvantages
 Large number of details must be dealt with in a real programming
language
 In a typical programming language, there are several situations in
which normal macro parameter substitution should not occur
 Each programming language has its own methods for identifying
comments
o Some languages use special characters to mark the start and end
of a comment.
o Some languages use a special character to mark only the start of
a comment. The comment is automatically terminated at the end
of the source line.
o Some languages use a special symbol to flag an entire line as a
comment.
o In most assembly languages, an characters on a line following
the end of the instruction operand field are automatically taken
as comments
 Each programming languages having their own facilities for
grouping together terms, expressions, or statements
o Some languages use keywords such as begin and end for
grouping statements.
o Others use special characters such as { and } for grouping
statements.
 A more general problem involves the tokens of the programming
language like identifiers, constants, operators, and keywords
o Languages differ their restrictions on the length of identifiers
and the rules for the formation of constants.
o Some languages support multiple character operators. Eg: **
 Another potential problem with general purpose macro processors
involves the syntax used for macro definitions and macro invocation
statements. With most special purpose macro processors, macro
invocations are very similar in form to statements in the source
programming language.

o Macro Processing within Language Translators


 The macro processors we discussed are called “Preprocessors”.
 Process macro definitions
 Expand macro invocations

25 CS KTU LECTURES
Reference Book: System Software: An Introduction to System Programming, Leland L Beck
Module V System Software(CST 305)

 Produce an expanded version of the source program, which is then


used as input to an assembler or compiler
 Alternative design: Combine the macro processing functions with the
language translator
 Line-by-line macro processor
 Integrated macro processor

 Line-by-Line Macro Processor


 Used as a sort of input routine for the assembler or compiler
o Read source program
o Process macro definitions and expand macro invocations. The
expanded code is not written to an expanded source file.
o Pass output lines to the assembler or compiler
 Benefits
o Avoid making an extra pass over the source program. So it is
more efficient than using a macro processor.
o Data structures required by the macro processor and the
language translator can be combined (e.g., OPTAB and
NAMTAB)
o Utility subroutines can be used by both macro processor and the
language translator.
 Scanning input lines
 Searching tables
 Data format conversion
o It is easier to give diagnostic messages related to the source
statements.

 Integrated Macro Processor


 An integrated macro processor can potentially make use of any
information about the source program that is extracted by the
language translator.
 Many real programming languages have certain characteristics that
create unpleasant difficulties.
o Ex : Consider the following FORTRAN statement
 DO 100 I = 1,20
 It is a normal DO statement
 100 is the line number
 DO 100 I = 1
 An assignment statement
26 CS KTU LECTURES
Reference Book: System Software: An Introduction to System Programming, Leland L Beck
Module V System Software(CST 305)

 DO100I is variable (blanks are not significant in


FORTRAN)
o The proper interpretation of the characters DO, 100 etc, cannot
be decided until the rest of the statement is examined. Such
interpretations would be very important for a macro expansion
with macro name I.
 An integrated macro processor can support macro instructions that
depend upon the context in which they occur.
o The expansion of macro could also depend up on a variety of
characteristics of its arguments.

 Disadvantages of Line-by-line and Integrated Macro processor:


 More expensive: The cost of macro processor development must be
added to the cost of language translator, which result in a more
expensive piece of software.
 More complex: The assembler will be more complex.
 Size is larger: The size may be problem if the translator is to run on
a computer with limited memory.
 Take more time: The assembler will take more time to assemble the
code.

27 CS KTU LECTURES
Reference Book: System Software: An Introduction to System Programming, Leland L Beck
Module V System Software(CST 305)

 Text Editors
o Text editors are software programs that enable the user to create and edit
text files.
o Example: Notepad, Wordpad, MS Word etc.
o A document may include objects such as Computer programs, Equations,
Tables, Diagrams, Line art, Photographs etc.

o There are two types of editors:


 Manuscript-oriented editor: It is associated with characters, words,
lines, sentences and paragraphs
 Program orient editors: These are associated with identifiers,
keywords etc.

o Overview of an Editing Process


 The document-editing process is an interactive user-computer dialogue
designed to accomplish four tasks
1. Select the part of the target document to be viewed and manipulated
2. Determine how to format this view on-line and how to display it.
3. Specify and execute operations that modify the target document.
4. Update the view appropriately

 Editing Steps:
 TRAVELING
o It involves traveling through the document to locate the area of
interest such as next screenful , bottom and find pattern.
 FILTERING
o Selection of what is to be viewed and manipulated is controlled
by filtering.
o Filtering extracts the relevant subset of the target document at
the point of interest such as next screenful of text or next
statement.
 FORMATING
o Determines how the result of filtering will be seen on a display
screen.
 EDITING PHASE
o Editing phase involves – insert, delete, replace, move, copy, cut,
paste, etc...

28 CS KTU LECTURES
Reference Book: System Software: An Introduction to System Programming, Leland L Beck
Module V System Software(CST 305)

 User Interface of a Text Editor


 The user of an interactive editor is presented with a conceptual
model of the editing system.
 This model is an abstract framework on which the editor and the
world on which it operates are based.
 Some of the early line editors simulated the world of keypunch.
These editors allowed operations on numbered sequences of 80
character card-image lines, either with in a single line or on an
integral number of lines.
 Some modern screen editors define a world in which a document is
represented as a quarter-plane of text lines, unbounded both down
and to the right. The user sees through a cutout, only a rectangular
subset of this plane on a multiline display terminal.
 The user interface of a text editor is concerned with
o Input Devices
o Output Devices
o Interaction Languages

 Input Devices
o Input devices are used to enter elements of the text being edited,
to enter commands, and designate editable elements.
o Input devices are categorized as:
 Text devices/String Devices
 These are typically typewriter like keyboards on which
user presses and releases keys, sending unique code for
each key.
 Virtually all computer keyboards are of QWERTY type.
 Button devices/Choice Devices
 Special function keys on alpha numeric keyboard
 It generates an interrupt or set a system flag, usually
causing an invocation of an associated application
program action.
 Locator devices
 These are two dimensional analog to digital converters
that position a cursor symbol on the screen by observing
the users movement of the device.
 Ex: Mouse , Joysticks, Touch screens, Data tablets etc
 Voice input device
 It translates spoken words to their textual equivalents.
29 CS KTU LECTURES
Reference Book: System Software: An Introduction to System Programming, Leland L Beck
Module V System Software(CST 305)

 Output Devices
o Output devices let the user view the elements being edited and
the result of the editing operations.
o The first output devices were teletypewriters, that generates
output on paper
o Next is Cathode ray tube (CRT), which uses CRT screen for
display.
o The modern professional workstations are based on personal
computers with high resolution displays.

 Interaction Languages
o The interaction language could be,
 Typing oriented/ Text command oriented
 Oldest editors are typing oriented
 The user communicates with the editor by typing text
strings.
 These strings are sent to the editor and are usually
echoed to the output device.
 The users should remember the exact form of all
commands.
 In order to avoid that, we can use function key
interfaces.
 Each command is associated with marked key on
keyboard .This eliminate much typing
o Eg: Insert Key, Shift Key, Control key etc.
 Disadvantage: Have too many unique keys which will
result in a unwieldly keyboard.

 Menu-oriented user interface


 Menu-oriented user interface has menu with a multiple
choice set of text strings or icons.
 Menus can be turned on or off.
 User performs actions by selecting items from the menu
 Drawback :
o When user requires many possible actions and several
choices to complete an action, this is not a suitable
method.
o Display area for text is limited.

30 CS KTU LECTURES
Reference Book: System Software: An Introduction to System Programming, Leland L Beck
Module V System Software(CST 305)

o Text Editor Structure

 Command Language processor


 The command language processor accepts input from the user‟s
device, analyse the tokens and syntactic structure of the commands.
 It may invoke semantic routines.
 The semantic routines may involve traveling, editing, viewing and
display functions.

 Editing Component
 Editing operations are always specified by the user.
 The editing component is a collection of modules dealing with the
editing tasks.
 The start of the area to be edited is determined by the current
editing pointer maintained by the editing component.
 The current editing pointer can be set or reset explicitly by the user
with the travelling commands or implicitly by the system as a side
effect of previous editing operation.

31 CS KTU LECTURES
Reference Book: System Software: An Introduction to System Programming, Leland L Beck
Module V System Software(CST 305)

 Editing Filter and Editing Buffer


 The editing commands invoke the editing filter.
 This component filters the document to generate a new editing
buffer based on the current editing pointer as well as the editing
filter parameters.
 These parameters are specified by both the user and the system.
 They provide information such as the range of text that can be
affected by an operation.

 Viewing Component
 It is a collection of modules responsible for determining the next
view.
 In viewing a document, the start of the area to be viewed is
determined by the current viewing pointer.
 The pointer can be set or reset explicitly by the user with a traveling
command or implicitly by the system as a result of the previous
editing operation.
 The pointer is maintained by the viewing component.
 When the display needs to be updated, the viewing component
invokes the viewing filter.

 Viewing Filter and Viewing Buffer


 When the display needs to be updated, the viewing component
invokes viewing filter.
 Viewing component filters the document to generate a new viewing buffer
based on the current viewing pointer as well as on the viewing filter
parameters.
 Eg: The user of a certain editor might travel to line 75, and after viewing it,
decide to change all occurrences of “abc” by “pqr” in line 1 through 50 are
then filtered from the document to become the editing buffer. Successive
substitutions take place in this editing buffer, without corresponding
updates of the view.
 The parameters are specified by both the user and the system.
 In line editors, the viewing buffer may contain the current line.
 In screen editors, this may contain the rectangular cut-out of text.
 The buffer is then passed to the display component of editor

32 CS KTU LECTURES
Reference Book: System Software: An Introduction to System Programming, Leland L Beck
Module V System Software(CST 305)

 Traveling Component
 It performs the setting of the current editing and viewing pointers,
and thus determines the point at which the viewing and editing
begins.

 Display Component
 Display operations are always specified implicitly by the other three
categories of operations : editing, traveling and viewing.
 It takes the idealized view from the viewing component and maps it
to a physical output device in the most efficient manner
 It produces a display by mapping the viewing buffer to a rectangular
subset of the screen, usually called a screen.

 Main Memory and File System


 Loading an entire document into main memory be infeasible.
 So load only a part of the document into main memory.

 Debugger
o A debugger is a computer program that is used to test and debug other
programs.
o Debugging is the activity of locating and correcting errors.
o It can start once a failure has been detected.
o An interactive debugging system provides programmers with facilities that
aid in testing and debugging a program.
o Debugging is a two step process that begins when you find an error as a
result of a successful test case
 Determine the exact nature and location of the suspected error within the
program.
 Fixing the error.
o Difference between Testing and Debugging
 Testing: process of executing a program with the aim of finding errors or
bugs.
 Debugging: correcting these errors found during testing is debugging.

o Types of bugs:
 Compile time: Usually caught with compiler
 Eg: Syntax, Spelling, type mismatch etc.
 Design time:
 Flawed algorithm
33 CS KTU LECTURES
Reference Book: System Software: An Introduction to System Programming, Leland L Beck
Module V System Software(CST 305)

 Produce incorrect output.


 Program Logic: Produce incorrect output.
 Memory nonsense:
 Eg: null pointers, array bounds, bad types etc.
 It is a run time exception
 Interface errors between modules, threads, programs: It is a run time
exception
 Off normal conditions:
 Failure of some part of software of underlying machinery
 It causes incomplete functionality.
 Deadlocks: Multiple processes fighting for a resource.

o Debugging Functions and Capabilities


 A set of unit test functions
 One group of such functions deals with execution
sequencing(observation and control of the flow of program
execution).
o Eg:
 The program may be halted after a fixed number of
instructions are executed.
 Breakpoints: Execution to be suspended when a specific
point in the program is reached.
 Programmer can define conditional expressions that are
continually evaluated during the debugging session. Program
execution is suspended when any of these conditions
becomes true.
o After execution is suspended, other debugging commands can be
used to analyze the process of program and to diagnose errors
detected.

 Debugging system should provide the functions such as Tracing and


Traceback
 Tracing:
o Used to track the flow of execution logic and data modifications.
o The control flow can be traced at different levels of detail:
Procedure, branch, individual instruction, and so on.
o It is also based on conditional expressions.
 Traceback:
o Shows the path by which the current statement was reached.
34 CS KTU LECTURES
Reference Book: System Software: An Introduction to System Programming, Leland L Beck
Module V System Software(CST 305)

o It can also show which statements have modified a given


variable or parameter.

 Debugging systems should have a good program display capability.


 It is possible to display the program being debugged, with statement
numbers.
 Should be able to control the level at which display occurs
o The program may be displayed as it was originally written, after
macro expansion, and so on.
 The system should save all the debugging specifications (break
points, display modes, etc.) across each compilation, so the
programmer does not need to reissue all these debugging
commands.
 It should be possible to display or modify the content of any of the
variable and constants in the program, and then resume execution.

 Capability of handling multilingual situations


 Debugging systems can be divided in to two
o Language Dependent: Debugging system designed for a
particular programming language.
o Language Independent:
 Most user environment involves the use of several different
programming environments.
 It is a single debugging system designed for several
programming language.
 When the debugger receives control, the execution of the
program being debugged is temporarily suspended. The
debugger must then be able to determine the language in
which the program is written and set its context accordingly.
 The debugger should able to switch its context when a
program written in one language calls a program written in a
different language.

 Assignment statements that change the values of variables


during debugging should be processed according to the
syntax and semantics of the source programming language.
 COBOL: MOVE 3.5 TO A
 FORTRAN: A = 3.5

35 CS KTU LECTURES
Reference Book: System Software: An Introduction to System Programming, Leland L Beck
Module V System Software(CST 305)

 Conditional expressions should use the notion of the source


language
 Eg: A be not equal to B
o COBOL: IF A NOT EQUAL TO B
o FORTRAN: IF(A .NE. B)

 Able to deal with optimized code


 Optimization involves the rearrangement of segments of code in the
program.
 Eg:
o Eliminate loop invariant expressions
o Separate loops can be combined in to single loop
o Redundant expressions may be eliminated
o Blocks of code may be rearranged to eliminate unnecessary
branch instructions
 All these optimization create problems for the debugger and should
be handled carefully.

 Able to handle storage properly


 The compiler normally assigns a home location in main memory to
each variable.
 Variable value may be temporarily held in registers at various times
to improve speed of access.
 Statements referring these variables use the value stored in the
register, instead of taking the variable value from its home location.
 If the user changes the value of the variable in its home location
while debugging, the modified value might not be used by the
program.
 Solution: Variable may be permanently assigned to a register. There
may be no home location at all.

o Relationship with other parts of the system


 Debugger must always be available.
 It must appear to be a part of the run time environment and an
integral part of the system.
 When an error is discovered, immediate debugging must be
possible.
 The debugger must communicate and cooperate with other operating
system components.
36 CS KTU LECTURES
Reference Book: System Software: An Introduction to System Programming, Leland L Beck
Module V System Software(CST 305)

 Debugging is more important in production time than it is at application


development time.
 When an application fails during a production run, work dependent
on that application stops.
 The debugger must be consistent with the security and integrity
components of the system.
 The debugger must coordinate its activities with those of existing and
future language compilers and interpreters.
 The debugging facilities in existing languages will continue to exist
and be maintained.

o Debugging Methods
 Debugging By Induction(Reasoning strategy/thoughtful strategy)
 Many errors can be found by using a disciplined thought process
without the debugger ever going near the computer.
 One such thought process is induction which can figure out solution
to a problem.
 Here we start with our own experience and then generalize a rule
 This strategy assumes that once the symptoms of the errors are
identified, and the relationships between them are established, the
errors can be easily detected by just looking at the symptoms and the
relationships.

 Locate the pertinent data:


o Enumerate all you know about the problem.
o Collect available information, collect symptoms, error
occurrence, error conditions, effect of the failure etc.

37 CS KTU LECTURES
Reference Book: System Software: An Introduction to System Programming, Leland L Beck
Module V System Software(CST 305)

 Organize the data:


o Structure the collected data and determine success conditions
and the differences.
 Device a Hypothesis:
o Derive one or more hypothesis.
o If multiple theories are possible, then select the most probable
one first.
 Prove the Hypothesis:
o Hypothesis should completely explain the existence of clues.
 Fix the error:
o Implement the appropriate fixes based on the hypothesis.
o Verify the new code by rerunning it for the failure case and
make sure the fix corrects the error condition.

 Debugging By Deduction
 The process of deduction proceeds from some general theories or
premises, using the processes of elimination and refinement, to
arrive at a conclusion.

 Enumerate the possible Hypothesis


o Develop a list of all hypotheses for the failure case.
o They are theories to help you to structure and analyse the
available data.
 Use Data to eliminate possible hypothesis
o Carefully examine all of the data, particularly looking for
contradiction, and try to eliminate all but one of the possible
hypothesis.
 Refine remaining Hypothesis (Expand the remaining hypothesis)
o The possible hypothesis at this point might be correct, but it is
unlikely to be specific enough to pinpoint the error.

38 CS KTU LECTURES
Reference Book: System Software: An Introduction to System Programming, Leland L Beck
Module V System Software(CST 305)

o Hence the next step is to use the available clues to refine the
theory.
 Prove/Disprove the hypothesis
o Prove the reasonableness of the hypothesis

 Debugging By Backtracking
 Backtrack the incorrect result through the logic of the program until
you find the point where the logic went off track. That means, find
the point where the program gives incorrect result.
 For large programs, such analysis at the statement level would be
too tedious to perform. What we seek is to first narrow the user‟s
focus to a small region of the program that is likely to contain an
error, and then do statement level analysis within this region.
 The program is viewed as a sequence of logical blocks instead of
individual statements.
 One need only to think backwards at the program block level instead
of the statement level
 To perform such backward analysis using conventional interactive
debuggers, one would first set a breakpoint just before the last
logical block. If the program state is found to be correct at this point,
it would imply that the error occurred within the last block.
Otherwise another breakpoint would be set before the second-last
block, and the program reexecuted. If the program state is found to
be correct at that point, then we may conclude that the error resides
within that second-last block. Otherwise this process of setting
breakpoints in backward order and reexecuting the program
continues until the erroneous block is discovered.
 If N is the number of blocks in the program, then clearly this method
of setting breakpoints successively in backwards order and
reexecuting the program every time leads to an O(N2) cost for
execution and require only O(N) block executions.

 Device Drivers
o A Device Driver is glue between an OS and its I/O devices.
o Device drivers communicate directly with devices. They act as translators
converting generic requests received from the operating system into
commands that specific peripheral controllers can under-stand.
o Relationship between an application software, OS and device driver is
illustrated below.
39 CS KTU LECTURES
Reference Book: System Software: An Introduction to System Programming, Leland L Beck
Module V System Software(CST 305)

o The application software makes system calls to the OS requesting services.


The OS analyses these requests and when necessary issues requests to the
appropriate device driver. Device drivers in turn analyses the request from
OS and when necessary issues command to the hardware interface to
perform the operations needed to service the request

o Device driver simplifies the design of OS. Without the device drivers the
operating system would be responsible for talking directly to the hardware.
This would require the OS designer to include support for all the devices
that the users might want to connect to the computer. It would also mean
adding support to a new device would require modifying the OS. By
separating device driver's functions from OS, the designer can concentrate
on the issues related to the operation of the system as a whole. Thus device

40 CS KTU LECTURES
Reference Book: System Software: An Introduction to System Programming, Leland L Beck
Module V System Software(CST 305)

driver designer does not have to worry about the general issues related to
I/O management which is handled by the OS. The device driver writer can
connect any I/O device to the system without having to modify the OS.
Device drivers thus provide the OS with a standard interface to non-
standard I/O devices.

o Device Characteristics
 Identifier: A universally unique identifier that is intrinsic to the device.
 Operational State: Indicates whether the device is mounted or
unmounted.
 LUN: Logical Unit Number (LUN) within the SCSI target. The LUN
number is provided by the storage system. If a target has only one LUN,
the LUN number is always zero (0).
 Type: Type of device, for example, disk or CD-ROM.
 Drive Type: Information about whether the device is a solid-state drive
(SSD) or a regular non-SSD hard drive.
 Capacity: Total capacity of the storage device.

o Design Issues of Device Driver


 OS / Driver Communication
 Deals with exchange information (i.e command and data) between
device driver and OS
 Also includes support functions that the kernel provides for device
driver
 Driver / Hardware Communication
 Deals with exchange information (ie command and data) between
device driver and the device it controls.
 Deals with how the software talks to the hardware
 Deals with how the hardware talks to the software
 Driver Opertaions
 Interpreting commands received from OS
 Scheduling the requests
 Managing read and write (ie data transfer across OS and hardware).
 Accepting and processing H/W interrupts
 Maintain integrity of kernel's and driver's data structures

41 CS KTU LECTURES
Reference Book: System Software: An Introduction to System Programming, Leland L Beck
Module V System Software(CST 305)

o Types of device driver and their anatomy


 Based on the differences in the way they communicate with UNIX OS
the device drivers are classified into
 Block Drivers
 Character Drivers
 Terminal Drivers
 Stream Drivers

 Block Drivers
 It communicates with OS through a collection of fixed-sized buffers.
 Example: Disk drives
 The OS manages a cache of these buffers and attempts to satisfy
user requests for data by accessing buffers in the cache. The driver is
invoked only when the requested data is not in the cache or when
buffers in the cache have been changed and must be written out.

 Character Drivers
 It can handle I/O requests of arbitrary size and can be used to
support almost any type of device. Mostly used devices are Printers.
Usually character drivers are used for devices that either deal with
data a byte at a time or work best with data in chunks smaller or
larger than the fixed sized buffers used by block drivers (eg tape
drives). The only relevant difference between a char device and a
regular file is that you can always move back and forth in the regular
file, whereas most char devices are just data channels, which you
can only access sequentially.

42 CS KTU LECTURES
Reference Book: System Software: An Introduction to System Programming, Leland L Beck
Module V System Software(CST 305)

 Major difference between block and character device driver is that


the user processes interact with block drivers indirectly through the
buffer cache but their relationship with character drivers is very
direct. From figure we can see that the I/O request is passed
essentially unchanged from the process to the driver and the driver is
responsible for transferring the data directly to find from the user
process's memory.

 Terminal Drivers
 Same as character drivers but specialized to deal with
communication terminals that connect users to OS. Terminal drivers
are not only responsible for shipping data to and from user terminals
but also for handling line editing, tab expansion and many other
terminal functions that are part of the standard UNIX terminal
interface. Because of this additional processing that terminal drivers
must perform it is useful to consider terminal drivers as a separate
type of driver.

43 CS KTU LECTURES
Reference Book: System Software: An Introduction to System Programming, Leland L Beck
Module V System Software(CST 305)

 Stream Drivers(Network Device Drivers)


 It can handle high speed communication devices such as networking
adapters that deal with unusual sized chunks of data , that need to
handle protocol. Network Devices use stream drivers. Network
devices support layered protocol. If character drivers where used for
network devices, it would require that each layer of the protocol be
implemented within the single driver. This causes lack of modularity
and re-usability and thus reduces the efficiency of the system. As a
result stream device drivers where developed which is an extension
of character drivers. It send and receive packets. They do not know
about individual connections. Network drivers have unique names
(e.g., eth0). They are not present in the file system. They support
protocols and streams related to packet transmission (i.e., there is no
read and write). Network devices are accessed via the BSD socket
interface and the networking subsytems.

Character device driver Block device driver


A Character ('c') Device is one with A Block ('b') Device is one with which the
which the Driver communicates by Driver communicates by sending entire blocks
sending and receiving single characters of data
(bytes, octets).
Sequential stream of data access. Random data access nature
Handles comparatively lesser amount of Handles larger amount of data in the form of
data in the form of byte stream blocks.
Faster mode data transfer rate as they Slower data transfer rate as chunks of data
don‟t use the block access method. involved.
Operates directly with the user process of Designed to operate indirectly through buffer
data transfer. cache.
Abbreviated as „ cdev ‟. Abbreviated as „ blkdev
Eg: Serial ports, Parallel ports, Sounds Eg: Hard disks, USB, Cameras, Disk On Key
44 CS KTU LECTURES
Reference Book: System Software: An Introduction to System Programming, Leland L Beck
Module V System Software(CST 305)

Previous Year University Questions


1. Explain the concept of macro definition and expansion with the help of
examples.
2. Differentiate between a macro and a subroutine. Illustrate macro definition and
expansion using an example
3. What is the difference between macro invocation and subroutine call?
4. A code segment need to be repeatedly used in various parts of assembly
language program and fast execution is also needed. Would you use a macro or
a subroutine? Justify your answer with help of examples
5. Explain the types of macro with example

6. Describe the data structures used in a one pass macro processor algorithm. Give
examples
7. What are the data structures required for a macroprocessor algorithm? Explain
the format of each
8. Give the algorithm for a one pass macro processor
9. Explain the working of One pass Macro Processor
[Link] the algorithm for one pass macro processor and explain the process,
showing when and how the different data structures are used

[Link] macro processor features are independent of the machine architecture


Give the details of such machine independent macro-processor features
[Link] short note on concatenation of macro parameters within a character string
[Link] are unique labels generated in a Macro Expansion
[Link] it possible to include labels in the body of macro definition? Justify your
answer.
[Link] it possible to use labels within the macro body? Explain your answer with the
help of examples. Also illustrate a possible solution for the same
[Link] conditional macro expansion with an example
[Link] the different types of conditional macro expansion statements and their
implementation with examples
[Link] notes on keyword macro parameters, giving suitable examples
[Link] between keyword and positional macro parameters
[Link] the following machine independent macro processor features
o Generation of unique labels
o Keyword macro parameters

[Link] and explain the different design options available for macroprocessors
[Link] recursive macro expansion with example

45 CS KTU LECTURES
Reference Book: System Software: An Introduction to System Programming, Leland L Beck
Module V System Software(CST 305)

[Link] notes on Recursive Macro Expansion


[Link] do you mean by recursive macro expansion? What are the possible
problems associated with it?
[Link] does a one pass macroprocessor handle recursive macro expansion?
Explain with example
[Link] are the important factors considered while designing general purpose
macro processors?
[Link] is meant by line-by-line macro processor? What are its advantages?

[Link] the overview of editing process


[Link] notes on the user interface of a text editor
[Link] notes on text editor
[Link] the structure of a text editor with the help of a diagram
[Link] the different types of Text Editors and User Interface
[Link] out the main four tasks associated with the Document Editing Process
[Link] a neat diagram show the relationship between viewing and editing buffer

[Link] is a Debugger?
[Link] notes on the debugging functions and capabilities of an interactive
debugging system
[Link] out the criteria that should be met by the user interface of an efficient
debugging system
[Link] the different debugging methods in detail
[Link] down the situations where debugging by induction, deduction and
backtracking are used, explaining each process

[Link] a simple diagram illustrate the communication pathway of an application


program to a device through a device driver.
41.A new hardware device is plugged into a system. Which is the appropriate
system software needed for the proper working of the new hardware? Give its
functionalities and general architecture
[Link] the general design of device driver
[Link] the features of device drivers
[Link] are the two parts of a device driver?
[Link] the general design and anatomy of a device driver with the help of
diagrams
[Link] are the functions of device drivers?
[Link] between character and block device drivers
[Link] is a Device Driver? What are the major design issues of a Device Driver?

46 CS KTU LECTURES
Reference Book: System Software: An Introduction to System Programming, Leland L Beck

You might also like