SSCD
SSCD
SSCD
Course Name SYSTEM SOFTWARE AND COMPILER DESIGN Max. Marks 100
Q.
No Questions CO BL Marks
.
PART – A (10 X 1 = 10 MARKS)
(Answer all the questions)
1. Compare single-pass and two-pass assemblers. CO1 U 1
2. Enumerate the assembler directives. CO1 R 1
3. Name the two pointers in the input buffer pair scheme. CO2 R 1
4. Define Lexeme. CO2 R 1
Identify whether the following grammar is ambiguous or not.
5. CO3 U 1
B -> B+B | BB | (B) | B* | a
Omit the left factoring from the following grammar, if any:
6. CO3 R 1
S ->SS+ | SS- | SS* | SS/ | a | b
7. What does a sound type system eliminate? CO4 R 1
8. Interpret the binding of names schematically. CO5 U 1
9. Infer the way the basic block leader is determined. CO6 U 1
10. Differentiate local optimization from global optimization. CO6 U 1
PART – B (6 X 3 = 18 MARKS)
(Answer all the questions)
11. Differentiate between system software and application software. CO1 U 3
12. Write a LEX program to identify even binary numbers. CO2 A 3
13. Write the rules for finding the FIRST and FOLLOW of non terminals. CO3 A 3
14. Give examples for the S-attributed and L-attributed definitions. CO4 U 3
15. Represent the way structural equivalence is maintained in type expressions. CO5 U 3
16. State the global variable analysis. CO6 R 3
PART – C (6 X 12 = 72 MARKS)
(Answer any five Questions from Q. No. 17 to 23, Q. No. 24 is Compulsory)
17. a. Describe the working principle of an absolute loader with the necessary
CO1 U 6
algorithms.
18. Explain the various phases of a compiler. Also, show the step-by-step
CO2 A 12
translation of the statement "Percentage = 0.01 * NoPassed /
TotalStrength" through the phases of the compiler to attain the target
language.
19. Construct a predictive parser for the following grammar and check
whether the input not (true or false) is parsed without errors.
bexpr ->bexpr or bterm | bterm CO3 A 12
bterm ->bterm and bfactor | bfactor
bfactor ->not bfactor| (bexpr) | true | false
21. Translate the arithmetic expression (a*b) + (c-d) * (a*b) + b into the
following representations:
i) Syntax Tree
ii) Directed Acyclic Graph
CO5 U 12
iii) Quadruple
iv) Triple
v) Indirect triple
vi) Postfix Expression
22. Construct the SLR parsing table for the following grammar:
E -> E + T | T
CO3 A 12
T -> TF | F
F -> F* | a | b
23. Construct a minimum state DFA directly for the regular expression
m*n(m|nm*) by constructing the syntax tree and finding firstpos(), CO3 A 12
lastpos() and followpos().
COMPULSORY QUESTION
24. a. Enumerate any four issues in the design of a code generator. CO6 U 4
b. Determine the steps for partitioning the three-address instructions into
basic blocks. Also, construct basic blocks and data flow graph for the
following:
i=1
CO6 A 8
L: t1 = x * 5
t2 = &a
t3 = sizeof(int)
t4 = t3 * i
t5 = t2 + t4
*t5 = t1
i=i+1
if i <= 10 goto L
CO – COURSE OUTCOME BL – BLOOM’S LEVEL
COURSE OUTCOMES
CO1 Explain algorithm and data structures for assembler.
CO2 Develop algorithms for macros and loaders.
CO3 List and define various stages of compiler.
CO4 Select and use standard tools and techniques in different stages of compiler design.
CO5 Compare and contrast various methods for implementing the phases of a compiler.
CO6 Design and construct different phases of the compiler.
Q. Questions CO BL Marks
No
.
PART – A (10 X 1 = 10 MARKS)
(Answer all the questions)
1. Differentiate between a linkage editor and a linkage loader. CO1 U 1
2. Compare and contrast an interpreter and a compiler. CO1 U 1
3. Define "cross compiler." CO1 R 1
4. Recall the regular definition for identifiers. CO2 R 1
5. Enumerate the conflicts of the shift-reduce parser. CO3 R 1
6. Define handle pruning. CO3 R 1
7. When is a “syntax directed definition” said to be “circular”? CO4 R 1
8. Show the dependency graph for the declaration statements. CO4 U 1
9. Define activation record. CO5 R 1
10. When is a variable considered "live"? CO6 R 1
PART – B (6 X 3 = 18 MARKS)
(Answer all the questions)
11. Illustrate the working principle of the bootstrap loader. CO2 U 3
12. Write a LEX program to identify the strings represented by the pattern CO3 A 3
(0|1)*011.
13. Write a YACC program to solve the given productions. CO3 A 3
S -> aA | ab
A -> cA | c
14. Construct an annotated parse tree for the input expression: 6*7+2 according CO4 A 3
to the following syntax directed definition:
Production Semantic Rule
E -> E1 + T E.val := E1.val + T.val
E -> T E.val := T.val
T -> T * T T.val := T1.val + T2. val
T -> (E) T.val := E.val
T -> num T.val := num.val
15. Give the syntax-directed definition for if-else statements to perform type CO5 U 3
checking.
16. Write the algorithm to identify "Reachability" during data flow analysis. CO6 A 3
PART – C (6 X 12 = 72 MARKS)
(Answer any five Questions from Q. No. 17 to 23, Q. No. 24 is Compulsory)
17. a. Describe the working principle of a single-pass assembler with the CO1 U 6
necessary example.
b. What is forward referencing? How is it handled while translating an CO1 R 6
assembly language program?
18. a. Explain the various phases of a compiler in detail. Also, show the step- CO2 U 12
by-step translation of the statement "area = 3.14 * radius * radius"
through the phases of the compiler to attain target language.
19. a. Construct a predictive parsing table and parse the string abfg for the CO3 A 12
given grammar.
S -> A
A -> aB | Ad
B -> bBC | f
C -> g
20. a. Summarize with relevant examples the bottom-up evaluation of the S- CO4 U 6
attributed definition for evaluating an arithmetic expression.
b. Explain the concepts involved in the runtime environment. CO4 U 6
21. a. Transform the expression "a = a* (b+c) - (b+c)*d + (d*e) into the CO5 U 12
following representations:
i) Syntax Tree
ii) Directed Acyclic Graph
iii) Quadruple
iv) Triple
v) Indirect triple
vi) Postfix Expression
22. a. Construct a CLR parsing table for the following grammar and parse the CO3 A 12
string “bdc."
S -> Aa | bAc | Bc | bBa
A->d
B -> d
23. a. Construct a minimum state DFA directly for the regular expression r CO2 A 12
(r s | r*) s by constructing the syntax tree and finding firstpos(),
lastpos() and followpos().
COMPULSORY QUESTION
24. a. Explain the challenges faced during register allocation and instruction CO6 U 4
selection during code generation.
b. Illustrate peephole optimization with necessary examples. CO6 U 8
COURSE OUTCOMES
CO1 explain algorithm and data structures for assembler
CO2 develop algorithms for macros and loaders
CO3 list and define various stages of compiler
CO4 select and use standard tools and techniques in different stages of compiler design
CO5 compare and contrast various methods for implementing the phases of a compiler
CO6 design and construct different phases of the compiler
Q. Course
Questions Pattern Marks
No. Outcome
PART – A (10 X 1 = 10 MARKS)
1. Differentiate system software and application software. CO1 U 1
Justify the need for 2 pass assembler in solving forward reference
2. CO1 R 1
problem.
3. Write the regular definition to recognize all identifiers. CO2 R 1
4. Convert (a|b)*ab into NFA. CO2 A 1
Apply left factor to the following grammar.
5. CO3 A 1
A->aB|aC|bc
6. Enumerate the possible conflicts in LR parsing. CO3 U 1
7. Design syntax directed translation for declaration statements. CO4 U 1
8. What is a flow graph? CO5 U 1
9. Define a basic block. CO5 R 1
10. Enumerate the issues in code generation. CO6 R 1
PART – B (6 X 3 = 18 MARKS)
11. Differentiate Linking Loader and Linkage Editor. CO1 U 3
Write a LEX program to count the even binary strings from the
12. CO2 A 3
given input.
Consider the grammar
S -> ( L ) | a
13. L ->L, S | S CO3 A 3
a. What are the Terminals, Non terminals, and Start Symbol?
b. Draw the parse tree for the sentence (a, (a, a))
Construct an annotated parse tree for the input expression: 4+6-8
according to the following syntax directed definition:
Production Semantic Rule
E -> E1 + T E.val := E1.val + T.val
14. CO4 A 3
E -> E1 – T E.val := E1.val – T.val
E -> T E.val := T.val
T -> (E) T.val := E.val
T -> num T.val := num.val
What are the different types of errors at various stages of the
15. CO5 R 3
compiler?
Mention the important classes of transformation that can be applied
16. CO6 R 3
to the basic blocks.
PART – C (6 X 12 = 72 MARKS)
(Answer any five Questions from Q.no 17 to 23)
Illustrate the working principle of absolute loader with the given
object program.
H^ COPY^ 001000^ 000012
a. T^ 001000^ 12^141033^ 482039^ 001036^ 281030^ 301015^ CO1 A 6
17. 482061
E^ 001000
How would this program be loaded in memory?
Describe the function of the macro processor with suitable
b. CO1 R 6
example.
What are the functions of a type system? Design type system for
a. CO4 U 6
arithmetic expression.
20.
Differentiate S-attributed and L-attributed definitions with
b. CO4 U 6
suitable examples.
Construct the SLR table for the following grammar and parse the
string “qbbab”. ‘e’ denotes empty string.
S ->qABC
22. a. A -> a | bbD CO3 A 12
B -> a | e
C -> b | e
D -> c |e
a. Convert the regular expression (01)*(0+1)1 to DFA. CO5 A 6
Find the item I0 for the following grammar using CLR parsing
method.
23. G : S -> AS
b. CO3 A 6
S -> b
S -> SA
A ->Aa
Compulsory:
a. Explain with an example the optimization of basic blocks. CO6 U 6
24. What do you mean by peephole optimization? Describe the
b. CO6 U 6
characteristics of peephole optimization in detail.
COURSE OUTCOMES
CO1 articulate algorithms and data structures for assembler, macro processor and loaders.
CO2 describe the functionality of compilation phases, construct regular expressions and finite automata
for programming languages.
CO3 design and simulate various top down and bottom-up parsers.
CO4 design syntax directed translation schemes for context free grammar and understand the requirement
of runtime environment.
CO5 generate intermediate code for high level language and formulate rules for type-checked systems.
CO6 apply optimization techniques to intermediate code and generate machine code for high level
language program
Q. Course Bloom’s
Questions Marks
No. Outcome Level
PART – A (10 X 1 = 10 MARKS)
1. Differentiate system software from application CO1 U 1
software.
2. Identify the addressing used in instruction LDA #3. CO1 R 1
3. State the three types of codes generated by the CO2 R 1
compiler.
4. Mention the two major tasks performed by the CO2 R 1
compiler.
5. List the possible conflicts occur during shift-reduce CO3 U 1
parsing
6. Identify the type of conflict that occurs if an itemset CO3 U 1
contains the following items
PART – B (6 X 3 = 18 MARKS)
11. List the additional functions of linkage editor. CO1 R 3
12. Differentiate syntax analysis and semantic analysis. CO2 U 3
13. Find the “FOLLOW” of ‘A’ and ‘B’ for the following CO3 A 3
grammar
S→aABe
A→Abc
A→b
B→d
14. Write a brief note on lifetime of an activation of a CO4 U 3
procedure
15. Draw the dependency graph for the declaration CO5 R 3
statements.
16. Paraphrase dead code elimination in basic-block CO6 U 3
optimization.
PART – C (6 X 12 = 72 MARKS)
(Answer any five Questions from Q.No 17 to 23, Q.No 24 is Compulsory)
17. a. Illustrate the working principle of absolute loader CO1 A 6
with the given object program.
H^COPY^001000^000012
T^ 001000^ 12^141033^ 482039^ 001036^
281030^ 301015^ 482061
E^ 001000
How this program would be loaded in memory?
b. Illustrate the working concept of pass macro CO1 U 6
processor with algorithms and suitable example.