Sample Paper of Compiler Design

Mar 15 • General • 5505 Views • 3 Comments on Sample Paper of Compiler Design

Maximum Marks=100

Time taken=3 hours

Instructions:Attempt any Five questions selecting atleast one from each unit.All questions carry twenty marks each.

Unit 1

1. (a) Give the structure of a compiler and mention the phases of compiler.

Ans : Compilers are divided into many passes to save space.When each pass is finished, the compiler can free the space needed during that pass.

compiler design

Phases of compiler design

(b) What challenges are there in compiler design?

Ans : The major challenges in compiler design are it must be bug free, should generate correct machine code, must print diagnostics and error messages.

2. Explain the different types of parsers with related diagrams.

Ans : There are basically two types of parsers namely top-down parser and bottom up parser.

Bottom up parser

Bottom up parser

Unit 2

3. (a) What do you understand by intermediate code?

Ans. In many compilers the source programming code is translated into a language which is intermediate in complexity between a high level programming language and machine code. Such a language is therefore called intermediate code.

(b) Discuss the advantages of writing intermediate codes.

Ans. It is machine independent and performs efficient code generation.

4. (a) What are the different data structures in symbol tables?

Ans : The various data structures are lists, self-organising lists, trees and hash tables.

(b) Explain the concept of Block Structural Language and how does it affect a symbol table.

Ans : A Block Structural Language contains each program od subprogram organised as a set of nested blocks.

Unit 3

5. Explain Global Data Flow Analysis.

Ans : In Global Data Flow Analysis we analyze the flow of data from one block to another block of a program.

6. (a) What are the goals of Error Handler?

Ans : It should detect the presence of subsequent errors and produce meaningful diagnostics.

(b) Explain the classification of errors.

Ans : Lexical errors, syntactic errors, semantic errors, logical errors, other dynamic errors.

Unit 4

7. (a) What are the issues in design of a code generator?

Ans : Input to code generator, target program, instruction selection, register allocation and evaluation order are some of the issues in code generator.

(b) How can we generate code from a DAG?

Ans : We can generate code from DAG by rearranging order, heuristic ordering and labeling algorithm.

Tell us Your Queries, Suggestions and Feedback

Your email address will not be published.

3 Responses to Sample Paper of Compiler Design

  1. Philip Saim Aboagye says:

    compilers and artificial intelligence

  2. Anjali Dreamgirl says:

    Compiler design is a tough subject, one must do practice.

  3. patlakshi Jha says:

    This article is based on sample questions of compiler design. this can be helpful for the students.

« »