0% found this document useful (0 votes)
6 views

Compiler-9

The document is an examination paper for the CE401 Compiler Construction course at Charotar University of Science & Technology, dated November 14, 2013. It consists of two sections with various questions covering topics such as lexical analysis, parsing, grammar construction, error detection, and code optimization. Students are instructed to answer questions on separate sheets and to include diagrams where necessary.

Uploaded by

jaymehta11th
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
6 views

Compiler-9

The document is an examination paper for the CE401 Compiler Construction course at Charotar University of Science & Technology, dated November 14, 2013. It consists of two sections with various questions covering topics such as lexical analysis, parsing, grammar construction, error detection, and code optimization. Students are instructed to answer questions on separate sheets and to include diagrams where necessary.

Uploaded by

jaymehta11th
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 3
CHAROTAR UNIVERSITY OF SCIENCE & TECHNOLOGY Seyenth Semester of B. Tech. Examination (C.E.) Noy 2013 ‘CE401 Compiler Construction (CC) Date: 14.11.2013, Thursday ‘Time: 10:00 a.m. To 01:00 p.m. ‘Maximum Marks: 70 Tnstructions: 1, The question paper comprises of two sections. 2. Section I and Il must be attempted in separate answer sheets. 3. Make suitable assumptions and draw neat figures wherever required. 4, Rough work is to be done in the last page of main supplementary, please don’t write anything ‘on the question paper. 5, Indicate clearly, the option(s) you attempt along with its respective question no. 6. Figures to the right indicate full marks. SECTION-1 Q1 Answer the following questions. 1. Why analysis phase is divided into lexical analysis and parsing? Why input 3 buffer in Lexical Analyzer is divided into two halves? 2. Differentiate following terms. 4 a) Parse Tree and Annotated Parse Tree b)Parse Tree and Syntax Tree 3, Construct DFA and minimize it 4 (OrI)* 0. Q2 1A] Consider the grammar: S->SS+| SS*[a 3 (1) Show that the string aa+a* can be generated by the grammar. (2) Construct the parse tree for the grammar. (3). Is the grammar ambiguous? [8] Write an algorithm for scanner, wkich can identify following *C’ language tokens. 5 (i) Keywords (if, else, while) String constants e.g. “this is constant” single line comments-/* this is comment*/ punctuation symbols—*,”,", %.{.}' OR [B] Give the translation of three address code for the following stmt: 5 while a expr+ term expr > expr~ term term > 0/1] sou) 9 (C] Construct the Non-Recursive Predictive Parsing table for the following 4 grammar, S>aBDh BoeC > bC | mull D>EF E> g/ null F>f/nul or (c] uss on the factors affecting Target Code Generation (phase) ofa compiler. 4 SECTION-II Qs 1. What is left factoring problems? Explain in detail, Also explain how to 4 solve these problems. Left factor the following grammar: SS IEAS | 1EtSeS | > EDb 2. Write grammar to generate the following language 4 L= { SREV{(S)S| S€{a,b}*} 3. What are the goals of error handler? Explain: Panic Mode Emor 3 Recovery Strategy. Os TA] Name at least six items of run-time information stored in an activation 4 record/frame. For each item, identify whether its value is set before the procedure is called, during procedure execution or right before procedure return. [B] What is the need for symbol table? How does the symbol table represented in 4 memory? Explain Hash symbol table. oR {B] Eliminate the “eft recursion from the following grammar:; 4 8 al *|(T) TOT,S|s Whether the transformed grammar is LL (1)? IC] Check whether the following grammar is LL, (1) or not? 4 S> aABC A> a|bbD Bale Coble Delz OR [C] What is code optimization? What are the sources of optimization? List the criteria 4 for selecting cade optimization technique. 6 [A] State the following Grammar is LR (1) but not LALR (1). 4 $9 Aa| bAc| Be | bBa ada Bd Page 20f3 B) Bi (cl (c) Compute the RIRST and FOLLOW sets for the following grammar: S> aAbe | BCE BD Cd{e A>Cle Cafe oR Construct canonical LR (0) parsing states for following, grammar: S> Ik SOR LOR Lid ROL Consider the following augmented grammar: s'>8 $?cCc CCl Prepare the goto graph for it. OR Construct SLR parsing table and find set of LR (1) items. S— aA.Be ASAbe Aob Bod Page 3 of 3

You might also like