Write character c l a s s e s for the following: 2 C 0 1 L 3 a) A string consisting of lower c a s e vowels having 3 numbers in between second and third vowel. b) Digits in hexadecimal format.
Other Or UnclassifiedSource quality review required
Anna University
| University | Anna University |
|---|---|
| Degree | B.Tech. Information and Technology |
| Department | Information and Technology |
| Regulation | Regulation 2019 |
| Semester | 5 |
| Subject Code | IT5502 |
| Subject Name | Compiler Engineering |
| Exam Session | November / December 2024 |
| Duration | 3hrs |
| Maximum Marks | 100 |
Access the previous year question paper for your examination preparation.
View / Download PDFBrowse other previous year question papers for this subject.
View All Subject Question PapersAutomatically extracted historical question data. Academic accuracy and examination rules require verification.
| Part | Required answers | Marks per answer | Section total |
|---|---|---|---|
| A | 10 | 2 | 20 |
| B | 5 | 13 | 65 |
| C | 1 | 15 | 15 |
Proportional to section marks. This estimate uses the full exam duration without a separate reading or revision reserve.
Write character c l a s s e s for the following: 2 C 0 1 L 3 a) A string consisting of lower c a s e vowels having 3 numbers in between second and third vowel. b) Digits in hexadecimal format.
Other Or UnclassifiedSource quality review required
IdentifyIdentify thethe lexeme,lexeme, patternpattern andand tokenstokens fromfrom thethe followingfollowing sourcesource 2 C 0 6 L 3 code:code: voidvoid resultOresultO {{ intint aa ,, b,b, c;c; sumsum == aa ** bb ++ 5;5; ))
Other Or UnclassifiedSource quality review required
List out the various lexical errors and recovery actions performed 2 0 0 6 L2 by the lexical analyzer.
Short DescriptionSource quality review required
Give a leftmost and rightmost derivation for the string ((b,b),b,(b)) 2 C 0 2 L 3 using the following g r a m m a r \ S-> (L) 1 b L-> L, S I S
Other Or UnclassifiedSource quality review required
Perform Left Factoring for the following grammar: 2 0 0 2 A->ad|a|ab|abc|b
Other Or UnclassifiedSource quality review required
Translate the arithmetic expression c= p * -q + b[i] into Quadruples, 2 0 0 3 L 3 Triples and Indirect Triples.
Other Or UnclassifiedSource quality review required
Construct D A G for the following arithmetic expression: 2 0 0 3 L 3 a*a + (b + a * a + (a + (a*b)))
DesignSource quality review required
Using Peephole Optimization, how unreachable code and 2 0 0 5 L2 unnecessary jumps can be eliminated in intermediate representation? Illustrate with an example
Other Or UnclassifiedSource quality review required
How do you bootstrap a compiler? Give an example. 2 0 0 5 L2
Other Or UnclassifiedSource quality review required
(b) (i) Construct D F A for the following regular expression using syntax 9 0 0 1 L 3 tree approach. (a| S ) * ac*|bc*b (ii)(ii)(ii)(ii)(ii)(ii) Consider the following 8- transitions ( T ransition table) with 444444 CCCCCC 000000 111111 LLLLLL 333333 respect to the states p,q,r and inputs 8 a, b and c: State/Input 8 a b c State p {q,r} 0 {q} {r} S t a t s q 0 {p} {p.q} \\\\\\ •kjj•kjj•kjj•kjj•kjj•kjj State r 0 0 0 {r} a) V i s u a ize N F A from the table. b) Conv€3rt it into D F A and identify its regular expression. 1 2 ( a ) (i) Explain the p h a s e s of a Compiler in detail and write down the 9 0 0 6 L 3 output of e a c h phase of the compiler for the given expression result = a + b * c / 4. (ii) Consider the language R = {ab, bba, a a , ab} and S = {0,11,10,1}. 4 C O I L2 Compute the following a) S | ( R S ) b) R ( R U S ) *
Other Or UnclassifiedSource quality review required
(b) (i) Write a L e x program to find the total occurrence of the user id and 9 0 0 6 L 3 password in the given source text. Write the identified user id and password in a separate file. 2- U s e r id consists of 3 or more alphabets and 3 numbers or a mail id restricted to a length of 12 characters. P a s s w o r d consists of an initial capital letter followed by one or more small letters followed by a special character ($/&/#/@) restricted to a length of 10 characters. (ii) Illustrate how a pair of input buffers can handle a large look ahead 4 C 0 1 L 2 safely with a neat diagram. What is the role of sentinels in buffer pair? Explain. 1 3 ( a ) Construct a Predictive P a r s e r and parsing table for the following 13 C 0 2 L S grammar: S-> A B A-> x , A i ( B ) B-> y * B 1 z C h e c k whether the given string 'x,x,(y*z)z" belongs to the above grammar. [OR] 1 3 ( b ) Construct a C L R parser for the following grammar: 13 C 0 2 1=3 S -> B B * B-> c B B->d P a r s e the string "cccdd*" using the above grammar.
Other Or UnclassifiedSource quality review required
(a) (i) Simulate the steps of constructing the S y n t a x tree and D A G for 9 C O S L 3 the following simple expression using appropriate S-Attributed S D D : c = (a-4) + b * (d+e) * f (ii) Write down the rules which are used by the compiler for Type 4 0 0 3 L 3 Checking with a suitable exampi i. Also list out the various T y p e conversions that takes place during compilation time using suitafc»le algorithm. [OR] 1 4 ( b ) (i) Write down the semantic actions for the Translation of Arithmetic 9 C O S L 3 Expressions and generate the three address code for the following expression using annotated parse tree: sum = y * z + ( - b * c ) / w (ii) With the proper L-attributed definition, draw a dependency graph 4 0 0 3 L S with evaluation order for the following statement: 8 + 4 - (3 *6) 1 5 ( a ) (i) Explain the issues involved in the design of a Code Generator in 8 C 0 4 L2 detail with suitable examples. (ii) Generate intermediate code and target code for the following C 5 C 0 4 L 5 snippet given below and estimate the cost of the final target code: { s u m = a[i] + b[i]; d = sum + * p ; } ( A s s u m e array entries require 8 bytes and p is a memory location.) [OR] 1 5 ( b ) ( i ) Generate three address code and draw the flow graph with proper 8 0 0 4 identification of basic blocks and loops for the following C code used for sorting: for (i =1; i<n; i++) { key = arr[i]; II j = i - i ; ; # A 3 while (j>=0 && arrO] > key) { arrO+1] = arrO]; • j = j - i ; }} arrO+1]arrO+1] == key;key; }} (( AA ss ss uu mm ee arrayarray entriesentries areare numbersnumbers whichwhich requirerequire 88 bytes.)bytes.) (ii) Optimize the three address code generated in 15.b.(i) globally a s 5 C 0 4 L 5 well a s locally by preserving the semantics of the original program.
Other Or UnclassifiedSource quality review required
(i) With appropriate S D D for flow control statements and Boolean 10 0 0 3 L 4 expressions, translate the following conditional statement into three address code: if (( a>b && a>c) || (e<f || c !=d), x =100; ' ' (ii) Generate code for the s a m e statement in one p a s s using 5 0 0 3 L4 Backpatching S D D .
Other Or UnclassifiedSource quality review required
Historical analysis based on extracted question papers. Topic classifications, marks and planning estimates are provisional.