You are on page 1of 2

(Paper Code :(ECS 603)

(FollowingRollNo.tobefilledinyourAnswerBook)

Roll No:
SHAMLI INSTITUTE OF ENGINEERING AND TECHNOLOGY, SHAMLI (Code:335) (SEM.6rd) SESSIONAL EXAMINATION 2011-12 Time: 1:30 H (COMPILER DESIGN) MM: 30

NOTE: - AII questions are compulsory. Q1.Attempt any four questions from the following (4*4)

(a) What is Cross-Compiler? How is boot-strapping of compiler done to a second machine? (b) What are the phases of compiler? Explain the function of each phase in brief. (c) State the algorithm to construct an NFA to equivalent DFA. And also construct NFA for the R.E. (a|b)*ab*a and covert into DFA (d) What is Bottom-Up-Parsing? Explain how stack implementation of Shift Reduce parsing is done. Parse the string id1+(id2*id3) using the following Grammar E E+E/E*E/ (E)/id. (e) What is operator precedence Grammar & Parsing? Draw the precedence relation table for the following production and also parse the string id+id*id E E+T/T T T*F/F F (E)/id

Q2. Attempt any two questions from the following


(a)State the problem associated with top-down parsing. Explain the Predictive Parsing technique. Consider the following Grammar and calculate S iEtSS1|a S1 Es| E b (i)First and Follow (ii)Write the algorithm for M-table and construct the M-table for the above Grammar

(7*7)

(b) (i) what is LL (1) Grammar? Write the algorithm to check whether the Grammar is LL (1) or not. Check the following grammar is LL (1) or not. SAaAb|BbBa A B (ii)Explain the following with removal Algorithm (1)Left-Recursion (2)Left-Factoring (3)Indirect left-Recursion (C)(i)What is Recursive decent parsing? Write down the recursive descent procedure for the following grammar E E+T/T T T*F/F F (E)/id (ii)What is LR parser? Explain the LR parsing Algorithm with advantage and disadvantage

You might also like