Anda di halaman 1dari 15

Unit -1

QUE: 1 what is a compiler? Explain. QUE: 2 explain why one study about compiler should. QUE: 3 Draw and explain phases of compiler. QUE: 4 what is the advantages of multipass compiler over single pass compiler? What are features of a good compiler? QUE: 5 define and differentiate between compiler and interpreter? QUE: 6 write short note on Bootstrapping? QUE: 7 write short note on (1) (2) (3) (4) (5) Cross compiler. Compiler-compiler. Input buffering. Symbol table organization. Error handler.

QUE: 8 explain the concept of LEX? Describe auxiliary definitions and transaction rules for LEX with suitable example. QUE: 9 A LEX program given below Auxiliary Definitions (non) Translation rules a abb a*b + implement the LEX program as DFA.

QUE: 10 Using the transition system. Prove that the strings recognized are (a + a ( b + aa )* b )* a ( b + aa )* a

QUE: 11 Design a DFA for decimal number which is divisible by 4. QUE: 12 convert the following NFA in to DFA.

QUE: 13 Design a FA which accepts odd number of 1s and any number of 0s. QUE: 14Construct a transition graph for a FA which accepts a language L over {0, 1} in Which every string start with 0 ends with 1.

Unit 2 QUE: 1 what do you mean by ambiguous and unambiguous grammar? Explain with Example. QUE: 2 what is top down parsing? What are the difficulties encounter in this and how are they overcome? QUE: 3 compare the top down and bottom-up parsing techniques? QUE: 4 what is predictive parser? How a parser is controlled by a program? QUE: 5 what do you understand by operator precedence parsing? Write down limitations. QUE: 6 write short note on error recovery procedures in LL and LR parsers. QUE: 7 remove null production , unit production and useless symbols from the following CFG S PQRSQT P aap Q bQ R RdRc T eT QUE: 8 define ambiguity of grammars. Prove that the grammar S AB, B ab A aa A a B b is ambiguous.

QUE: 9 consider the grammar S (L)/a L L, S/S (i) Find parse tree for the following (A) (a, a) (B) (a,(a, a)) (C) (a,((a, a),(a, a))) Construct leftmost derivative for each(a) Construct rightmost derivative for each(a)

(ii) (iii)

QUE: 10 let G be the grammar S aBbA A aaSbAA B bbSaBB For the string aaabbabbba find (i) Leftmost derivation (ii) rightmost derivation (iii) parse tree.

QUE: 11 differentiate between operator grammar and operator precedence grammar . Compute precedence relation for the following grammarE E+TT T T*FF F (E) id Show the moves of operator precedence parser for input string id+id*id QUE: 12 find LEADING and TRAILING of the following grammar S aABbA A aAb B bBC

QUE: 13 consider the following grammar A ABdAaa B Beb QUE: 14 do left factoring in the grammar A aABaAa B bBb QUE: 15 for the following grammar find FIRST and FOLLOW sets for each of Nonterminals. remove left recursion.

(a)

S aABbA A aAb B bB

(b)

S ACBCbBBa A daBC B g C h

QUE: 16 design LL (1) parsing table for the following grammarA AcBcCC B bBid A CaBBbBB QUE: 17 consider the following grammar S iCtSAa A eS Whether it is LL(1) grammar. Give the explanation whether (i, t, e, b, a) are Terminal symbol.

QUE: 18 consider the following grammar text atomlist atom numberidentifier list (temp-seg) text-seg text, text-segtext (i) (ii) (iii) (iv) Left factor this grammar Construct FIRST and FOLLOW sets for the non-terminals of resulting grammar. Show that resulting grammar is LL (1). Construct LL(1) parsing table for resulting grammar.

QUE: 19 construct the collection of LR(0) item sets and draw the goto graph for the Following grammarSSSa Indicate the conflict (if any) in the various states of the SLR parser. QUE: 20 design LL (0) parsing table for the following grammarS cAccB B cAa A ccBb QUE: 21 design LALR (1) parsing table for the following grammarS AabAcdcbda Ad

Unit -3
QUE: 1 Explain syntax directed translation in brief? QUE: 2 differentiate between synthesized translation and inherited translation? QUE: 3 Explain the types of attribute used in syntax directed translation? QUE: 4 let the synthesized attribute val give the integer value associated with the nonterminals in the following grammar LE, E E1+TT TT1*FF F (E) digit. QUE: 5 write a brief note on (i) (ii) (iii) (iv) (v) syntax tree. L-attribute definitions. S-attribute definitions. Type checking Back patching

QUE: 6 What do you understand by top down translation? QUE: 7 explain intermediate forms using postfix notation? QUE: 8 write a short note on three-address code and how it is represented using triple, Quadruples and indirect triple. QUE: 9 Compare the relative merit and demerits of the following(i) triple, (ii) Quadruples (iii) indirect triple.

QUE: 10 translate the expression a*- (b+c) into(i) (ii) Postfix notation. on three-address code

QUE: 11 translate the expression Y = (4 * 7 + 1) * 2 (i) quadruples (ii) triples (iii) indirect triple

QUE: 12 construct syntax tree and Postfix notation for the following expression (a + b (b*c))d-e/ (f+g) QUE: 13 translate the expression (A) - (a+b) *(c+d) + (a+b+c) (B) - (a+b) *(c+d) - (a+b+c) into (i) quadruples (ii) triples (iii) indirect triple

QUE: 14 construct 3-address code for the following (A) If [(a<b) and(c>d) or (a>d))], then z = x+y*z Else z = z+1 Else x = y-z QUE: 15 consider the following while statement While A>B and A< = 2*B-5 do A : A+B; (i) (ii) Construct the parse tree Write intermediate code (B) while a<b do if c<d then x = y+z

QUE: 16 generate the 3- address code for the following program fragmentWhile (A<C and B>D)do If A=1 then

C=C+1 Else While A< = D do A : = A+3; QUE: 17 consider the program fragment Sum: = 0 For (i=1; i < = 20; i ++) Sum: = sum +a[i] +b[i]; And generate 3-add code for it, there is four bytes per word.

QUE: 18 generate 3-add code for the following switch statementSwitch (i+j) { Case 1: x: = y + z Case 1: p: = q + r Case 1: u: = v + w } QUE: 19 generate code for the following C statements for the target machine assuming All variables are static, assume three registers are available. x = a[i] +1 a[i] = b[c[i]] a[i][j] = b[i][k]*c[k][j] a[i] = a[i] +b[j] a[i] + = b[j]

QUE: 20 generate 3-add code for the following switch statementSwitch (a+b) { Case 2: { x: = y; break; } Case 5: { Switch(x) { Case 0 : { a: = b + 1; break; } Case 1 : { a: = b + 3; break; } Default : { a: = 2;

break; } } Break; } Case 9 : { a: = y - 1; break; }

Default : { a: = 2 break; } ;

Unit -4
QUE: 1 write a short note on storage allocation (organisation)? QUE: 2 what do you mean by activation record? Why this record is maintained by Compiler? Explain various fields of activation record. QUE: 3 what do you mean by heap allocation? Explain the following terms related to heap Allocation. (i) (ii) (iii) Fragmentation. Free list Reference count.

QUE: 4 Differentiate between (i) (ii) (iii) Dynamic and static storage management. Stack allocation and heap allocation. Stack binding and dynamic binding.

QUE: 5 write a short note on block structure. QUE: 6 what is hashing? What are the different types of hashing techniques available? QUE: 7 write a short note on parameter passing? What is different parameter passing Mechanism. QUE: 8 write a short note on symbol tables organization. QUE: 9 write a short note on data structures used in symbol table? QUE: 10 compare various symbol table management techniques.

Unit -5
QUE: 1 Define basic blocks and control flow graphs? QUE:2 write a short note on DAG construction. Explain application & advantages of DAG. QUE: 3 write a short note on code optimization. QUE: 4 explain the following optimizing transformations with suitable examples(i) (ii) Code movement. Common sub expression elimination

QUE: 5 write and explain data flow equations. QUE: 6 write a short note on peep-hole optimization. QUE: 7 write a short note on code generation. QUE: 8 write a short note on design of code generator. QUE: 9 what are the problem encountered in code generation. QUE: 10 write the heuristic algorithm for DAG. QUE: 11 write a short note on dependency graph. QUE: 12 construct the DAG for the following basic block(a) t1: = a + b t 2: = c + d t3: = e - t 2 t4: = t1 - t3 and generate code for these three address statements. (b) a=b+c b=bd c=c+d e=b+c

(c)

i=1; J = 2; Repeat A[i] = j; i = i+1; until (i>10)

(d) )

t1: = 4 * i; t 2: = a[t1]; t3: = 4 * i; t4: = b[t3]; t 5 = t 2* t4; t6 = prod + t 5; prod = t6 ; t7 = i+1; i = t7; if i<=20;

(e)

D: = B * C; E: = A + B; B: = B * C; A: = E D;

(f)

Z = X Y + X * Y * U V/W + X + V

QUE: 13 write a short note on local versus global optimization? QUE: 14 write the algorithm for constructing a DAG from a basic block? QUE: 15 Describe the process of code generation from DAG? QUE: 16 write a short note on issue in design of code generator? QUE: 17 what are the principle sources of optimization? QUE: 18

Anda mungkin juga menyukai