Compiler Design and Construction 2078

Tribhuwan University
Institute of Science and Technology
2078
Bachelor Level / Sixth Semester / Science
Computer Science and Information Technology ( CSC365 )
( Compiler Design and Construction )
Full Marks: 60
Pass Marks: 24
Time: 3 hours
Candidates are required to give their answers in their own words as far as practicable.
The figures in the margin indicate full marks.

Section A

Attempt any two questions.(2*10=20)

1. List out the tasks performed by Lexical Analyser. Define DFA. Convert the Regular Expression (a+b)*a(a+b) to DFA directly. (3+1+6)

10 marks view

2. Differentiate between LR(0) and LR(1) algorithm. Construct LR(1) parse table of the following grammar.(3+7)

                    S->AA

                    A->aA | b

10 marks view

3. Define type checking. Differentiate between type casting and coercion? Write SDD to carry out type checking for the following expression.

            E->n|E*E| E==|E[E] | E

10 marks view

Section B

Attempt any eight questions. (8*5 = 40)

4. Define compiler and differentiate it with an interpreter.

5 marks view

5. What are the typical entries made in symbol table? Explain.

5 marks view

6. Define Left recursive grammar. Remove left recursion from the following grammar.

                S→SB | Ca

                B→Bb | c

                C→aB | a

5 marks view

7. What are the disadvantages of shift reduce parsing. Perform shift reduce parsing of string

                    w= (x-x) -(x/x) for given grammar.

                    E→ E-E | E/E | (E) | x

5 marks view

8. Define attribute grammar with example of inherited and synthesized attributes.

5 marks view

9. Define three  address codes. Write down Quadruples for,

                    a = -b*(c+d)/e

5 marks view

10. List out different types of run time storage management techniques. Explain any one of them.

5 marks view

11. What is the advantages of code optimization? Explain about dead - code elimination.

5 marks view

12. Explain about the factors affecting target code generation.

5 marks view