Compiler Design and Construction 2078

Question Paper Details
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

Official Answer
AI Generated Answer

AI is thinking...

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

Official Answer
AI Generated Answer

AI is thinking...

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
Details
Official Answer
AI Generated Answer

AI is thinking...

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
Details
Official Answer
AI Generated Answer

AI is thinking...

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
Details
Official Answer
AI Generated Answer

AI is thinking...

Section B

Official Answer
AI Generated Answer

AI is thinking...

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

Official Answer
AI Generated Answer

AI is thinking...

4. Define compiler and differentiate it with an interpreter.

5 marks
Details
Official Answer
AI Generated Answer

AI is thinking...

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

5 marks
Details
Official Answer
AI Generated Answer

AI is thinking...

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

                S→SB | Ca

                B→Bb | c

                C→aB | a

5 marks
Details
Official Answer
AI Generated Answer

AI is thinking...

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
Details
Official Answer
AI Generated Answer

AI is thinking...

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

5 marks
Details
Official Answer
AI Generated Answer

AI is thinking...

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

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

5 marks
Details
Official Answer
AI Generated Answer

AI is thinking...

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

5 marks
Details
Official Answer
AI Generated Answer

AI is thinking...

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

5 marks
Details
Official Answer
AI Generated Answer

AI is thinking...

12. Explain about the factors affecting target code generation.

5 marks
Details
Official Answer
AI Generated Answer

AI is thinking...