Radha Govind Engineering College, Meerut First Sessional Test (2007-2008) B.Tech V Semester (CS) Compiler Design (TCS 502) Time: 1hr. Note: Attempt All questions.
MM: 30
Q.1) Explain all the phases of a compiler. What is the difference between a compiler and interpreter? OR Explain bootstrapping in detail. Suppose you have a working C compiler on machine A. Discuss the steps with T-diagram you would take to create a working compiler for another language C’ on machine B. Q.2) For the grammar GS -> A A -> aB/aC/Ad/Ae B ->bBc/f C -> g (i) Find G1 a non-left recursive grammar. (ii) Find FIRST and FOLLOW for G1. (iii) Construct Parsing for G1. (iv) Find G1 is LL(1) or not. OR What parser? Write the procedures for recursive descent parser for the grammarET+E/T TV*T/V Vid Q.3) Consider the context free grammar S -> S S + | S S *| a (a)Show how the string aa+a* can be generated by this grammar. (b)Construct a parse tree for this string. (c) What language is generated by this grammar? Justify your answer. OR Give the algorithm for subset construction and computation of ε -closure. Using these algorithms find the DFA for regular expression: (a/b)* aba
**********************
RADHA GOVIND ENGINEERING COLLEGE, MEERUT First Sessional Test (2005-06) Subject: Compiler Construction (CS-604) Class: B.Tech (CS) VI Sem Time: 1:15 hr. Note: Attempt any three questions.
MM: 30
Q.1) Consider the expression – a=b + c*60 process the expression by the all phases of compiler with explanation. Q.2) What do you understand by token? Construct transition diagram to recognize the while, if, else, <, <=, >, >= tokens. And also explain how the input read by the lexical analyzer. Q.3) Explain bootstrapping in detail. Suppose we have a C compiler on machine A construct a Pascal compiler for machine A and B. Q4) Construct the NFA for a) (a+b)* aba(ab) b) aba (a/b)* Q5).What language is generated by the following grammars? In each case justify your answer. a) S ->0S1| 01
b) S -> +SS| -SS | a
*********************************************
RADHA GOVIND ENGINEERING COLLEGE, MEERUT First Sessional Test (2004-05) Subject: Compiler Construction (CS-604) Class: B.Tech (CS) VI Sem Time: 1:15 hr. Note: Attempt any four questions.
MM: 30
Q1) What language is generated by the following grammars? In each case justify your answer. a) S -> aSbS | bSaS | € c) S -> a | S+S | SS | S* | (S) Q2) Construct the NFA for the following regular expressionsa) (ab+b)* ab(a+b) b) (a+bb)* ab (a/b)* Q.3) Explain bootstrapping in detail. Suppose we have a C compiler on machine A construct a Pascal compiler for machine A and B. Q.4) Explain all the phases of a compiler. What is the difference between a compiler and interpreter? Q.5) (a) Explain LEX compiler in detail. (b) What is the use of regular expression in compiler designing?
*********************************************