Save as PDF
Opens your browser print dialog — select "Save as PDF" to download.
Total No. of Questions: 8
Total No. of Printed Pages: 4
Roll No. .....................................
MI/MM-603 (A) (GS)
B.Tech., VI Semester
Examination, December 2024
Grading System (GS)
Compiler Design
B.Tech., VI Semester
Examination, December 2024
Grading System (GS)
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.
यदि कोई डाटा मिसिंग हो तो उपयुक्त मान लें।
iv) In case of any doubt or dispute the English version question should be treated as final.
किसी भी प्रकार के संदेह अथवा विवाद की स्थिति में अंग्रेजी भाषा के प्रश्न को अंतिम माना जायेगा।
1.
a) What is a translator? Compare compiler and interpreter in terms of translation method, memory requirement and speed. (8)
अनुवादक क्या है? अनुवाद पद्धति, स्मृति आवश्यकता और गति के संदर्भ में कम्पाइलर और इंटरप्रेटर की तुलना करें।
b) Explain LEX tool in brief. (3)
LEX टूल को संक्षेप में समझाइये।
c) What is left factoring in grammar? Explain with an example. (3)
व्याकरण में लेफ्ट फैक्टरिंग क्या है? उदाहरण सहित समझाइये।
2.
a) Consider the following grammar for list structures: (6)
S→a/(T)
T→T,S
Find left most derivation, right most derivation and parse tree for the string `((a,a),((a)))`.
T→T,S
उपरोक्त व्याकरण को लिए निम्ननलिखित आधार पर विचार करें:
`S→a/(T)`
`T→T,S`
दी गई स्ट्रिंग `((a,a),((a)))` के लिए लेफ्ट मोस्ट डेरिवेशन, राइट मोस्ट डेरिवेशन और पार्स ट्री प्राप्त करें।
`S→a/(T)`
`T→T,S`
दी गई स्ट्रिंग `((a,a),((a)))` के लिए लेफ्ट मोस्ट डेरिवेशन, राइट मोस्ट डेरिवेशन और पार्स ट्री प्राप्त करें।
b) For the following grammar find First and Follow sets for each of non-terminal. (4)
S→aA/bB/c
A→aAb/ε
B→bB/c
A→aAb/ε
B→bB/c
निम्नलिखित व्याकरण में प्रत्येक गैर-टर्मिनल के लिए फर्स्ट और फोलो सेट प्राप्त करें।
`S→aA/bB/c`
`A→aAb/ε`
`B→bB/c`
`S→aA/bB/c`
`A→aAb/ε`
`B→bB/c`
c) Describe the following in brief. (4)
निम्नलिखित का संक्षेप में वर्णन करें।
i) Ambiguity
i) संदिग्धता
ii) Left recursion
ii) लेफ्ट रिकर्सन
3.
a) What is parser? Explain backtracking and non-backtracking parsers with their types. (8)
पार्शर क्या है? बैकट्रैकिंग और नॉन-बैकट्रैकिंग पार्शर को उनके प्रकार सहित समझाइए।
b) Consider the following grammar. (6)
E→E+T
T→TF/F
F→F*/b
Construct the SLR Parsing table for this grammar.
T→TF/F
F→F*/b
निम्नलिखित व्याकरण पर विचार करें।
`E→E+T`
`T→TF/F`
`F→F*/b`
इस ग्रामर के लिए SLR पार्सिंग तालिका का निर्माण करें।
`E→E+T`
`T→TF/F`
`F→F*/b`
इस ग्रामर के लिए SLR पार्सिंग तालिका का निर्माण करें।
4.
a) Define the following with an example. (8)
निम्नलिखित को उदाहरण सहित परिभाषित करें।
i) Synthesized attributes
i) संश्लेषित एट्रीब्यूट्स
ii) Annotated parse tree
ii) एनोटेटेड पार्स ट्री
iii) Dependency graph
iii) डिपेंडेंसी ग्राफ
b) Generate the three address code for the following code segment: (6)
निम्नलिखित कोड खंड के लिए थ्री एड्रेस कोड जनरेट करें।
While (a < c and b < d) do
If (a = 1 then c = 1.
Else
While (a = d) do
a = a + 3
5.
a) Explain various intermediate code generation techniques in brief. (8)
विभिन्न इंटरमीडिएट कोड जनरेशन तकनीकों को संक्षेप में समझाइए।
b) Consider the grammar with the following translation rules and E as the start symbol. (6)
E→E1 #T {E.value = E1.value * T.value}
T→T1 & F {T.value = T1.value + F.value}
F→num {F.value = num.value}
Compute E.value for the root of the parse tree for the expression `2 & 3 # 5 & 6 & 4`.
T→T1 & F {T.value = T1.value + F.value}
F→num {F.value = num.value}
निम्नलिखित प्रोडक्शन नियमों और E को आरंभ चिन्ह के साथ ग्रामर पर विचार करें।
`E→E1 #T {E.value = E1.value * T.value}`
`T→T1 & F {T.value = T1.value + F.value}`
`F→num {F.value = num.value}`
अभिव्यक्ति के लिए पार्स ट्री की जड़ के लिए E.value की गणना करें।
`2 & 3 # 5 & 6 & 4`
`E→E1 #T {E.value = E1.value * T.value}`
`T→T1 & F {T.value = T1.value + F.value}`
`F→num {F.value = num.value}`
अभिव्यक्ति के लिए पार्स ट्री की जड़ के लिए E.value की गणना करें।
`2 & 3 # 5 & 6 & 4`
6.
a) Write an algorithm to construct a DAG from a basic block. (6)
मूल ब्लॉक से DAG बनाने के लिए एक एल्गोरिथम लिखें।
b) What is S-attributed SDT and L-attributed SDT? Consider the following grammar and write the SDT rules for the given grammar: (8)
S→S*A
S→A
A→A+B
A→B
B→(S)
B→id
S→A
A→A+B
A→B
B→(S)
B→id
S-एट्रीब्यूटेड SDT और L-एट्रीब्यूटेड SDT क्या है? निम्नलिखित ग्रामर पर विचार करें और दिए गए ग्रामर के लिए SDT नियम लिखें।
`S→S*A`
`S→A`
`A→A+B`
`A→B`
`B→(S)`
`B→id`
`S→S*A`
`S→A`
`A→A+B`
`A→B`
`B→(S)`
`B→id`
7.
a) Write the differences between Synthesized and Inherited attributes. (7)
सिंथेसाइज्ड और इनहेरिटेड गुणों के बीच अंतर लिखिए।
b) Explain the common sub expression, elimination, copy propagation, and transformation for moving loop invariant computations in detail. (7)
मूविंग लूप इनवेरिएंट गणनाओं ���े लिए सामान्य उप अभिव्यक्ति उन्मूलन, प्रतिलिपि प्रसार और परिवर्तन को विस्तार से समझाइए।
8.
a) What is Local transformation and Global transformation. (4)
लोकल ट्रांसफॉर्मेशन और ग्लोबल ट्रांसफॉर्मेशन क्या है?
b) What are the 3 areas of code optimization? Explain each one in detail. (10)
कोड ऑप्टिमाइजेशन के तीन क्षेत्र कौन से हैं? प्रत्येक को विस्तार से समझाइए।