gujarat technological university -...

13

Upload: vohanh

Post on 05-Mar-2018

242 views

Category:

Documents


4 download

TRANSCRIPT

Page 1: GUJARAT TECHNOLOGICAL UNIVERSITY - mytoolbag.inmytoolbag.in/media/GTUPAPERS/1/2/COMPUTER/S5/SP.pdf · 1 Overview of System Software ... name of data structures used in compiler
Page 2: GUJARAT TECHNOLOGICAL UNIVERSITY - mytoolbag.inmytoolbag.in/media/GTUPAPERS/1/2/COMPUTER/S5/SP.pdf · 1 Overview of System Software ... name of data structures used in compiler

GUJARAT TECHNOLOGICAL UNIVERSITY

SYSTEM PROGRAMMING

SUBJECT CODE: 2150708

B.E. 5thSEMESTER

Type of course: System Programming

Prerequisite: Data Structures and Operating Systems

Rationale: NA

Teaching and Examination Scheme:

Teaching Scheme Credits Examination Marks Total

Marks L T P C Theory Marks Practical Marks

ESE

(E)

PA (M) ESE (V) PA

(I) PA ALA ESE OEP

4 0 2 6 70 20 10 20 10 20 150

Content:

Sr. No. Content Total

Hrs

%

Weightage

1 Overview of System Software

Introduction, Software, Software Hierarchy, Systems Programming,

Machine Structure, Interfaces, Address Space, Computer Languages,

Tools, Life Cycle of a Source Program, Different Views on the Meaning

of a Program, System Software Development, Recent Trends in Software

Development, Levels of System Software

06 10%

2 Overview of Language Processors

Programming Languages and Language Processors, Language

Processing Activities, Program Execution, Fundamental of Language

Processing, Symbol Tables

Data Structures for Language Processing: Search Data structures,

Allocation Data Structures.

06 15%

3 Assemblers

Elements of Assembly Language Programming, Design of the

Assembler, Assembler Design Criteria, Types of Assemblers, Two-Pass

Assemblers, One-Pass Assemblers, Single pass Assembler for Intel x86 ,

Algorithm of Single Pass Assembler, Multi-Pass Assemblers, Advanced

Assembly Process, Variants of Assemblers Design of two pass

assembler,

06 15%

4 Macro and Macro Processors

Introduction, Macro Definition and Call, Macro Expansion, Nested

Macro Calls, Advanced Macro Facilities, Design Of a Macro Pre-

processor, Design of a Macro Assembler, Functions of a Macro

Processor, Basic Tasks of a Macro Processor, Design Issues of Macro

Processors, Features, Macro Processor Design Options, Two-Pass Macro

Processors, One-Pass Macro Processors

08 20%

5 Linkers and Loaders 06 20%

Page 3: GUJARAT TECHNOLOGICAL UNIVERSITY - mytoolbag.inmytoolbag.in/media/GTUPAPERS/1/2/COMPUTER/S5/SP.pdf · 1 Overview of System Software ... name of data structures used in compiler

Suggested Specification table with Marks (Theory):

Distribution of Theory Marks

R Level U Level A Level N Level E Level C Level

7 30 33 - - -

Legends: R: Remembrance; U: Understanding; A: Application, N: Analyze and E: Evaluate C:

Create and above Levels (Revised Bloom’s Taxonomy)

Note: This specification table shall be treated as a general guideline for students and teachers. The actual

distribution of marks in the question paper may vary slightly from above table.

Reference Books:

1) System Programming by D M Dhamdhere McGraw Hill Publication

2) System Programming by Srimanta Pal OXFORD Publication

3) System Programming and Compiler Construction by R.K. Maurya & A. Godbole.

4) System Software – An Introduction to Systems Programming by Leland L. Beck, 3rd Edition,

Pearson Education Asia, 2000

5) System Software by Santanu Chattopadhyay, Prentice-Hall India,2007

Course Outcome:

After learning the course the students should be able to:

1. To understand the execution process of HLL programs.

2. To understand the working of scanners and parsers.

Introduction, Relocation of Linking Concept, Design of a Linker, Self-

Relocating Programs, Linking in MSDOS, Linking of Overlay Structured

Programs, Dynamic Linking, Loaders, Different Loading Schemes,

Sequential and Direct Loaders, Compile-and-Go Loaders, General

Loader Schemes, Absolute Loaders, Relocating Loaders, Practical

Relocating Loaders, Linking Loaders, Relocating Linking Loaders,

Linkers v/s Loaders

6 Scanning and Parsing

Programming Language Grammars, Classification of Grammar,

Ambiguity in Grammatic Specification, Scanning, Parsing, Top Down

Parsing, Bottom up Parsing, Language Processor Development Tools,

LEX, YACC

06 10%

7 Compilers

Causes of Large Semantic Gap, Binding and Binding Times, Data

Structure used in Compiling, Scope Rules, Memory Allocation,

Compilation of Expression, Compilation of Control Structure, Code

Optimization

04 5%

8 Interpreters & Debuggers

Benefits of Interpretation, Overview of Interpretation, The Java

Language Environment, Java Virtual Machine,

Types of Errors, Debugging Procedures, Classification of Debuggers,

Dynamic/Interactive Debugger

04 5%

Page 4: GUJARAT TECHNOLOGICAL UNIVERSITY - mytoolbag.inmytoolbag.in/media/GTUPAPERS/1/2/COMPUTER/S5/SP.pdf · 1 Overview of System Software ... name of data structures used in compiler

3. To understand the basic design of various system software.

4. To implement various system software.

List of Experiments and Design based Problems (DP)/Open Ended Problem:

(Pl. Note: List of Experiments should be as per theory covered in the class, below mentioned practical

are just for the reference purpose)

1. Write a program to implement the lexical analyzer.

2. Write a Lexical Analyzer (using lex utility for UNIX).

3. Write a program to left factor the given grammar.

4. Write a program to remove the Left Recursion from a given grammar.

5. Aim: Implement Recursive Descendent Parsing for the given Grammar.

E -> T + E / T

T -> F * T / F

F -> ( E ) / i

6. Implement Predictive Parser for the given grammar.

E -> T + E / T

T -> F * T / F

F -> ( E ) / i

7. Write a SAL program in text file and generate SYMTAB and LITTAB

8. Use macro features of C language

9. Write a program which generates Quadruple Table for the given postfix String

10. Write a C program to parse a given string using Predictive parsing for given

grammar.

type → simple | ↑id | array [ simple ] of type

simple → integer | char | num dotdot num

List of Open Source Software/learning website:

www.cs.jhu.edu/~scott/pl/lectures/parsing.html

www.en.wikipedia.org/wiki/System_programming

ACTIVE LEARNING ASSIGNMENTS: Preparation of power-point slides, which include videos,

animations, pictures, graphics for better understanding theory and practical work – The faculty will allocate

chapters/ parts of chapters to groups of students so that the entire syllabus to be covered. The power-point

slides should be put up on the web-site of the College/ Institute, along with the names of the students of the

group, the name of the faculty, Department and College on the first slide. The best three works should

submit to GTU.

Page 5: GUJARAT TECHNOLOGICAL UNIVERSITY - mytoolbag.inmytoolbag.in/media/GTUPAPERS/1/2/COMPUTER/S5/SP.pdf · 1 Overview of System Software ... name of data structures used in compiler

1

1

Seat No.: ________ Enrolment No.___________

GUJARAT TECHNOLOGICAL UNIVERSITY BE - SEMESTER–V (NEW) - EXAMINATION – SUMMER 2017

Subject Code: 2150708 Date: 03/05/2017 Subject Name: System Programming Time: 02:30 PM to 05:00 PM Total Marks: 70 Instructions:

1. Attempt all questions.

2. Make suitable assumptions wherever necessary.

3. Figures to the right indicate full marks.

MARKS

Q.1 Short Questions 14

1 Define : Language Processor.

2 _________ phase performs type checking task.

[ a] Lexical Analysis [b] Syntax Analysis [c] Semantic Analysis

3 Define : Parse tree.

4 State True/False : Code optimization phase is optional phase of compiler.

5 Which phase of compiler will generate error if semicolon is missing in a c

program?

6 Define : intermediate code.

7 Define : Pattern.

8 State True/False : Top Down parsers can never work with left recursive

grammar.

9 Define: symbol Table.

10 Define: Semantic Gap.

11 Define : Backpatching.

12 State True/False : “Single pass assemblers cannot handle forward

references.”

13 Define : Macro Assembler.

14 State True/False : Symbol table is used to store mnemonics and opcodes.

Q.2 (a) Eliminate left recursion from following grammar.

S A

A Ad | Ae | aB | aC

B bBC | f

C g

03

(b) Construct LL(1) parsing table for following grammar.

S iCtSeS | iCtS | a

C b

04

(c) Construct an optimized DFA :

0*1*(0/1)#

07

OR

Page 6: GUJARAT TECHNOLOGICAL UNIVERSITY - mytoolbag.inmytoolbag.in/media/GTUPAPERS/1/2/COMPUTER/S5/SP.pdf · 1 Overview of System Software ... name of data structures used in compiler

2

2

(c) Show that following regular expressions are equivalent by constructing

optimized DFA.

(0/1)*

(0*/1*)*

07

Q.3 (a) What is Peephole optimization? Explain any two optimization

transformations in detail. 03

(b) Define and explain different intermediate code representations. 04

(c) What is main task of semantic analysis phase? Explain inherited and

synthesized attributes in detail with example. 07

OR

Q.3 (a) Define: L-Attributed definition in detail. 03

(b) State different storage allocation strategies. Explain static allocation and

stack allocation in detail. 04

(c) Generate Quadruple, Triple, Indirect Triple for following expression:

ans=a+b*c/2.0

07

Q.4 (a) What is program relocation? How relocation is performed by linker? 03

(b) Write and explain the algorithm for macro expansion. 04

(c) Explain in brief design of a Two Pass Assembler. 07

OR

Q.4 (a) What is overlay? Explain the execution of an overlay structure program. 03

(b) Explain in brief self relocating programs. 04

(c) Explain in detail any two advanced assembler directives. 07

Q.5 (a) Explain Types of grammar in detail. 03

(b) Compare and Contrast macro preprocessor and macro assembler. 04

(c) Explain in brief design the linker. 07

OR

Q.5 (a) Define: Ambiguous grammar. Also state example of same. 03 (b) Explain and compare two variants of intermediate code. 04 (c) Explain in brief the design of a macro assembler. 07

*************

Page 7: GUJARAT TECHNOLOGICAL UNIVERSITY - mytoolbag.inmytoolbag.in/media/GTUPAPERS/1/2/COMPUTER/S5/SP.pdf · 1 Overview of System Software ... name of data structures used in compiler

1

Seat No.: ________ Enrolment No.___________

GUJARAT TECHNOLOGICAL UNIVERSITY BE - SEMESTER–V(New) • EXAMINATION – WINTER 2016

Subject Code:2150708 Date:22/11/2016

Subject Name:System Programming

Time: 10:30 AM to 01:00 PM Total Marks: 70 Instructions:

1. Attempt all questions.

2. Make suitable assumptions wherever necessary.

3. Figures to the right indicate full marks.

MARKS

Q.1 Short Questions 14

1 A __________ is a language processor which bridges an execution gap but

is not a language translator

e

ee

e ree

exx ex execution

2 Justify (True/False): A language migrator provides portability of program.

3 Difference between Procedure oriented language and Problem oriented

language.

4 Describe the output of Lexical analysis.

5 Difference between Literal and Constant.

6 Describe the syntax of keyword parameter and the use of it.

7 What is the use of backpatching?

8 Which of system software always reside in main memory? What kind of

input this system software takes?

9 Define Handle, Grammar

10 How to avoid backtracking in top down parsing?

11 Justify (True/False): A positional parameter can have a default value.

12 Give name of data structures used in compiler

13 What is the use of POOLTAB in assembler?

14 What is JIT?

Q.2 (a) What are the basic tasks that must be performed by macro preprocessor? 03

(b) List out different forms of editor and explain each of them. 04

(c) Explain Left recursion, Left factoring and backtracking in top down parsing. 07

OR

(c) Develop an LL(1) parser table for the following grammer and

Parse the string using the parsing table : (id*id) + (id*id)

E->TA A->+TA| € T->VB B->*VB|€ V->id|(E)

07

Q.3 (a) Explain Absolute loader. 03

(b) Develop regular expression and DFAs for the following kind of strings:

1. a real number with optional integer and fraction part

2. a comment string in the C++ language.

04

(c) Write operator precedence table for arithmetic operators “+”, “*”, “-”, “/” ”(“,

“)”. Parse following expression using the table. id * (id + id )/ (id *id) 07

OR

Q.3 (a) How compiler implements scope rules? 03

(b) An assembly program contains the statement

X EQU Y + 25

Indicate how the EQU statement can processed if

(1) Y is a back reference

(2) Y is a forward reference

04

Page 8: GUJARAT TECHNOLOGICAL UNIVERSITY - mytoolbag.inmytoolbag.in/media/GTUPAPERS/1/2/COMPUTER/S5/SP.pdf · 1 Overview of System Software ... name of data structures used in compiler

2

(c) Write the data structure, intermediate code of following assembly

program. Write the assembly program output if value of N = 5.

START 101

READ N

MOVER BREG, ONE MOVEM BREG, TERM

AGAIN MULT BREG, TERM MOVER CREG, TERM

ADD CREG, ONE MOVEM CREG, TERM

COMP CREG, N BC LE, AGAIN

MOVEM BREG, RESULT PRINT RESULT

STOP N DS 1

RESULT DS 1 ONE DC ‘1’

TERM DS 1 END

07

Q.4 (a) Explain attributes of formal parameters in macro with syntax. 03

(b) Explain Object Module of a Program Unit P in Linker. 04

(c) Describe the use of stacks in Expansion of Nested macro calls with example. 07 OR

Q.4 (a) Explain Boostrap loader. 03

(b) What is Overlay? Explain the execution of an overlay structured program. 04

(c) Explain in detail how the following input gets processed in toy compiler.

int a;

real b,c;

c= a + b * 0.6;

07

Q.5 (a) Describe the level of System Software. 03

(b) Describe the use of REPT and IRP statement. 04

(c) Explain types of intermediate code representation of expression during

compilation in detail.

07

OR

Q.5 (a) What is pure and impure interpreter? 03

(b) Explain design of an editor. 04

(c) What is the use of static pointer and dynamic pointer in compiler? Explain

working of Display with suitable example. 07

*************

Page 9: GUJARAT TECHNOLOGICAL UNIVERSITY - mytoolbag.inmytoolbag.in/media/GTUPAPERS/1/2/COMPUTER/S5/SP.pdf · 1 Overview of System Software ... name of data structures used in compiler

1

Seat No.: ________ Enrolment No.___________

GUJARAT TECHNOLOGICAL UNIVERSITY BE - SEMESTER–V (NEW) - EXAMINATION – SUMMER 2016

Subject Code:2150708 Date:11/05/2016 Subject Name:System Programming Time:02:30 PM to 05:00 PM Total Marks: 70 Instructions:

1. Attempt all questions. 2. Make suitable assumptions wherever necessary. 3. Figures to the right indicate full marks.

Q.1 (a) Compare user-centric view and system-centric view of system software. 07

(b) What is Symbol table? Explain how one can organize Symbol table using

Linear Data Structure?

07

Q.2 (a) What are the Advanced Assembler Directives? Explain any two with example. 07

(b) List various phases of Language Processor. Explain any one phase in detail. 07

OR

(b) Given the source program:

START 100

A DS 3

L1 MOVER AREG, B

ADD AREG, C

MOVEM AREG, D

D EQU A+1

L2 PRINT D

ORIGIN A-1

C DC ‘5’

ORIGIN L2+1

STOP

B DC ‘19’

END L1

(a) Show the contents of the symbol table at the end of Pass I.

(b) Explain the significance of EQU and ORIGIN statement in the program

and explain how they are processed by the assembler.

(c) Show the intermediate code generated for the program.

07

Q.3 (a) Explain use and field of following tables of macro.

KPDTAB, MDT, EVTAB, SSTAB

07

(b) Explain following facilities for expansion time loop with example.

(1) REPT statement (2) IRP statement

07

OR

Q.3 (a) Explain following terms with suitable example.

(1) Expansion time variable (3) Semantic expansion

(2) Positional parameter (4) Macro Pre-processor

07

(b) Draw a flowchart and explain simple one pass macro processor. 07

Q.4 (a) With example explain how relocation is performed by linker? 07

Page 10: GUJARAT TECHNOLOGICAL UNIVERSITY - mytoolbag.inmytoolbag.in/media/GTUPAPERS/1/2/COMPUTER/S5/SP.pdf · 1 Overview of System Software ... name of data structures used in compiler

2

(b) Explain Absolute loader with example. 07

OR

Q.4 (a) What is overlay? Explain linking of overlay structured program. 07

(b) In brief explain relocating loader. 07

Q.5 (a) (1) Explain types of grammar. 03

(2) Explain lexical analysis of language processor. 04

(b) Given following expression: x = -a * b + -a * b

(1) Write three address codes for the expression.

(2) Optimize the three address code if it is possible to do so.

(3) Give triple implementation for the three address code of the expression.

07

OR

Q.5 (a) Explain recursive descendent parsing algorithm. 07

(b) What is interpreter? Explain pure & impure interpreters. 07

*************

Page 11: GUJARAT TECHNOLOGICAL UNIVERSITY - mytoolbag.inmytoolbag.in/media/GTUPAPERS/1/2/COMPUTER/S5/SP.pdf · 1 Overview of System Software ... name of data structures used in compiler

1

Seat No.: ________ Enrolment No.___________

GUJARAT TECHNOLOGICAL UNIVERSITY BE – SEMESTER – V (NEW) EXAMINATION – WINTER 2015

Subject Code: 2150708 Date:10/12/ 2015

Subject Name: System Programming

Time: 10:30am to 1:00pm Total Marks: 70 Instructions:

1. Attempt all questions.

2. Make suitable assumptions wherever necessary.

3. Figures to the right indicate full marks.

Q.1 (a) (i) Compare Problem oriented and Procedure oriented languages.

(ii) Define Following terms:

1. System Software

2. Semantic Gap

3. Specification Gap

4. Execution Gap

07

(b) (i) Explain types of grammars.

(ii) Write a regular expression for a language containing a binary string which

does not contain two consecutive 0s or two consecutive 1s anywhere.

07

Q.2 (a) Explain the various stages of the life cycle of a source program with a neat

diagram.

07

(b) Consider following assembly language program:

Show (i) Contents of Symbol Table (ii) Intermediate codes using Variant I

representation.

START 101

READ N

MOVER BREG, ONE

MOVEM BREG, TERM

AGAIN MULT BREG, TERM

MOVER CREG, TERM

ADD CREG, ONE

MOVEM CREG, TERM

COMP CREG, N

BC LE, AGAIN

MOVEM BREG, AGAIN

PRINT RESULT

STOP

N DS 1

RESULT DS 1

ONE DC ‘1’

TERM DS 1

END

Instruction opcode: STOP – 00, ADD – 01, MULT – 03, MOVER – 04,

MOVEM – 05, COMP – 06, BC – 07, READ – 09, PRINT – 10, LE – 02

Assembler directives: START – 01, END – 02

Declaration statements: DC – 01, DS – 02

Register code: BREG – 02, CREG – 03

07

OR

(b) Explain language processing activities. 07

Page 12: GUJARAT TECHNOLOGICAL UNIVERSITY - mytoolbag.inmytoolbag.in/media/GTUPAPERS/1/2/COMPUTER/S5/SP.pdf · 1 Overview of System Software ... name of data structures used in compiler

2

Q.3 (a) Construct NFA and DFA for following regular expression:

(0 | 1)*001#

07

(b) What is program relocation? How relocation is performed by linker? Explain

with example.

07

OR

Q.3 (a) Explain recursive descent parsing algorithm. 07

(b) List various phases of a language processor. Explain roles of phases of

Language Processor. Also explain symbol table.

07

Q.4 (a) Define forward references. How it can be solved using back-patching? Explain

with example.

07

(b) Explain Absolute Loader with example. 07

OR

Q.4 (a) Explain advanced assembler directives with suitable example. 07

(b) What is macro preprocessor? Explain steps of macro preprocessor design. 07

Q.5 (a) List out and explain various optimizing transformations of a compiler by giving

suitable examples.

07

(b) What is interpreter? Explain benefits of interpreter. Compare interpreter and

compiler.

07

OR

Q.5 (a) Define two macros of your choice to illustrate nested calls to these macros. Also

show their corresponding expansion.

07

(b) What are advanced macro programming facilities? Explain with example. 07

*************

Page 13: GUJARAT TECHNOLOGICAL UNIVERSITY - mytoolbag.inmytoolbag.in/media/GTUPAPERS/1/2/COMPUTER/S5/SP.pdf · 1 Overview of System Software ... name of data structures used in compiler