compiler design
compiler design
of Printed Pages : 3
Roll No ..................................
CS-603(C)-CBGS
B.Tech., VI Semester
Examination, December 2020
Choice Based Grading System (CBGS)
Compiler Design
Time : Three Hours
Maximum Marks : 70
Note: i) Attempt any five questions.
{H$Ýht nm±M àíZm| H$mo hb H$s{OE&
ii) All questions carry equal marks.
g^r àíZm| Ho$ g_mZ A§H$ h¢&
iii) In case of any doubt or dispute the English version
question should be treated as final.
{H$gr ^r àH$ma Ho$ g§Xoh AWdm {ddmX H$s pñW{V ‘| A§J«oOr ^mfm
Ho$ àíZ H$mo A§{V‘ ‘mZm Om¶oJm&
1. a) Describe the various data structures used in Compilers.
g§H$bH$ ‘| à¶w³V {d{^Þ S>oQ>m g§aMZmAm| H$m dU©Z H$a|&
b) What are Compiler construction tools? Write note on each
compiler construction tool.
g§H$bH$ {Z‘m©U CnH$aU ³¶m h¢? à˶oH$ g§H$bH$ {Z‘m©U CnH$aU
na ZmoQ> {bI|&
2. a) Explain in detail the various phases of compiler with an
example.
EH$ CXmhaU Ho$ gmW g§H$bH$ Ho$ {d{^Þ MaUm| Ho$ ~mao ‘| {dñVma
go ~VmBE&
CS-603(C)-CBGS PTO
https://www.rgpvonline.com
[2]
b) Define :
n[a^m{fV H$a| :
i) Tokens
ii) Input buffering
iii) LEX
3. a) Explain the various errors encountered in different phases
of Compiler.
g§H$bH$ Ho$ {d{^Þ MaUm§o ‘| AmB© {d{^Þ Ìw{Q>¶m| H$s ì¶m»¶m H$s{OE&
b) Differentiate :
A§Va H$amo :
i) Top down Vs Bottom up parsing
ii) Predictive Vs Operator precedence parsing
4. a) Construct a Syntax Directed Translation Scheme that
translates arithmetic expressions from infix into postfix
notation.
EH$ qgQ>o³g S>m¶ao³Q>oS> Q´>m§gboeZ ñH$s‘ H$m {Z‘m©U H$aZm Omo
BpÝ’$³g go A§H$J{UVr¶ A{^ì¶{³V¶m| H$mo nmoñQ>{’$³g ZmoQ>e
o Z ‘|
AZwdmX H$aVm h¡&
b) Explain the symbol table management system.
àVrH$ Vm{bH$m à~§YZ àUmbr H$s ì¶m»¶m H$a|&
5. a) Check whether the given grammar is LL(1) or not
Om±Mo {H$ {X¶m J¶m ì¶mH$aU Eb Eb (1) h¡ ¶m Zht
S → iEt SS' / a
S' → eS / E
E→b
b) Explain in detail different dynamic storage allocation
strategies.
{d{^Þ J{Verb ^§S>maU Amd§Q>Z aUZr{V¶m| Ho$ ~mao ‘| {dñVma go
~VmB¶o&
CS-603(C)-CBGS Contd...
PTO
https://www.rgpvonline.com
[3]
CS-603(C)-CBGS PTO
https://www.rgpvonline.com
https://www.rgpvonline.com
Roll No ..................................
CS-7002-CBGS
B.E. VII Semester
Examination, June 2020
Choice Based Grading System (CBGS)
Compiler Design
Time : Three Hours
Maximum Marks : 70
Note: i) Attempt any five questions (including all parts).
ii) All questions carry equal marks.
iii) Assume missing data, if any suitably.
a
2 3
start ε ε ε
ε a b b
0 1 ε 6 7 8 9 10
ε
4 5
b
ε
https://www.rgpvonline.com
https://www.rgpvonline.com
[2]
******
CS-7002-CBGS PTO
https://www.rgpvonline.com
Total No. of Questions : 8] [1] [Total No. of Printed Pages : 2
Roll No ..................................
CS-701-GS
B.E. VII Semester
Examination, December 2020
Grading System (GS)
Compiler Design
Time : Three Hours
Maximum Marks : 70
Note: i) Attempt any five questions.
ii) All questions carry equal marks.
l. a) What is front end and back end of compiler? What are the
advantages of breaking up the compiler functionality into
these two stages?
b) What are the various components of lexical specification
file? Illustrate with an example.
CS-701-GS PTO
https://www.rgpvonline.com
[2]
******
CS-701-GS PTO
https://www.rgpvonline.com
https://www.rgpvonline.com
Roll No ..................................
CS-701 (GS)
B.E. VII Semester Examination, June 2020
Grading System (GS)
Compiler Design
Time : Three Hours
Maximum Marks : 70
Note: i) Attempt any five questions.
ii) All questions carry equal marks.
l. Construct a DAG for the basic block whose code is given below:
D: = B * C
E: = A + B
B: = B * C
A=E–D
6. Define a Quadruple. How is it different from triples? Convert the following expression into three
address code and quadruple.
S = (a + b) / (c – d) * (e + f)
7. Construct the DAG for the following basic block:
a:=b+c
b:=b–d
c:=c+d
e:=b+c
OR
What do you mean by LEX? Explain in detail.
8. Write short notes:(Any two)
a) Local and Loop optimization
b) Peephole optimization
c) Dead code elimination
******
CS-701 (GS)
https://www.rgpvonline.com
Total No. of Questions : 8] [1] [Total No. of Printed Pages : 3
Roll No ..................................
IT-6004-CBGS
B.E. VI Semester
Examination, December 2020
Choice Based Grading System (CBGS)
Compiler Design
Time : Three Hours
Maximum Marks : 70
Note: i) Attempt any five questions.
ii) All questions carry equal marks.
iii) Assume missing data if any, suitably.
E →5 + T 3 − T ,
T → V V *V V + V ,
V → a b.
What is the use of left factoring? Find the first and follow
for above grammar and do the left factoring for it.
b) Describe the following in brief. 7
i) Ambiguity
ii) Left recursion
iii) Parse Tree
IT-6004-CBGS PTO
https://www.rgpvonline.com
[2]
IT-6004-CBGS Contd...
PTO
https://www.rgpvonline.com
[3]
******
IT-6004-CBGS PTO
https://www.rgpvonline.com