You are on page 1of 3
OEE Naa COMP 7 - 1 (RC) B.E. (Computer) (Semester — VII) (RC) Examination, Nov./Dec. 2013 LANGUAGE TRANSLATORS Duration : 3 Hours Max. Marks : 100 Instructions: i) Attempt any five questions by selecting at least one question from each Module. ji) Make suitable assumptions if required. MODULE —| 1. a) Explain the front end and back end of the Assembler with a neat diagram. 8 b) Give the flowchart representation to show the steps in processing macro definitions. 6 c) Suppose you have C++ to C translator written in C and working C compiler. Use the bootstrapping technique to describe the steps you would take to create a working C++ compiler. 6 2. a) Discuss the way in which LTORG statement is processed in Pass-!I of the Assembler. b) Differentiate between EXTRN and ENTRY statements. c) Write a macro for finding the second largest element in the array. 8 d) What is the difference between a single-pass assembler and a multi-pass > assembler ? 2 MODULE -|I 3. a) Write a LEX program to find the longest word (defined as a contiguous string of upper and lower case letters) in the given input. 6 b) Explain the 2-buffer input scheme of input buffering technique along with an example. Explain the use of a sentinel character in input buffering. 4 c) Consider the following regular expression : 8 1(14+d)*(1(144d)*)* i) Construct a NFA accepting the above regular expression using Thomson's algorithm. Design a DFA for the above NFA using subset construction algorithm. P.T.O. COMP 7-1 (RC) oe d) Perform the left factoring on the following grammar : Statement —> AssignStmt | CallStmt | Other AssignStmt > ID = Exp CallStmt — ID (ExpList) ExpList + ExpList, Exp | Exp Exp > ID. TAROT ODE SUS 4. a) Forthe given LEX program, give NFA implementation of lexical analyzer : 6 Bat enum {BAA, ABAA, BABB} eh L% a+bta+ b+a+b* ba+ S%o {return(ABAA);} {return(BABB);} {return(BAA);} b) Construct the operator precedence table for the following grammar and parse the string: a+ (a—a)+a. E>E+T|T ToT-FIF F—(E)|a c) Explain the following w.r.t. CFG : i) Ambiguity ii) Removal of left recursion. MODULE - III 5. a) Consider the following grammar. ETP T>FO F>(E)RIiIR A> *Rle i) Find the FIRST and FOLLOW sets. Construct the LL(1) parsing table. “sin P/TPle 10 10 Q>FQ|s b) Explain the Syntax Directed Translation Scheme for ill) Boolean expressions iv) Switch — case statement. a) Construct a canonical LR parsing table for the following grammar and parse the string id id*id., a S+E=E EE+T|T T+ T*id|id b) Explain the Syntax Directed Translation Scheme for Assignment statement. 8 MODULE —IV . a) Explain the code generation algorithm with an example. 10 b) List and explain the data structures used to implement symbol table. 6 c) Write a short note on the structure of activation record in ‘C’. 4 3. a) Write a short note on the following « 10 i) Machine dependent optimization ji) Register allocation optimization, b) What do you understand by a self organizing list ? 4 c) Discuss the following with an example : 6 i) Loop Jamming ji) Loop unrolling.

You might also like