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

Cs 337

The document contains a model question paper for the sixth semester Bachelor of Engineering in Computer Science and Engineering course. It includes 20 short answer questions in Part A testing concepts like compiler construction tools, language conventions, regular expressions, finite automata, grammars, parsing algorithms, code generation etc. Part B includes 5 long answer questions testing topics such as lexical analysis, Thompson's construction, LR parsing, code generation, symbol tables, postfix expressions, Boolean expressions etc. Students are required to answer all questions which are worth a total of 100 marks.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
79 views

Cs 337

The document contains a model question paper for the sixth semester Bachelor of Engineering in Computer Science and Engineering course. It includes 20 short answer questions in Part A testing concepts like compiler construction tools, language conventions, regular expressions, finite automata, grammars, parsing algorithms, code generation etc. Part B includes 5 long answer questions testing topics such as lexical analysis, Thompson's construction, LR parsing, code generation, symbol tables, postfix expressions, Boolean expressions etc. Students are required to answer all questions which are worth a total of 100 marks.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 2

ANNA UNIVERSITY :: CHENNAI 600 025 MODEL QUESTION PAPER VI SEMESTER B.E.

. COMPUTER SCIENCE AND ENIGNEERING CS337 - PRINCIPLES OF COMPLIER DESIGN Time: Three Hours Answer All The Questions PART A (10 x 2 = 20 Marks) 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. List any two complier construction tools, indicating their inputs and outputs. Briefly explain any two language conventions that impact the difficulty of lexical analysis. Write regular definition for the following language over {0,1} A string of 0s and 1s, which has 0 at the third position when counted from night. Formally define a nondeterministic finite automation (NFA) Prove that the following grammar is ambiguous: S aSbS bSaS Write down the predictive parsing algorithm. Give the algorithm for generating the closure of a set of LR (0) items. Translate the expression : - (a+b) * (a+b+c) into quadruples and indirect triples. Give the grammar for generating binary numbers. Add semantic rules to the above grammar to compute the decimal equivalent of the binary number, generated. Write down the algorithm that partitions the given sequence of three-address statements into basic books. Part B (5 x 16 = 80 Marks) 11. Draw the transition diagram for the lexical analyzer that recognize the following tokens. Identifiers, relational operators. Use the following rules to form the identifier 12.a) begins with an alphabet consists of alphabets, digits and hyphen should not end with an hyphen not two hyphens appear together Maximum: 100 Marks

Draw the NFA for the following regular expression using Thompsons Construction and then convert it into an equivalent DFA. (a/b) * (a/c) * b

(OR) 12.b)i) List the tasks performed by a lexical analyzer

ii) Give the complete algorithm that takes a NFA and converts it into an equivalent DFA. 13.a) Remove left recursion from the following grammar and build the predictive parsing table. S (L) a L (L, S) S (OR) 13.b) Build LR(1) parsing table for the grammar: S Aa bAc Bc bBa Ad Bd 14.a) Write down the translation scheme for generating three address code for evaluating Boolean expressions using back patching. Explain the attributes used. Use the above and generate three address code for: While ( (a<b) and (c>d) ) do begin if(p=q) then p = 1 else p = 2 While (p>q) do Begin P: = x+y q: = x-y end end (OR) 14.b) Explain how declarations are processed by the computer. Take into consideration nested procedures also. Explain clearly the attributes used. Show with an example how the symbol tables are formed. 15.a)i) Explain how next use information about names in basic blocks can be collected. ii) Discuss about the actions performed by a simple code generator while generating code for a typical three-address statement of a form x: = y op z. (OR) 15.b)i) Write the syntax directed definition that computers and prints the post-fix equivalent of the given infix expression. ii) Write down the unambiguous CFG for generating Boolean expressions. -----

You might also like