Tuesday, July 29, 2008

Tutorial sheet-1

Gurgaon Institute of Technology and Management
Tutorial Sheet No. 1
Department: Computer Science & Engineering
Semester : VII
Subject Name &Code: Compiler Design & CSE-405-E

Issue Date:

Pages :
Unit: 1
Faculty : ARUN KUMAR PATEL



Q.1.What is meant by Compilers and Translators? Why do we need this? Discuss the structure of compiler.


Q.2. Differentiate between:
(i) Phase and Pass of Compiler
(ii) Compiler and Interpreter
(iii) Code Optimization and Code Generation























Prepared by: Approved by:







Gurgaon Institute of Technology and Management
Tutorial Sheet No. 2
Department: Computer Science & Engineering
Semester : VII
Subject Name &Code: Compiler Design & CSE-405-E

Issue Date:

Pages :
Unit: 2
Faculty : ARUN KUMAR PATEL


Q.1. (a) What are regular expressions? Discuss their role in construction of compiler.

Q.2. (b) What is LEX? Discuss LEX source program structure.

Q.3. Discuss the implementation of a Lexical Analyzer ?























Prepared by: Approved by:









Gurgaon Institute of Technology and Management
Tutorial Sheet No. 3
Department: Computer Science & Engineering
Semester : VII
Subject Name &Code: Compiler Design & CSE-405-E

Issue Date:

Pages :
Unit: 3
Faculty : ARUN KUMAR PATEL



Q.1.What do you understand by Ambiguity in grammar? Discuss the ambiguity of the following grammar
Eà E+E E-E E*E E/E E ­E (E) -E id

Q.2.What is parse tree? Justify its significance.

Q.3. Consider the grammar

Sà a Ù (T) , T à T,S S
Find the right most derivation for (a,(a,a)).



















Prepared by: Approved by:







Gurgaon Institute of Technology and Management
Tutorial Sheet No. 4
Department: Computer Science & Engineering
Semester : VII
Subject Name &Code: Compiler Design & CSE-405-E

Issue Date:

Pages :
Unit: 4
Faculty : ARUN KUMAR PATEL


Q.1.What do you understand by a handle? Explain the stack implementation of shift reduce parser with the help of example.

Q.2. For the following grammar with E as starting symbol, find the FIRST and FOLLOW sets of each of the non terminals

E à TE’
E’à TE’ E
T à +FT’
T’à *FT’ E
Fà (E) id
Also write algorithms to compute First and Follow set.
















Prepared by: Approved by:









Gurgaon Institute of Technology and Management
Tutorial Sheet No. 5
Department: Computer Science & Engineering
Semester : VII
Subject Name &Code: Compiler Design & CSE-405-E

Issue Date:

Pages :
Unit: 5
Faculty : ARUN KUMAR PATEL





Q.1. Differentiate between SLR and LALR Parser.

Q.2. Explain the LR parsing scheme. Define an item. Write procedure to compute LR(0) items.














Prepared by: Approved by:





















Gurgaon Institute of Technology and Management
Tutorial Sheet No. 6
Department: Computer Science & Engineering
Semester : VII
Subject Name &Code: Compiler Design & CSE-405-E

Issue Date:

Pages :
Unit: 6
Faculty : ARUN KUMAR PATEL
Q.1. Define quadruples, triples and indirect triples. Write for the expression

- (a+b) * (c+d) – (a+b+c)

Q.2. What is meant by syntax directed translation scheme? What is its significance in compiler designing?

Q.3.What is syntax trees? How these can be constructed?


















Prepared by: Approved by:









Gurgaon Institute of Technology and Management
Tutorial Sheet No. 7
Department: Computer Science & Engineering
Semester : VII
Subject Name &Code: Compiler Design & CSE-405-E

Issue Date:

Pages :
Unit: 7
Faculty : ARUN KUMAR PATEL

Q.1. What information a good symbol table should contain? Explain how linked lists are used to store a symbol table.

Q.2.What are various sources of error? Explain how error detection and recovery is done in Compiler.
















Prepared by: Approved by:


















Gurgaon Institute of Technology and Management
Tutorial Sheet No. 8
Department: Computer Science & Engineering
Semester : VII
Subject Name &Code: Compiler Design & CSE-405-E

Issue Date:

Pages :
Unit: 8
Faculty : ARUN KUMAR PATEL

Q.1.What is meant by resister allocation? Why is it considered to be important?


Q.2. Discuss briefly about Code Optimization

Q.3. Discuss the problem faced by compilers during Code generations.





















Prepared by: Approved by:

No comments: